Saturday, 27 July 2013

Centos 6/RHEL bond 2 Ethernet devices for increased bandwidth

To increase bandwidth and performance on your Centos 6/RHEL box you can bond 2 Ethernet devices together making a larger input/output possible.

Channel bonding (also known as Ethernet bonding) is
a networking arrangement in which two or more network interfaces on a host computer are combined in order to achieve the above.
This assumes that you already have a Static IP address set up and that you have other available addresses from you router.

First, log in as root and get dependencies

$ sudo yum –y install bind-utils ethtool

Create a new file called bond0 that will become the bonding master. To do this, in the console type

$sudo vi /etc/sysconfig/network-scripts/ifcfg-bond0


Add the following lines by substituting the relevant values marked as
XXX.XXX.XXX.XXX with something more appropriate.

DEVICE="bond0"
NAME="System bond0"
NM_CONTROLLED="no"
USERCTL=no
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
PEERDNS=no
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPADDR=XXX.XXX.XXX.XXX
NETMASK=XXX.XXX.XXX.XXX
BROADCAST=XXX.XXX.XXX.XXX

When ready, save and close the file before proceeding to modify your existing
Ethernet configuration files

$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

Make the relevant changes but as a reference, below is an example 

DEVICE="eth0"
NM_CONTROLLED="no"
ONBOOT=yes
HWADDR=XX:XX:XX:XX:XX:XX
UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
TYPE=Ethernet
BOOTPROTO=none
NAME="System eth0"
USERCTL=no
MASTER=bond0
SLAVE=yes

Now repeat this step for each Ethernet device by substituting the appropriate values before continuing

When the process of Ethernet device configuration is complete, the next step is to create the bonding module configuration file by typing the following

$ sudo vi /etc/modprobe.d/bonding.conf

Now add the following lines

alias bond0 bonding
options bond0 mode=5 miimon=100

Save and close the file before proceeding to register the bonding module with CentOS as a device. To do this, type:

modprobe bonding

Finally, to complete our configuration you should reboot or type
service network restart

The process of channel bonding is now complete and you can test your new network settings by running the following

$ ifconfig