This topic describes how to associate multiple Elastic IP Addresses (EIPs) with a secondary Elastic Network Interface (ENI) in the NAT mode. By associating multiple EIPs with a secondary ENI, you can improve the availability of the associated ECS instance.

Prerequisites

If you want to associate multiple EIPs with a secondary ENI in the NAT mode, the following requirements must be met:

Step 1 Assign multiple secondary private IP addresses to the ENI

To assign multiple secondary private IP addresses to the ENI, follow these steps:

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Network & Security > ENI.
  3. On the Network Interfaces page, select the region of the target ENI.
  4. Find the target ENI and click Manage Secondary Private IP Address in the Actions column.
  5. On the Manage Secondary Private IP Address page, click Assign New IP multiple times to assign multiple secondary private IP addresses to the ENI.
    Note You can manually enter private IP addresses, which must fall into the IPv4 Private CIDR. If you do not enter any IP addresses, the system will automatically assign IP addresses from the IPv4 Private CIDR.


  6. Click Modify.

Step 2 Associate EIPs with the secondary private IP addresses

To associate EIPs with the secondary private IP addresses of the ENI, follow these steps:

  1. Log on to the VPC console.
  2. In the left-side navigation pane, click Elastic IP Addresses.
  3. Select the region of the target EIP.
  4. On the Elastic IP Addresses page, find the target EIP and click Bind in the Actions column.
  5. On the Bind Elastic IP Address page, complete the following configurations, and then click OK.
    • Instance Type: Select Secondary ENI.
    • Resource Group: Select the resource group to which the EIP belongs.
    • Mode: Select NAT Mode.
    • Secondary ENI: Select the ENI to be associated with the EIP.
  6. Repeat the preceding steps to associate multiple EIPs with the secondary private IP addresses of the secondary ENI.

Step 3 Associate the ENI with an ECS instance

After associating EIPs with the secondary private IP addresses of the ENI, you need to associate the ENI with an ECS instance. For more information, see Attach an ENI to an existing ECS instance.

Step 4 Configure secondary private IP addresses

After associating the ENI with an ECS instance, you need to configure secondary private IP addresses for the ECS instance. For more information, see Assign a secondary private IP address to a Windows instance and Assign a secondary private IP address to a Linux instance.
Notice To configure secondary private IP addresses for an ECS instance, you must first obtain the gateway and subnet mask. For more information, see Retrieve instance metadata.
After configuring secondary private IP addresses, you can run the ip address command to view the configured secondary private IP addresses.

Step 5 Test the network connectivity

In this example, an ECS instance with the Linux operating system is created and static routing of the eth1 network interface is configured. To test the network connectivity of the ECS instance, follow these steps:

  1. Log on to the ECS instance.
  2. Run the following command to configure static routing for the eth1 network interface: /sbin/iproute add <destination network>/<the number of network bits> via <gateway of the secondary private IP address> eth1 src <secondary private IP address>.
  3. Run the following command to check the network connectivity between the secondary private IP address and the destination network: ping <destination network> -I <secondary private IP address>.
    If the ping test succeeds, it indicates that the EIPs have been associated with the secondary private IP addresses of the ENI.