In my previous article I wrote about configuring configuring network interface bonding under Debian Wheezy. Here, I’ll briefly outline the steps required to get the same configuration running under recent RHEL-flavoured distributions – namely CentOS 6.4 in my case.
I will be bonding eth0
and eth1
into a bond named bond0
. Ensure that you’re connected to your host via a console. I’ll be using active-backup (i.e. failover) bonding, but there are other options available – see the Debian article for links to reference material for those.
First, create the ifcfg-bond0
configuration file:
# cd /etc/sysconfig/network-scripts # vi ifcfg-bond0 DEVICE=bond0 IPADDR=192.168.122.12 NETMASK=255.255.255.0 GATEWAY=192.168.122.1 NM_CONTROLLED=no BOOTPROTO=none ONBOOT=yes USERCTL=no
Substitute relevant values as appropriate for your setup. Next, edit/create the ifcfg-eth{0,1}
files. Note that these are created as slave interfaces (SLAVE=yes
) with bond0
as the master interface (MASTER=bond0
):
# vi ifcfg-eth0 DEVICE=eth0 USERCTL=no ONBOOT=yes NM_CONTROLLED=no MASTER=bond0 SLAVE=yes BOOTPROTO=none # sed 's/eth0/eth1/' ifcfg-eth0 > ifcfg-eth1
Note – that if NM_CONTROLLED
is set, you should strictly define your HWADDR
entries too at this step, for each interface. Configure the bonding
module. miimon
is the MII link monitoring frequency in milliseconds, {down,up}delay
are the times, in milliseconds, to wait before disabling or enabling an interface in the bond (to safeguard against flapping), and should be a multiple of the miimon value. Note that
/etc/modprobe.conf
is deprecated in CentOS 6.x so an appropriate file should be created under /etc/modprobe.d
– in our case, bonding.conf
:
# vi /etc/modprobe.d/bonding.conf alias bond0 bonding options bond0 mode=active-backup miimon=100 downdelay=200 updelay=200
To test, manually load the module (and appropriate options – I see many tutorials with a simple modprobe bonding
here – you’ll end up with the default bonding mode which is round-robin – not what we want):
# modprobe bonding mode=active-backup miimon=100 downdelay=200 updelay=200
And restart networking:
# service network restart
Verify that all is well with ifconfig -a
, or more suitably a cat
on /proc/net/bonding/bond0
:
# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009) Bonding Mode: fault-tolerance (active-backup) Primary Slave: None Currently Active Slave: eth0 MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 200 Down Delay (ms): 200 Slave Interface: eth0 MII Status: up Speed: Unknown Duplex: Unknown Link Failure Count: 0 Permanent HW addr: 52:54:00:c1:77:fc Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 100 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 52:54:00:f3:11:1e Slave queue ID: 0
Reboot the host at the earliest opportunity to verify that all is well after a reboot.