Taking mode=4 as an example
1. Edit the Virtual network interface configuration file and specify the network card IP
Vi/etc/sysconfig/network-scripts/ifcfg-bond0
[Email protected] root]# Cp/etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-bond0
2 Configuring BOND0
#vi ifcfg-bond0
Change the first line to Device=bond0
# Cat Ifcfg-bond0
Device=bond0
Bootproto=static
ipaddr=10.10.200.13
netmask=255.255.255.0
Onboot=yes
Type=ethernet
Here's the idea, don't specify an IP address, subnet mask, or network card ID for a single network card. Specify the above information in the virtual adapter (bonding).
[email protected] network-scripts]# cat Ifcfg-eth0
Device=eth0
Userctl=no
Bootproto=none
Onboot=yes
Master=bond0
Slave=yes
[email protected] network-scripts]# cat Ifcfg-eth1
Device=eth1
Userctl=no
Bootproto=none
Onboot=yes
Master=bond0
Slave=yes
3 # vi/etc/modules.conf
Edit the/etc/modules.conf file, add the following line to enable the system to load the bonding module at startup, the external virtual network interface device is BOND0
Add the following two lines
Alias Bond0 Bonding
bonding_opts= "miimon=100 mode=4 xmit_hash_policy=layer3+4"
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; The value of mode indicates the mode of operation.
The mode=0 indicates that load balancing (round-robin) is balanced, and both NICs work. Load-balanced operation mode that provides twice times the bandwidth. In this case, the failure of a network card will only be the server egress bandwidth drop, will not affect network use.
Mode=1 indicates that fault-tolerance (active-backup) provides redundancy, working in a way that the primary and standby means that only one NIC works by default, and the other is backed up. In the main standby mode, when a network interface fails (such as the main switch power off, etc.), do not return to the network interruption, the system will be in accordance with the/etc/rc.d/rc.local specified network card in the order of operation, the machine can still serve the external services, played a function of failure protection.
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
#service Network Restart
The NIC has been configured to restart.
Check that the configured IP is available after restarting the NIC.
Linux dual NIC Bindings