1. Check to see if your system supports bonding
First, execute the command:
$rpm-qf/sbin/ifup
It returns a line of text, beginning with "initscripts" or "Sysconfig", which is the package that provides the network initialization script.
Next, to determine if your installation supports bonding, execute the command:
$grep Ifenslave/sbin/ifup
If any matching records are returned, your initscripts or sysconfig support bonding
2. Modify the configuration of the network adapter
To modify the current network adapter profile, the configuration files are placed in the/etc/sysconfig/network-scripts directory, as follows:
First network adapter:
Vim/etc/sysconfig/network-scripts/eth0
Device=eth0
Onboot=yes
Bootproto=none
Master=bond0
Slave=yes
Second network adapter:
Vim/etc/sysconfig/network-scripts/eth1
Device=eth1
Userctl=no
Onboot=yes
Master=bond0
Slave=yes
Bootproto=none
3. Create a bonding network script
Vim/etc/sysconfig/network-scripts/bond0
Device=bond0
ipaddr=192.168.1.66
netmask=255.255.255.0
network=192.168.1.0
broadcast=192.168.1.255
Onboot=yes
Bootproto=none
Userctl=no
4.bond-driven options
The bonding-driven option is set by setting parameters at load time, usually specified in the following two files.
Edit/etc/modprobe.conf and add the following two lines:
Alias Bond0 Bonding
Options Bond0 mode=1 million=100
Description
mode specifies the working mode of the bond0, which is commonly used in 0 and 1,0 for load balancing, and 1 for master-slave mode, which can be configured on demand. Commonly used for 0, 12 species. Mode=0 indicates that the load balancing (round-robin) is loaded in a balanced way and both cards work. Mode=1 means that fault-tolerance (active-backup) provides redundancy, working in a way that is normally done, which means that by default only one network card works and the other is backed up. Bonding can only provide link monitoring, that is, whether the link from the host to the switch is connected. If only the switch is down on the external link, and the switch itself is not faulty, then bonding will assume that the link is not problematic and continue to use it. Miimon is used for link monitoring. For example: miimon=100, then the system every 100MS monitoring link connection status, if one line does not pass to the other route.
5. Enable bonding
#service Network Restart
6. Test
Cat/proc/net/bonding/bond0
Ethernet Channel Bonding Driver:v2.6.3-rh (June 8, 2005)
Bonding Mode:fault-tolerance (active-backup)
Primary Slave:none
Currently Active Slave:eth0 MII status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface:eth0
MII status:up Link Failure count:0
Permanent HW addr:00:0c:29:6e:40:9d
Slave interface:eth1
MII Status:up
Link Failure count:0
Permanent HW Addr:00:0c:29:6e:40:a7
If you unplug the eth0 cable, ETH1 will replace it with active
Currently Active Slave:eth0
Slave Interface:eth0
MII Status:down
Slave interface:eth1
MII Status:up
It shows that the mode 1 of bonding is a primary standby ha mode.
Ethernet Channel Bonding Driver:v2.6.3-rh (June 8, 2005)
Bonding Mode:fault-tolerance (active-backup)
Primary Slave:none
Currently Active Slave:eth0
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface:eth0
MII Status:up
Link Failure count:0
Permanent HW addr:00:0c:29:6e:40:9d
Slave interface:eth1
MII Status:up
Link Failure count:0
Permanent HW Addr:00:0c:29:6e:40:a7
If this is the
Eth0
The Connected network cable is unplugged,
Eth1
will be replaced by becoming
Active
Currently Active Slave:eth0
Slave Interface:eth0
MII Status:down
Slave interface:eth1
MII Status:up
Show
Bonding
The mode
1
, is a kind of main standby
HA
of the model.
Ethernet Channel Bonding Driver:v2.6.3-rh (June 8, 2005)
Bonding Mode:fault-tolerance (active-backup)
Primary Slave:none
Currently Active Slave:eth0
MII Status:up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface:eth0
MII Status:up
Link Failure count:0
Permanent HW addr:00:0c:29:6e:40:9d
Slave interface:eth1
MII Status:up
Link Failure count:0
Permanent HW Addr:00:0c:29:6e:40:a7
If this is the
Eth0
The Connected network cable is unplugged,
Eth1
will be replaced by becoming
Active
Currently Active Slave:eth0
Slave Interface:eth0
MII Status:down
Slave interface:eth1
MII Status:up
Show
Bonding
The mode
1
, is a kind of main standby
HA
of the model.