In order to provide high availability of the network we need to set up multiple NIC bindings into a virtual network card to provide services, so as to prevent a piece of network card damage or prevent network cable connection failure caused by the connection interruption.
Here we use eth0 and eth1 to virtual become bond0, for example:------Binding Prerequisites: The chipset model is the same, and the NIC should have its own independent BIOS chip.
Operating platform: OLE Linux 6.6
1. Create the virtual network interface profile ifcfg-bond0and specify the NIC ip:vi/etc/sysconfig/network-scripts/ifcfg-bond0
Cat/etc/sysconfig/network-scripts/ifcfg-bond0
Device=bond0
Bootproto=static
ipaddr=10.0.11.10
netmask=255.255.252.0
gatway=10.0.11.1
Onboot=yes
Userctl=no
Type=ethernet
2, respectively modify Ifcfg-eth0 and ifcfg-eth1----- can not set the IP, gateway, subnet mask and other information .
Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
Bootproto=dhcp
Onboot=yes
Userctl=no
Master=bond0
Slave=yes
Type=ethernet
Cat/etc/sysconfig/network-scripts/ifcfg-eth1
Device=eth1
Bootproto=dhcp
Onboot=yes
Userctl=no
Master=bond0
Slave=yes
Type=ethernet
3, because the virtual network card is actually implemented in the kernel module, it is necessary to install a module, in/etc/modules.confAdd the following to enable the system to load the bonding module at startup, and the external virtual network interface device is bond0.
Add the following two lines
Alias Bond0 Bonding
Options bond0 miimon=100 mode=0 --- 0 means that two physical network cards run in a load-balanced manner .
Note: The Miimon is used for link monitoring. For example: miimon=100, then the system every 100MS monitoring link connection status, if one line is not connected to another line; Mode value indicates the mode of operation, he has 0,1,2,3 four modes, commonly used for 0, 12 kinds.
The mode=0 indicates that load balancing (round-robin) is balanced and that both NICs are in the active state.
Mode=1 indicates that fault-tolerance (active-backup) provides redundancy, which means that only one NIC is active and the other is backed up by default.
If this mode is used:options bond0 miimon=100 mode=1 primary=eth0---represents eth0 as active state and eth1 as standby state.
Bonding can only provide link monitoring, i.e. whether the link from the host to the switch is connected. If the switch external link is down, and the switch itself is not faulted, then bonding will assume that the link is not a problem and continue to use
4. Add the following command to the/etc/rc.local.
Cat/etc/rc.local
Modprobe bonding miimon=100 mode=0
The configuration is complete to restart the host.
Bringing Up interface Bond0 OK
Bringing Up interface eth0 OK
Bringing Up interface eth1 OK
Linux Dual physical network card set to virtual network card