Nowadays all servers come with multiple network ports that can be used for
varied purposes. You can use one port for networking, another for heartbeat
monitoring and a few others for server fail overs. In Linux you can use the
bonding kernel module for load balancing or Hot standby. The module combines
multiple NICs into a single virtual interface. Most Linux distros ship with a
Linux bonding driver. In our tests we used CentOS as it is a standard Server
Distro based on Red Hat. Let's see how to configure bonding in it.
First we will load Linux bond driver. To do this open /etc/modprobe.conf and
add:
Direct Hit! |
Applies To: Network |
#alias bond0 bonding
#options bond0 mode=balance-alb miimon=100
This will create a bond0 device which will use the bonding kernel module.
To create a bond0 configuration file run the following command from the
shell:
vi /etc/sysconfig/network-scripts/ifcfg-bond0
Add following lines to the file and in IPADDR replace the IP Address with
your server's IP Address:
DEVICE=bond0
USERCTL=no
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.6.8
NETWORK=192.168.6.0
NETMASK=255.255.255.0
Next alter eth1 and eth0 configuration files. To do this first open
'ifcfg-eth0' in 'vi' or any other text editor and add following lines to it:
![]() |
Using 'Less' command you can check the mode in which you have configured bonding along with bonding detail |
DEVICE=eth0
USERCTL=no
OOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
\Similarly open 'ifcfg-eth1' file and add:
\DEVICE=eth1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
To start the bonding module run:
# modprobe bonding
And now restart the network
service. To confirm that bonding is working run:
# less /proc/net/bonding/bond0
Now you should see confirmation of bonding as shown in the visual.