Friday, March 7, 2014

Creating Bond on CentOS / RHEL

Hi,

Here are some steps to be followed to create bond on RHEL.

Little bit on bonding, It's giving two nic same IP / mac ID. benefit of this is two fold. 1st is failover i.e. for some reason if nic 1 / connection to nic 1 is broken nic 2 is at backup / standby. Another is LB this will not only balance load it will also gives more throughput which is necessary and good for connection having lot of trafic flow.

Process is pretty simple and similar to creation  of bridge, i.e. create another (virtual nic) and make actual nic slave of this virtual nic (Master), so that Apps will using Master nic for communication while OS will do actual work of deciding which nic to use, off-course doing this one way is half battle only to make full use of this feature it's also necessary that traffic will come to both nics and not only one, this could be achieved with managed switch which will do port bonding at switch level so traffic could be sent to both nics depening upon configuration.

1. Create virtual nic file :
           [root@controller1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond1
           DEVICE=bond1
           IPADDR=172.29.25.10
           NETMASK=255.255.252.0
           ONBOOT=yes
           BOOTPROTO=none
           USERCTL=no
           NM_CONTROLLED=no
           BONDING_OPTS="mode=6"
      Point not is Bonding Options depending on OS they might differ but best to use is mode six i.e. balance-alb which will allow lb from both ends.

2. Next step is to remove all ip related data from actual nic and then add info about Bond and put them in slave, Pls note there is no physical nic master in this case master is virtual nic i.e. Bond.
       [root@controller1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
HWADDR=00:1E:67:9A:B8:4F
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
MASTER=bond1
USERCTL=no
SLAVE=yes
USERCTL=no


Now do service network restart.

check with ifconfig only bond should get ip and other nic will be in slave mode





No comments:

Post a Comment