Step 1 :
Create the file /etc/sysconfig/network-scripts/ifcfg-bond0 and specify the ip address,netmask & gateway
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.100.10
NETMASK=255.255.255.0
GATEWAY=192.168.100.1
TYPE=Bond
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
Step:2
Edit the files of eth0 & eth1 and make sure you enter the master and slave entry, as shown below
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=90:2b:34:7b:df:a4
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
HWADDR=e2:5b:f0:60:ba:d8
ONBOOT=yes
NM_CONTROLLED=no
MASTER=bond0
SLAVE=yes
Step:3
Create the Bond file(bonding.conf)
# vi /etc/modprobe.d/bonding.conf ( for old versions use modprobe.conf )
alias bond0 bonding
options bond0 mode=1 miimon=100 <--- This can be defined in ifcfg-bond0 the line will be BONDING_OPTS="mode=1 miimon=100"
change above line to
options bond0 mode=1 miimon=100 fail_over_mac=1 if you are configuring bonding under vmware workstation.
Step:4
service network restart
Important Things to know
A ) Different Modes used in bonding
balance-rr or 0 -- round-robin mode for fault tolerance and load balancing.
active-backup or 1 -- Sets active-backup mode for fault tolerance.
balance-xor or 2 -- Sets an XOR (exclusive-or) mode for fault tolerance and load balancing.
broadcast or 3 -- Sets a broadcast mode for fault tolerance. All transmissions are sent on all slave interfaces.
802.3ad or 4 -- Sets an IEEE 802.3ad dynamic link aggregation mode. Creates aggregation groups that share the same speed & duplex settings.
balance-tlb or 5 -- Sets a Transmit Load Balancing (TLB) mode for fault tolerance & load balancing.
balance-alb or 6 -- Sets an Active Load Balancing (ALB) mode for fault tolerance & load balancing.
B ) Commands
To check the bonding status
watch -n .1 cat /proc/net/bonding/bond0
or
cat /proc/net/bonding/bond0
To Change active interface in bondig
1 ) remove active interface from bonding by command echo -eth0 > /sys/class/net/bond0/bonding/slaves
this will make the other slave active then add it again into the bonding. by running command echo +eth0 > /sys/class/net/bond0/bonding/slaves
or use inenslave to change the active slave in bond To make eth0 active use below command ifenslave -c bond0 eth0 eth1