Configure bonding on Linux !

Hello All,

This would be my first technical article in da blogging world.

We would talk about configuring bond interfaces on linux hosts (Tested on RedHat Enterprise Linux 3 & 4), these are used in case of configuring network failover interfaces on linux.

Prerequisites:

  • Connect network cables on both eth0 and eth1.
  • Try to work on console for this, as you may need to do a network restart and if anything goes wrong you would not be able to login again on the host.


Its very simple to configure by just following the below steps :

Step 1: Edit the file /etc/modules.conf

Add the below two lines in the end.

alias bond0 bonding
options bonding miimon=100 mode=1

Step 2: Edit the /etc/sysconfig/network-scripts/ifcfg-ethX configuration file for both eth0 and eth1 so that the files show identical contents. For example:

For ifcfg-eth0 :

DEVICE=eth0
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none

For ifcfg-eth1 :

DEVICE=eth1
USERCTL=no
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none


Step 3. Now we will create a network script for the bonding device naming it /etc/sysconfig/network-scripts/ifcfg-bond0 , which would appear like the following example:

DEVICE=bond0
USERCTL=no
ONBOOT=yes
NETWORK=(Network IP)
NETMASK=(Subnet Mask)
GATEWAY=(Gateway IP)
IPADDR=(IP Address)


Step 4. /etc/init.d/network restart


Now you may test by giving a command "ifconfig -a" on terminal, you will say bond0 available alongwith the two slaves eth0 & eth1.

Comments