Help Center/ Elastic Cloud Server/ API Reference/ Out-of-Date APIs/ NIC Management/ Binding a Virtual IP Address to an ECS NIC (Discarded)
Updated on 2022-09-23 GMT+08:00

Binding a Virtual IP Address to an ECS NIC (Discarded)

Function

A virtual IP address provides the second IP address for one or multiple ECS NICs, improving high availability between the ECSs.

This API is used to bind a virtual IP address to an ECS NIC.

  • If the specified IP address is a virtual IP address that has not been assigned, the system automatically assigns the virtual IP address and binds it to a specified NIC.
  • If the specified IP address is a virtual IP address that has been assigned, the system binds the virtual IP address to a specified NIC. If the device_owner of this IP address is left blank, only intra-VPC layer 2 and layer 3 communication is supported. If the device_owner of this IP address is neutron:VIP_PORT, intra-VPC layer 2 and layer 3 communication, inter-VPC peer access, as well as Internet access through EIP, VPN, and Cloud Connect are supported.

URI

PUT /v1/{project_id}/cloudservers/nics/{nic_id}

Table 1 lists the parameters.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

nic_id

Yes

Specifies the ECS NIC ID.

Request

Table 2 describes the request parameter.
Table 2 Request parameter

Parameter

Mandatory

Type

Description

nic

Yes

Object

Specifies the NIC parameters required for binding a virtual IP address. For details, see Table 3.

Table 3 nic field description

Parameter

Mandatory

Type

Description

subnet_id

Yes

String

Specifies the information about the NICs to be added to an ECS.

Set the parameter value to the ID (in UUID format) of the network created in the VPC to which the target ECS belongs.

ip_address

Yes

String

Specifies the virtual IP address to be bound to a NIC.

reverse_binding

No

Boolean

Specifies whether to add the NIC IP/MAC address pair to allowed_address_pairs.

NOTE:

The virtual IP address can be displayed on the NIC details page only after the IP/MAC address pair is added.

Response

Table 4 describes the response parameter.
Table 4 Response parameter

Parameter

Type

Description

port_id

String

Specifies the ECS NIC ID.

Example Request

PUT https://{endpoint}/v1/{project_id}/cloudservers/nics/{nic_id}
{
    "nic": { 
           "subnet_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23",
           "ip_address": "192.168.0.7",
           "reverse_binding": true
    }
}

Example Response

{
   "port_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23"
}

Error Codes

See Error Codes.