High Availability with NIC Bonding

High Available NICs. Also known as Link Aggregation, channel bonding, or trunking. This configuration will allow for the failure of one interface or connection and continue with overall functionality. By changing the bonding options, you can change the bonding type to round robin, aggregation or various other types. For this guide, I am doing active-backup.

This reference is for Centos5/Redhat5/Fedora or greater. Recent releases have changed link bonding and modprobe so this exact configuration will not work on older distros or releases.

Create a new file /etc/modprobe.d/bonding.conf and only include the following.

alias bond0 bonding



Configure your two interfaces as slaves to the master we will create.

For your first interface /etc/sysconfig/network-scripts/ifcfg-eth0:

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

For your second interface /etc/sysconfig/network-scripts/ifcfg-eth1:

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



And now, create the master bond0. Create the file /etc/sysconfig/network-scripts/ifcfg-bond0. You will notice now that the BONDING_OPTS are located in the config file and no longer in the /etc/modprobe.conf.

DEVICE="bond0"
NM_CONTROLLED="no"
ONBOOT="yes"
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="miimon=1000 mode=active-backup"
IPADDR=1.2.3.4
SUBNET=255.255.255.0
GATEWAY=1.2.3.254



Now, restart the network configuration.

service network restart



You can check the configuration now with:

cat /proc/net/bonding/bond0



You should see something like

Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009)
 
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0
 
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:64:a4:77
Slave queue ID: 0
 
Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:25:90:66:89:9c
Slave queue ID: 0

Leave a Reply

Your email address will not be published. Required fields are marked *