When adding ports to Linux OS virtual servers, perform configuration of interface files. This section explains the procedure.
Note: This procedure uses the following environment.
- OS: CentOS 6.8
- Default gateway of the virtual server: Port on the business service network side
- eth0: Port of the management network
- eth1: Port of the business service network
-
Copy the interface file (ifcfg-eth0) of the management network port, and create the interface file (ifcfg-eth1) for the business service network port attached to the virtual server. Also, describe in the interface file which port to use as the default gateway.
- /etc/sysconfig/network-scripts/ifcfg-eth0
Add "DEFROUTE=no".
DEVICE="eth0"
BOOTPROTO="dhcp"
IPV6INIT="yes"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="733285fa-1efe-4d9c-a70b-668922168a3f"
DEFROUTE=no
- /etc/sysconfig/network-scripts/ifcfg-eth1
Comment out the UUID and add "DEFROUTE=yes".
DEVICE="eth1"
BOOTPROTO="dhcp"
IPV6INIT="yes"
MTU="1500"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
#UUID="733285fa-1efe-4d9c-a70b-668922168a3f"
DEFROUTE=yes
Important: Specify in DEFROUTE whether to use the interface as the default gateway.
-
Perform reconfiguration of the network
Execute the following command and reconfigure the network settings of the OS.
/etc/init.d/network restart