Bonding is a feature to combine two or more network interface
to form a single, logical “bonded” interface, for redundancy or increased
throughput purpose.
We can configure Linux bonding in 7 different
modes. The behavior of the bonded interfaces depends upon the mode.
1. Balance-rr (mode 0)
2. Active-backup (mode 1)
3. Balance-xor (mode 2)
4. Broadcast (mode 3)
5. 802.3ad (mode 4)
6. Balance-tlb (mode 5)
7. Balance-alb (mode 6)
Balance-rr (mode 0): Configuring a bonding
Channel between eth0 and eth1 using the default mode.
1)#
service NetworkManager stop
#chkconfig NetworkManager off
2)Bonding module should be configured and
loaded. To enable bonding module, create a bonding.conf file as below.
Note : you can add multiple entries to create multiple
bonding channels like bond0, bond1, bond2…etc
# cat > /etc/modprobe.d/bonding.conf
alia bond0
bonding
options
bond0 mode=1 miimon=100
3. Create a
configuration file for the bonding channel i.e. bond0, as below
# cat
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.50.111
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
BONDING_OPTS=”mode=0 miimon=100″
IPADDR=192.168.50.111
NETMASK=255.255.255.0
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
BONDING_OPTS=”mode=0 miimon=100″
4.) Create configuration files for all the interfaces
i.e. eth0 and eth1, which are participating in the bonding channel.
# cat > /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=aa:bb:cc:dd:ee:ff
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
BOOTPROTO=none
HWADDR=aa:bb:cc:dd:ee:ff
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
# cat >
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth0
BOOTPROTO=none
HWADDR=yy:xx:zz:aa:bb:cc
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
BOOTPROTO=none
HWADDR=yy:xx:zz:aa:bb:cc
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
5. Activating Bonding Channel
a. With out rebooting
# modprobe bonding
# service network restart
b. with reboot
# reboot
6. Verify that Bonding channel is active, by using the
commands
# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.0.2 (Nov 25, 2012)
Ethernet Channel Bonding Driver: v3.0.2 (Nov 25, 2012)
Bonding
Mode: adaptive load balancing
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Down Delay (ms): 0
Slave
Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: aa:bb:cc:dd:ee:ff
MII Status: up
Link Failure Count: 0
Permanent HW addr: aa:bb:cc:dd:ee:ff
Configurable Bonding Parameters:-
max_bonds : specifies the number of bonding devices that can
be configured on single bonding driver.
xmit_hash_policy : Slecect
the transmit has policy to use for slave selection in balance-xor and 802.3d
modevice. Possible values , layer2 (default) , larer2+3 or layer3+4
arp_interval : Specifies the
ARP link monitoring frequency in milli seconds
arp_ip_target : Specifies the
IP addresses to use as ARP monitoring peers when arp_interval is > 0.
Multiple IP addresses must be seperated by comma. At least one IP addres must
be given for ARP monitoring to work. Max. no. of target IPs are 16.
arp_validate : Specifies
Whether or not ARP probes and replies should be validated in the active-backup
mode. This causes the ARP monitor to examine the incoming ARP requests and
replies, and only consider a slave to be up if it is receiving the appropriate
ARP traffic. Possible values
none(0) – default value
active(1) – validate only the
active slave
backup(2) – validate only the
backup slave
all(3) – validate all slaves
miimon : Specifies the MII
link monitoring frequency in milliseconds. A value of 0 disables the MII link
monitroing. A value of 100 is recommended.
updelay : specifies the time,
in milliseconds, to wait before disabling a slave after a link recovery has been
detected.
downdelay : specifies the
time, in milliseconds, to wait before disabling a slava after a link failure
has been detected.
use_carrier : specifies
whether or not miimon shoudl use MII/ETHTOO “ioctls for value of 0 ” or ”
netif_carrier_ok() for value 1 ( default value)” functions to determine the
link status.