Linux network bonding : howto Print E-mail
(2 votes, average: 5.00 out of 5)
Written by geekyB   
Wednesday, 17 December 2008 05:14

What is bonding?

 

Linux networking allows you to combine together or bind together multiple network interfaces into a single interface. This bond interface can be used for interface failover purposes or link aggregation. This GeekyFacts document shows you how to create network bonding in Linux.  We have tested this on Redhat Enterprise Linux & CentOS.

 

The bonding module:

 

Most of the Linux variants now already has the bonding module available with it. If not you can download it.  Redhat & CentOS bonding supports 7 possible "modes" for bonded interfaces. These modes determine the way in which traffic sent out of the bonded interface is actually dispersed over the real interfaces. Modes 0, 1, and 2 are by far the most commonly used among them. We have used mode “1” – that is “active-backup” failover configuration.

 

To activate bonding module, you have to set the parameters for bond0 bonding kernel module. Add the following lines to /etc/modprobe.conf

# cat /etc/modprobe.conf

alias bond0 bonding

options bond0 mode=1 miimon=100

 

Load the bond driver module from the command prompt.

# modprobe bonding

 

bond0 configuration:

 

For bonding to work, you have to create bond0 interface, which is combined together by the slave interfaces. Here are the steps to create bond0 interface and the changes that has to be done for the slave interfaces (eth0 & eth1)

 

The bond0 interface :

# cd /etc/sysconfig/network-scripts ; cat ifcfg-bond0

DEVICE=bond0

IPADDR=192.170.1.10

NETMASK=255.255.255.0

GATEWAY=192.170.1.1

USERCTL=no

BOOTPROTO=none

ONBOOT=yes

Slave interface eth0:

#cat ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

# bond0 settings

MASTER=bond0

SLAVE=yes

 

Slave interface eth1:

#cat ifcfg-eth1

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

USERCTL=no

# bond0 settings

MASTER=bond0

SLAVE=yes

 

Activating the bond:

 

Restart the network, or restart the computer to make the bonding work. Once done , you should be able to see the configuration on /proc/net/bonding/bond0 .  “ifconfig –a” will also show the bond0 details.

# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver

Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: eth0

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Slave Interface: eth0

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:AB:72:DC:57:ED

Slave Interface: eth1

MII Status: up

Link Failure Count: 0

Permanent HW addr: 00:BA:72:DC:57:EF

 

Done.

Last Updated on Monday, 22 December 2008 08:37