The problem of network failure after bond configuration of linux Nic in vmware virtual machine environment after forbidding eth0
In a regular real machine environment, configure the ENI with bond as follows (assumed to be bond0):
1 、 ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
BOOTPROTO=none
SLAVE=yes
2 、 ifcfg-eth2
DEVICE=eth2
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
ONBOOT=yes
3 、 ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
IPADDR=172.16.3.22
NETMASK=255.255.248.0
ONBOOT=yes
BROADCAST=10.1.7.255
4 、 / etc/modprobe.conf
After the contents of the original file, append the following configuration:
Alias bond0 bonding
Options bond0 miimon=100 mode=1
Configuration explanation: miimon=100, the system monitors the link connection status once per 100ms, mode=1, indicating that the network card eth0,eth2 uses hot backup mode (if mode=1, eth0 and eth2 use load balancing mode)
5 、 / etc/rc.local
After the contents of the original file, append the following configuration:
Ifenslave bond0 eth0 eth2
Configuration explanation: specify the working order of eth0 and eth2 NICs in hot standby mode
6. Restart the server
Different from the real machine environment, the bond0 network card is configured for the linux system under the vmware virtual machine. After doing so, the test found that after the down lost eth0, the bond0 network card ping was disabled, which could not play the backup effect of the network card.
After checking the following information, it is found that a parameter configuration needs to be added to the bond0 configuration file, that is, the modified bond0 Nic configuration file is as follows:
DEVICE=bond0
BOOTPROTO=static
IPADDR=172.16.3.22
NETMASK=255.255.248.0
ONBOOT=yes
BROADCAST=10.1.7.255
BONDING_OPTS= "fail_over_mac=1"
Configuration explanation: default fail_over_mac=0. When an error occurs, only the mac of slave is changed, not bond; when fail_over_mac=1, only bond is changed, not slave.
After the modification, service network restart restarts the configuration of the network card, down eth0, and bond0 can be connected.