1. Environment description
The virtual machine created in esxi5.5, the system is CentOS 6.4, there is only one network card, the name is ifcfg-eth0. To achieve network redundancy, after logging in to the VMware vSphere Client, a network card is added to the virtual machine. The network card is named ifcfg-eth1.
2. Dual network card binding steps:
2.1 Modify the /etc/sysconfig/network-scripts/ifcfg-eth0 configuration document, the modified content is as follows:
DEVICE=eth0
HWADDR=78:2B:CB:30:66:29 #Network card MAC address, can be removed
TYPE=Ethernet #Can be removed
ONBOOT=yes #Automatically enable the device when the system starts
SLAVE=yes
MASTER=bond0
BOOTPROTO=none #Do not use any protocol at startup
2.2 Modify the /etc/sysconfig/network-scripts/ifcfg-eth1 configuration document, the modified content is as follows:
DEVICE=eth2
HWADDR=78:2B:CB:30:66:2B #Network card MAC address, can be removed
TYPE=Ethernet #Type, can be removed
ONBOOT=yes #Automatically enable the device when the system starts
SLAVE=yes
MASTER=bond0
BOOTPROTO=none #Do not use any protocol at startup
2.3 Create a configuration document /etc/sysconfig/network-scripts/ifcfg-bond0 to bind the network card, the content is as follows:
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BONDING_OPTS="miimon=100 mode=0"
# mode=0 means "round-robin" strategy, means load balancing mode, both network cards work
#mode=1 means "active-backup" strategy, means redundant mode, only one network card is working, if there is a problem, the other one is enabled
#You can also add the following two lines at the end of the /etc/modprobe.d/dist.conf file
#alias bond0 bonding
#options bond0 miimon=100 mode=1
BOOTPROTO=static
IPADDR=10.240.210.233
NETMASK=255.255.255.0
DNS1=8.8.8.8
2.4 The modification is /etc/rc.local, which is responsible for binding the virtual network card to the two physical network cards when the system starts
ifenslave bond0 eth2 eth3
3. Restart the network card to make the operation take effect
service network restart
4. Test Results
After any network card is turned off, it will not affect the normal communication of the server.