Interface Bonding / Teaming on Red Hat Enterprise Linux


Interface or NIC bonding or also called teaming, is to use two or more NIC in conjunction using round robin scheduler. The machine will only recognize one interface, while packet are sent from two slave interface.

To do this, make sure you have all the appropriate modules installed. On terminal, type:

#modprobe –list | grep mii

make sure the output is similar to this:

/lib/modules/2.6.9-67.0.1.ELsmp/kernel/drivers/net/mii.ko

and

#modprobe –list | grep bonding

make sure the output is similar to this:

/lib/modules/2.6.9-67.0.1.ELsmp/kernel/drivers/net/bonding/bonding.ko

If all is well, the next step is to create the interface configuration files. Let’s assume that we’ll be bonding eth0 and eth1 together.

First create the bonding interface, open a terminal and type:

#cd /etc/sysconfig/network-script/
#vi ifcfg-bond0

This is how my ifcfg-bond0 looks

DEVICE=bond0
IPADDR=192.168.1.211
NETWORK=192.168.1.0
NETMASK=255.255.255.0
BROADCAST=192.168.1.255
GATEWAY=192.168.1.1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=no
BONDING_MODULE_OPTS=”miimon=100″

After that, proceed to edit both ifcfg-eth0 and ifcfg-eth1

#cd /etc/sysconfig/network-script/
#vi ifcfg-eth0

this is how my eth0 config looks:

DEVICE=eth0

ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
TYPE=ethernet
SLAVE=yes
IPV6INIT=no
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”

and the eth1..

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
TYPE=ethernet
SLAVE=yes
IPV6INIT=no
ETHTOOL_OPTS=”speed 100 duplex full autoneg off”

The next step is to add some line to /etc/modprobe file. On terminal type:

#vi /etc/modprobe

make sure this line exist on the modprobe file:

alias bond0 bonding
options bond0 miimon=100
options speed=100,100 duplex=2,2

Next, load all the necessary modules

#modprobe bonding
#modprobe mii

Then, restart the network service

#service network restart

Make sure the bond0 interface is up and has an IP, by typing:

#ifconfig

The output should be similar to this:

bond0 Link encap:Ethernet HWaddr 00:1E:0B:60:45:02
inet addr:172.16.2.31 Bcast:172.16.2.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2257630 errors:0 dropped:0 overruns:0 frame:0
TX packets:2096727 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:514557469 (490.7 MiB) TX bytes:1021886305 (974.5 MiB)

eth0 Link encap:Ethernet HWaddr 00:1E:0B:60:45:02
inet6 addr: fe80::21e:bff:fe60:4502/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1175451 errors:0 dropped:0 overruns:0 frame:0
TX packets:1048363 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:268999481 (256.5 MiB) TX bytes:510954410 (487.2 MiB)
Interrupt:169 Memory:f6000000-f6012100

eth1 Link encap:Ethernet HWaddr 00:1E:0B:60:45:02
inet6 addr: fe80::21e:bff:fe60:4502/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1082179 errors:0 dropped:0 overruns:0 frame:0
TX packets:1048364 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:245557988 (234.1 MiB) TX bytes:510931895 (487.2 MiB)
Interrupt:169 Memory:fa000000-fa012100

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:11111287 errors:0 dropped:0 overruns:0 frame:0
TX packets:11111287 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4187765593 (3.9 GiB) TX bytes:4187765593 (3.9 GiB)

Test the fail over function unplugging one of the interface while pinging other host on the network. The ping shouldn’t be interrupted.

So that’s it. Thanks to the nice Mr. Aria for all the pointers 😀

Advertisements

5 Comments Add yours

  1. bouktin says:

    Hi,
    to create multiple bonding interface on old redhat (my problem was on a RHEL4 u4) just add to the file /etc/modprobe.conf for each bonding options line

    max_bonds=
    where is the number of bonding interfaces
    because until update 4 or 5 default max bonding interface is 1

    bouktin

  2. bouktin says:

    edit :
    […]
    max_bonds=N
    where N is the …

  3. crazed says:

    BONDING_MODULE_OPTS=”miimon=100″ should be changed to BONDING_OPTS=”miimon=100″, also the /etc/modprobe.conf stuff isn’t necessary other than the alias line.

  4. mazmade says:

    rhel also have nice tools to check the eth..sorry if all of you already know..:)

    just type ethtool your interface
    #ethtool bond0

    nice stuff…:)) n nice blog

    1. Norman Lund says:

      I find mii-tool works much better than ethtool, with rhel 4 & 5.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s