Linux OS

<p><strong>Add Temporary Route</strong></p> <p>Perform the following commands in ECS_A.</p> <pre> <code># View the gateways of eth0 and eth1, and they can be acquired in DHCP. grep routers /var/lib/dhclient/dhclient-eth0.leases | tail -1 | awk '{print $3}' | sed 's/;//g’ 10.16.117.1 grep routers /var/lib/dhclient/dhclient-eth1.leases | tail -1 | awk '{print $3}' | sed 's/;//g’ 10.17.56.1 # In this case, the gateway of eth0 is 10.16.117.1, and the gateway of eth1 is 10.17.56.1. # Add the rule for routing to ECS_B network segment. ip route add 10.17.60.0/25 via 10.17.56.1 dev eth1 # Check whether the route is successfully added. ip route show | grep 10.17.60.0/25 # The output content: 10.17.60.0/25 via 10.17.56.1 dev eth1 # As Ping An Cloud agent requires the eths to be connected to the sever, so the routing needs to go from eth0. ip route show | grep default # The output content: default via 10.16.117.1 dev eth0 # If there is no default route, you need to add one manually. ip route add default via 10.16.117.1 dev eth0 </code></pre> <p>The method for adding a temporary route for ECS_B is the same, and only the network and gateway are different.</p> <pre> <code># Acquire the default gateways of eth0 and eth1 on ECS_B in the same way. # The command will not be listed here again. # In this case, the gateway of eth0 on ECS_B is 10.16.192.1, and that of eth1 is 10.17.60.1. # Add the rule for routing to ECS_A network segment. ip route add 10.17.56.0/25 via 10.17.60.1 dev eth1 # Check whether the route is successfully added. ip route show | grep 10.17.56.0/25 # The output content: 10.17.56.0/25 via 10.17.60.1 dev eth1 # As Ping An Cloud agent requires the eths to be connected to the sever, so the routing needs to go from eth0. ip route show | grep default # The output content: default via 10.16.192.1 dev eth0 # If there is no default route, you need to add one manually. ip route add default via 10.16.192.1 dev eth0</code></pre> <p><strong>Add a Static Route</strong></p> <p>After a temporary route is added, you can access other ECS hosts, but if the host is restarted, this routing policy will be cleared. Thus, the route needs to be written into the configuration file.</p> <p><strong>Usage Guidelines</strong></p> <p>A static routing does not come into effect immediately. The routing is automatically added in the process when the eth is driven (either by starting OS or execute ifup). If you want immediate communication via eth1 and keep this routing after OS or eth restart, add the temporary route first and then add the static routing.</p> <p><strong>CentOS/Red Hat Enterprise Linux Operating System</strong></p> <p>On ECS_A, create route configuration file for eth1: /etc/sysconfig/network-scripts/route-eth1.</p> <p>Add</p> <p>10.17.60.0/25 via 10.17.56.1</p> <p>On ECS_B, create route configuration file for eth1 too: /etc/sysconfig/network-scripts/route-eth1.</p> <p>Add</p> <p>10.17.56.0/25 via 10.17.60.1</p> <p><strong>Debian/ Ubuntu Operating System</strong></p> <p>For Debian OS and Ubuntu OS with a version of 16.04 and below, edit /etc/network/interfaces on ECS_A to add the two lines in red.</p> <pre> <code># This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp auto eth1 iface eth1 inet dhcp up ip route add 10.17.60.0/25 via 10.17.56.1 dev eth1 up ip route change default via 10.16.117.1 dev eth0</code></pre> <p>For ECS_B, add the following configuration lines in the same file and location.</p> <pre> <code>up ip route add 10.17.56.0/25 via 10.17.60.1 dev eth1 up ip route change default via 10.16.192.1 dev eth0</code></pre> <p>For Ubuntu 18.04, its default network management toll has been changed to netplan. Thus, to add a static route for it, you need to modify /etc/netplan/01-netcfg.yaml and add the above red lines in the eth1 configuration files.</p> <pre> <code>network:   version: 2   renderer: networkd   ethernets:     eth0:       dhcp4: true       nameservers:         search: [cloud.papub]         addresses: [100.68.10.22, 100.68.10.23]     eth1:       dhcp4: true       optional: true       routes:         - to: 10.17.60.0/25          via: 10.17.56.1</code></pre> <p>For ECS_B, add the following configuration lines in the same file and location.&nbsp;</p> <pre> <code>     routes:         - to: 10.17.56.0/25          via: 10.17.60.1</code></pre> <p>&nbsp;</p>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products