Help Center> Elastic Cloud Server> Troubleshooting> General Issues> Troubleshooting Multi-IP-Address Access on an ECS with Multiple NICs Attached

Troubleshooting Multi-IP-Address Access on an ECS with Multiple NICs Attached

Symptom

If an ECS has multiple NICs, perform the following operations to configure policy-based routing for the ECS to enable the network communication of secondary NICs.

Possible Causes

No routing rules are configured for the EIPs bound to the extension NICs.

Linux

  1. Run the following command to add the priority value and name of the route table for each NIC to the /etc/iproute2/rt_tables file. A smaller priority value represents a higher priority. In this example, 250 and net0 indicate the route table priority value and name of eth0, respectively. 251 and net1 indicate the route table priority value and name of eth1, respectively. If there are multiple NICs, add the route table priority value and name of each NIC one by one.

    vi /etc/iproute2/rt_tables

    # added for dual net 
    250     net0
    251     net1 
  2. Run the following command to add routing information of each NIC to the /etc/rc.local file:

    vi /etc/rc.local

    eth0 is used as an example here. If an IPv4 NIC is used, obtain the following information:

    IPv4 address (192.168.0.129), subnet (192.168.0.0/24), gateway address (192.168.0.1), and route table added in step 1 (net0)

    # wait for nics up 
     sleep 5 
     # Add v4 routes for eth0 
     ip route flush table net0 
     ip route add default via 192.168.0.1 dev eth0 table net0 
     ip route add 192.168.0.0/24 dev eth0 table net0 
     ip rule add from 192.168.0.129 table net0  
     # Add v4 routes for eth1 
     ip route flush table net1 
     ip route add default via 192.168.1.1 dev eth1 table net1 
     ip route add 192.168.1.0/24 dev eth1 table net1 
     ip rule add from 192.168.1.138 table net1

    Before configuring policy-based routing for NICs using IPv6 addresses, ensure that IPv6-related configurations have been performed. For details, see "Linux (Automatic Configuration of IPv6)" in Dynamically Assigning IPv6 Addresses.

    eth0 is used as an example here. If an IPv6 NIC is used, obtain the following information:

    IPv6 address (2407:c080:802:1be:2233:64bf:b095:54bf), subnet (2407:c080:802:1be::/64), gateway address (fe80::f816:3eff:fef3:20dc), and route table added in step1 is net0

    Run the command ip -6 route show| grep default to view the IPv6 gateway address of a NIC.

    If there are multiple NICs, add their routing information one by one.

    # Add v6 routes for eth0 
     ip -6 route flush table net0 
     ip -6 route add default via fe80::f816:3eff:fef3:20dc dev eth0 table net0 
     ip -6 route add 2407:c080:802:1be::/64 dev eth0 table net0 
     ip -6 rule add from 2407:c080:802:1be:2233:64bf:b095:54bf table net0  
     # Add v6 routes for eth1 
     ip -6 route flush table net1 
     ip -6 route add default via fe80::f816:3eff:fe10:5447 dev eth1 table net1 
     ip -6 route add 2407:c080:802:1bf::/64 dev eth1 table net1 
     ip -6 rule add from 2407:c080:802:1bf:39ea:bffe:13a2:7a1f table net1
  3. Run the following command to add the execute permission for the rc.local file:

    # chmod +x /etc/rc.local

  4. Run the reboot command to restart the ECS.
  5. After the restart, run the following command to check whether the configured routes and route tables take effect.

    For IPv4 NICs:

    ip rule

    ip route show table net0

    ip route show table net1

    For IPv6 NICs:

    ip -6 rule

    ip -6 route show table net0

    ip -6 route show table net1

  6. Specify the source addresses for the test.

    For IPv4 addresses:

    ping -I 192.168.0.129 xxx

    ping -I 192.168.1.138 xxx

    For IPv6 addresses:

    ping -I 2407:c080:802:1be:2233:64bf:b095:54bf xxx

    ping -I 2407:c080:802:1bf:39ea:bffe:13a2:7a1f xxx

Windows

  1. Choose Control Panel > Network and Internet > Network Connections. Right-click Local Area Connection 2 and then click Properties.

    Right-click to add NICs based on the site requirements. If there are multiple NICs, there will be multiple local area connections. Configure them one by one.

  2. On the Network tab page, select Internet Protocol Version 4 (TCP/IPv4).
  3. Click Properties.
  4. On the General tab page, click Advanced.
  5. On the IP Settings tab, click Add in the Default gateways area.
    Figure 1 Advanced TCP/IP settings
  6. Enter the gateway address of the secondary NIC and click Add.
    Figure 2 TCP/IP Gateway Address
  7. Click OK.
  8. Open the command line interface (CLI) of the Windows OS and enter route print to view the policy-based routes.

  9. Specify the source addresses for the test.

    ping -S 192.168.0.129 xxx

    ping -S 192.168.1.138 xxx