Advertisment

Linux Server Bonding

author-image
PCQ Bureau
New Update

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.

Advertisment

First we will load Linux bond driver. To do this open /etc/modprobe.conf and

add:

Direct Hit!

Applies To: Network

Managers



USP: Configure multiple network
interfaces



in CentOS for load balancing


PrimaryLink:http://www.sourceforge.net/projects/bonding/
Google Keywords: Server bonding


#alias bond0 bonding

Advertisment

#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:

Advertisment

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

Advertisment

USERCTL=no

ONBOOT=yes

BOOTPROTO=none

Advertisment

IPADDR=192.168.6.8

NETWORK=192.168.6.0

NETMASK=255.255.255.0

Advertisment

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

Advertisment

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.

Advertisment