Linux Tricks and Techniques

For Linux Experts

Use the website for easy leaning of Linux

Wednesday, 29 June 2016

Bonding in Linux

Linux allows binding of multiple network interfaces into a single channel/NIC using special kernel module called bonding. According to official bonding documentation: The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical “bonded” interface.After upgrading the RHEL OS the major task to do is bonding so that the application team could access the server using putty or by other means. To make  bond in two network interface  eth0 and eth1 we need to edit the ifcfg-eth files. one more thing required to do for the bonding is to edit the modprobe.conf  file and add a line in that file.




#vi /etc/modprobe.conf

alias bond0 bonding

then follow the below procedure: 

#cd /etc/sysconfig/network-scripts
#ls
#cat ifcfg-bond0
DEVICE=bond0
IPADDR=10.196.202.56
NETWORK=10.196.202.0
NETMASK=255.255.255.0
GATEWAY=10.196.202.1
USERCTL=no
BOOTPROTO=static
ONBOOT=yes
TYPE=bond
NM_CONTROLLED=no


#cat ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:17:A4:77:9C:3E
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
TYPE=Ethernet
NM_CONTROLLED=no


#cat ifcfg-eht1
DEVICE=eth1
HWADDR=00:17:A4:77:9C:40
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
TYPE=Ethernet
NM_CONTROLLED=no



Once the bond is configured it acts like any other Ethernet device. For example, you can configure alias interfaces to handle multiple IP addresses, as shown below.

Create the "ifcfg-bond0:1" and "ifcfg-bond0:2" files in the "/etc/sysconfig/network-scripts" directory with the following contents.

# ifcfg-bond0:1 file contents 
DEVICE=bond0:1 

BOOTPROTO=none 
ONBOOT=yes 
NETWORK=192.168.0.0 
NETMASK=255.255.255.0 
IPADDR=192.168.0.172 
USERCTL=no 
BONDING_OPTS="mode=1 miimon=100" 

 # ifcfg-bond0:2 file contents 
DEVICE=bond0:2 
BOOTPROTO=none ONBOOT=yes 
NETWORK=192.168.0.0 
NETMASK=255.255.255.0 
IPADDR=192.168.0.173 
USERCTL=no 
BONDING_OPTS="mode=1 miimon=100"


Notice, the device names and IP addresses differ from the original "ifcfg-bond0" file.

Restart the network service for the changes to take effect.

#service network restart

#ifconfig- will show the bonding of etho and eth1

Thnaks

No comments:
Write comments