This simple post will show how to configure Ethernet Bonding on two (or more) network interfaces on RHEL 5 or CentOS 5.
I’ve tested this configuration on a CentOS 5.2 with kernel 2.6.18-92.1.22.el5 as you could see below :

uname -a

Linux serverlab.riccardoriva.local 2.6.18-92.1.22.el5 #1 SMP Tue Dec 16 11:57:43 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

cat /etc/redhat-release
CentOS release 5.2 (Final)

If you want to create a bonding on two interface (i.e. eth0 and eth1) you should do the following :

Edit /etc/sysconfig/network-scripts/ifcfg-eth0

# Bonding eth0 to bond0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=NO

Edit /etc/sysconfig/network-scripts/ifcfg-eth1

# Bonding eth1 to bond0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=NO

Copy /etc/sysconfig/network-scripts/ifcfg-eth1 to /etc/sysconfig/network-scripts/ifcfg-bond0 to keep the same file permission by executing the following commands :

cd /etc/sysconfig/network-scripts
copy ifcfg-eth1 ifcfg-bond0

Edit /etc/sysconfig/network-scripts/ifcfg-bond0

ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
NETWORK=10.100.100.0
NETMASK=255.255.255.0
IPADDR=10.100.100.1
USERCTL=NO

Edit /etc/modprobe.conf adding the following line :

alias bond0 bonding

Reboot your system to let modules be loaded or load it manually with the following command :

insmod bond0 bonding

If you haven’t rebooted your system, restart your network with the following command :

/etc/init.d/network restart

You should check if bonding is working you should look at /proc/net/bonding/bond0 with the following command :

cat /proc/net/bonding/bond0

and you should see something similar to the following :

Ethernet Channel Bonding Driver: v3.2.4 (January 28, 2008)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:15:17:88:5a:3c

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:15:17:88:5a:3d

You’ve done

Hope this help

Bye
Riccardo

Print This Post Print This Post

3 Responses to “How-To configure Ethernet Bonding on RHEL or CentOS”

  • tameika says:

    Hi I have gotten bond0 to work but I am doing LACP on cisco switch and its set at gig speed but the bond0 is running at 100mb.
    I have checked each card and they are both running at gig speed.
    Do have any idea ?

  • Riccardo says:

    You should use something similar :

    #!/bin/bash

    modprobe bonding mode=4 miimon=100 # load bonding module

    ifconfig eth0 down # putting down the eth0 interface
    ifconfig eth1 down # putting down the eth1 interface

    ifconfig bond0 hw ether 00:11:22:33:44:55 # changing the MAC address of the bond0 interface
    ifconfig bond0 10.100.100.0 up # to set ethX interfaces as slave the bond0 must have an ip.

    ifenslave bond0 eth0 # putting the eth0 interface in the slave mod for bond0
    ifenslave bond0 eth1 # putting the eth1 interface in the slave mod for bond0

    You must define a “mode” for the bonding interface, because LACP use the 802.3ad Link aggregation protocol, so you must define it when loading module.

    You should check this post to the different bonding modes :

    http://www.riccardoriva.com/archives/353

    Bye
    Riccardo

Leave a Reply

Spam Protection by WP-SpamFree

Contacts
Look at me at Linkedin Follow me on Twitter
My Flickr Albums My Facebook profile My YouTube Videos
SkypeMe My Linux Counter GMail me
Search
Google Search
Categories
Tag Cloud 3D
FeedBurner RSS

Visitors
Locations of visitors to this page
VMware related Blogs
The following are Blog sites with feeds I personally follow. When I'll have some spare time I will complete all Feed and Twitter links.