How To Enable Ethernet Bonding In Linux
What is meant by Ethernet bonding ?
From the word itself it mean bonding , yes its bonding multiple interface to achieve higher throughput and also helps as backup, if one NIC fails (failover will happen). The feature is enabled on Linux so we can created new virtual interface called as “bond”. I have tested bonding feature on rhel 4, 5, 6 and it works fine.
As first step you need to created virtual bond virtual interface. For that you need to edit the below file.
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
Once edited it should look as below
# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
NETMASK=255.255.255.0
ONBOOT=yes
USERCTL=no
IPADDR=192.168.1.1
Next step is to edit physicall interfaces that are intended for bonding.After editing the concerned file it should look as below.All the interface (in the bonding) should be point to virtual bonding interface(bond0).
# cat /etc/sysconfig/network-scripts/ifcfg-eth7
DEVICE=eth7
USERCTL=no
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
ONBOOT=yes
# cat /etc/sysconfig/network-scripts/ifcfg-eth8
DEVICE=eth8
USERCTL=no
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
ONBOOT=yes
Next important steps is to configure the bond module. Bonding module name is “bonding”.Bonding module driver have different parameters to set. These parameter can be enabled in modules.conf file. I will explain the three main parameters required.
1) mode
Mode value shows the bonding policy. It can be mentioned either in alphabetical keywords or numerical numbers. Default policy is round robin (balance-rr or 0 ). Give below are the 7 bonding policies available.
balance-rr or 0
active-backup or 1
balance-xor or 2
broadcast or 3
802.3ad or 4
balance-tlb or 5
balance-alb or 6
2) miimon
This value shows(in millinseconds) how often link status is checked for link failure. Usaully it is 100.Default is 0.
3) max_bonds
It shows the number of bonding virtual interface created.For example if you have bond0,bond1 and bond3 then max_bonds value should be 3.
# cat /etc/modules.conf
alias eth0 e1000
alias eth1 e1000
alias eth2 e1000
alias scsi_hostadapter qla2300
alias scsi_hostadapter1 cciss
alias usb-controller usb-uhci
alias usb-controller1 ehci-hcd
options scsi_mod max_scsi_luns=128
alias char-major-10-224 off
alias bond0 bonding
options bond0 mode=4 miimon=100 max_bonds=1
#
You can test the configuration by load the bonding module
# modprobe bondingRestart network service to bring up bond0 interface up
# service network restartYou can see the current status of Linux kernel bonding driver
# cat /proc/net/bonding/bond0It should look display something similar as below
Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
Bonding Mode: load balancing (round-robin)
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0Slave Interface: eth7
MII Status: up
Link Failure Count: 1Slave Interface: eth8
MII Status: up
Link Failure Count: 1
Ifconfig output should look much similar as below
# ifconfig bond0
bond0 Link encap:Ethernet HWaddr
inet addr:192.168.1.1 Bcast:165.89.185.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:550726053 errors:0 dropped:0 overruns:0 frame:0
TX packets:25820094 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:43505604261 (40.5 GiB) TX bytes:6291843519 (5.8 GiB)# ifconfig eth7
eth7 Link encap:Ethernet HWaddr
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:280105545 errors:0 dropped:0 overruns:0 frame:0
TX packets:25820120 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23803380261 (22.1 GiB) TX bytes:6291848058 (5.8 GiB)# ifconfig eth8
eth8 Link encap:Ethernet HWaddr
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:270620821 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19702247198 (18.3 GiB) TX bytes:0 (0.0 b)
Interrupt:169 Memory:f8000000-f8012100
Ethernet Bonding Reference Page
Category: Linux Administration

