Configuring NIC Bonding in Linux
Multiple NIC Bonding/Teaming on Linux
I have been a
backup administrator and I know how important it is to have better network speed to have your backup completed in less time. I knew this can be done but had to do some googling before I could successfully implement it practically on RHEL5.
Network
Interface Card (NIC) bonding, also known as NIC teaming or trunking is a concept which would allow us access the machine in the event of a single NIC failure, cable disconnection or other hardware failures.
Creating a single bond
interface with two ethernet interface is easy but if you have 4 NIC cards and you want to create one more bond interface then you might get into trouble configuring the second interface. Here is how you should configure the second bond interface if you want to.
Configuring ifcfg-bond0 and ifcfg-bond1 interface on RHEL5
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.0.1
NETMASK=255.255.255.0
TYPE=Ethernet
BONDING_OPTS="mode=1 miimon=100 downdelay=100 updelay=100 "
/etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=bond1
ONBOOT=yes
IPADDR=192.168.0.2
NETMASK=255.255.255.0
TYPE=Ethernet
BONDING_OPTS="mode=1 miimon=100 downdelay=100 updelay=100 "
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
TYPE=Ethernet
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
MASTER=bond1
SLAVE=yes
TYPE=Ethernet
/etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
MASTER=bond0
SLAVE=yes
TYPE=Ethernet
/etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
MASTER=bond1
SLAVE=yes
TYPE=Ethernet
Add the following lines to /etc/modprobe.conf
alias bond0 bonding
alias bond1 bonding
Then run the following command to activate the bond0 interface.
# modprobe bonding
But while adding a new Bond1 interface after bond0 we need to run the following command.
# echo +bond1 > /sys/class/net/bonding_masters
If we want to remove the bond interface we need to run the following command
# echo -bond1 > /sys/class/net/bonding_masters
Restart the network service and check if everything is operating smoothly.