CVM Primary Network Interface Binds Multiple IP

Last Updated At: 2025-11-26 11:17:19

A single CVM can be bound to a maximum number of public IP addresses (including ordinary public IP and EIP) to achieve traffic transfer and improve the CVM usage. This document introduces how to bind multiple EIPs to Linux and Windows CVM.

Prerequisites

  • You have purchased Linux CVM and Windows CVM, and the ICMP protocol is enabled in the security group.
  • Ensure that your public IP is within the limit. For specific limits, see Limits.
  • Ensure that the number of private IPs bound to a single network interface is within the limit.

Directions

Step 1: Allocate Private IP

  1. Log in to the CVM console.
  2. In the instance list, click your CVM ID. On the details page, select ENI.
  3. On the ENI page, click Assign Private IP on the right side of the primary network interface.
  4. In the pop-up Assign Private IP dialog box, select automatic allocation or manually fill in the private IP to be allocated. If you need to allocate multiple private IPs, click Add and fill in the private IP to be allocated. After completion, click OK.

    Note:

    If you choose to fill in manually, make sure that the private IP you fill in is within the subnet IP range and is not a system-reserved IP.

    For example, if the subnet segment is: 10.0.0.0/24, then the available private IP range is : 10.0.0.2 - 10.0.0.254. This operation takes manually filling in 10.0.0.3 as an example.

Step 2: Bind EIP

  1. On the ENI page, click to expand the primary network interface information.
  2. In the row of the private IP whose allocated type is secondary IP, click Bind under the Bound EIP column.
  3. In the pop-up Bind EIP dialog box:
    • If there is an optional EIP, select it and click OK.
    • If there is no EIP available, click Create an EIP on the top of the pop-up window to apply for it. For details, see Applying for EIP. After the application is successful, return to the pop-up box and click Refresh to see the applied EIP, select it, and click OK.
  4. In the list of primary network interfaces, you can view information about the binding of the private IP to the public IP.

Step 3: Configure the network interface

Select the corresponding network interface configuration operation according to the type of your CVM operating system:

Linux CVM

The following operations take CentOS 7 CVM as an example:

  1. Log in to the CVM console.

  2. In the instance list, click your CVM ID. On the details page, select ENI.

  3. Click the primary network interface ID to enter the primary network interface details page and record the following information based on the subnet to which it belongs:

    • Subnet Mask: As shown in the figure below, the CIDR bit number of the subnet is /24; that is, the subnet mask is 255.255.255.0.
    • Gateway: If you have not changed other settings, the gateway is the first IP of the subnet range. For example, the first IP of the subnet range in the figure below is 10.0.0.1.
  4. Log in to the CVM. For details, see Logging in to Linux Instance Using the Standard Log-in Method (Recommended).

  5. Run the following command to back up the network interface information.

    cp /etc/sysconfig/network-scripts/ifcfg-eth0{,.bak}
    
  6. Run the following command to open the network interface configuration file.

    vim /etc/sysconfig/network-scripts/ifcfg-eth0
    
  7. You can press i to switch to the Edit mode and modify the configuration file content to:

    # Created by cloud-init on instance boot automatically, do not edit.
    #
    # Change this to static
    BOOTPROTO=static
    DEVICE=eth0
    #
    # Comment this line
    # HWADDR=52:54:00:8a:7a:64
    #
    # Add the following lines.
    #
    # Configure the primary IP.
    IPADDR0=10.0.0.2 # Step 1: Bind the primary IP found in EIP. Fill in according to the actual situation.
    NETMASK0=255.255.255.0 # The subnet mask recorded in step 3. Fill in according to the actual situation.
    # Configure secondary IP 1.
    IPADDR1=10.0.0.3 # Step 1: Bind the secondary IP manually filled in the EIP. Fill in according to the actual situation.
    NETMASK1=255.255.255.0
    # If you have multiple secondary IPs, continue to configure secondary IP2, secondary IP3...
    #IPADDR2=10.0.0.4
    #NETMASK2=255.255.255.0
    #IPADDR3=10.0.0.5
    #NETMASK3=255.255.255.0
    #......
    # Configure the gateway.
    GATEWAY=10.0.0.1 # The gateway recorded in step 3. Fill in according to the actual situation.
    #
    NM_CONTROLLED=no
    ONBOOT=yes
    PERSISTENT_DHCLIENT=yes
    TYPE=Ethernet
    USERCTL=no
    

After it is modified, the example is as follows:

8. After completing the modification, press Esc, enter :wq! Press Enter to save the configuration and return.
9. Run the following command to restart the network service:

systemctl restart network.service
  1. Run the following command to view the IP address:
ip address 

Windows CVM

The following operations take Windows 2012 CVM as an example:

  1. Log in to the CVM. For details, see Log in to Windows Instance Using RDP Files.

  2. Follow the steps below to view the IP address, subnet mask, default gateway, and DNS server of the CVM:

  3. On the operating system interface, select in the lower left corner, click , open the Windows PowerShell window and run the following command:

    ipconfig /all
    
  4. Record the IPv4 address, subnet mask, default gateway, and DNS server values from the output of the network API information.

  5. Go to the operating system's Control Panel > Network and Internet > Network and Sharing Center and click the network interface named Ethernet to edit it.

  6. In the Ethernet Status pop-up window, click Attribute.

  7. In the Ethernet Attributes pop-up window, select Internet Protocol Version 4 (TCP/IPv4) and click Attribute.

  8. In the Internet Protocol Version 4 (TCP/IPv4) Attributes pop-up window, fill in the following information:

Parameter Name Parameter Value
IP Address The IPv4 address in the above Step 2.
Subnet Mask The subnet mask in the above Step 2.
Default Gateway The default gateway address in the above Step 2.
Preferred DNS Server The DNS servers in the Above Step 2.
Backup DNS Server The backup DNS Servers in the Above Step 2. If no backup DNS servers are listed, this parameter is not required.
  1. Click Advanced and configure the secondary private IP.
  2. Under the pop-up window Advanced TCP/IP Settings, in the IP Address module, click Add.
  3. In the TCP/IP Address pop-up window, fill in the secondary private IP configured in Step 2: Bind EIP and subnet mask in the above Step 2, and click Add. If there are multiple secondary IPs, repeat the previous step and the current step.
  4. In the Internet Protocol Version 4 (TCP/IPv4) Attribute pop-up window, click OK.
  5. In the Ethernet Attribute pop-up window, click OK to complete the configuration.
  6. In the "Ethernet Status" popup, click Details to view the configured IP information.

Step 4: Result verification

Log in to other CVM and execute ping <secondary IP public network address> command. If the following information is displayed, the binding is successful.
If the following results are not obtained after executing the command, check whether the ICMP protocol is enabled in the CVM security group configuration.