Home > Bash, Linux, Linux Networking > IP Bonding or Teaming in Linux – RHEL 5

IP Bonding or Teaming in Linux – RHEL 5

June 24th, 2009

IP Bonding or Teaming is a method of combining all the network interfaces togather into one with one of the types like Network Fault Tolerance, Round Robin, Back up, Loadbalancing etc. So it looks virtually as a single interface to the outside world providing high availability, based on the type you have set. Means, in a Network fault tolerant type one will take over if other fails and in a Load Balancing type trafic is shared when one busy to the other.

I got a chance of doing IP bonding in a HP Proliant Servers running RHEL 5. Everthing went well with no issues. Let me share my experience with my blog readers. In linux IP bonding is quite simple and is done with some kernel modules and no extra package is to be installed. In Windows, bonging or teaming is done with some software. With HP server, it can easily be done with some HP Network Configuration Uitlities.
Two establish IP bonding you need a minimum of two nework interfaces

Step 1:Check your network interfaces

#ethtool eth0
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0×00000007 (7)
Link detected: yes

#ethtool eth1
Settings for eth1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Current message level: 0×00000007 (7)
Link detected: yes

Step 2: Check all the requiured kernel modules are available(bonding and mii)

#modprobe –list | grep bonding

/lib/modules/2.6.18-92.el5/kernel/drivers/net/bonding/bonding.ko

# modprobe –list | grep mii

/lib/modules/2.6.18-92.el5/kernel/drivers/net/mii.ko

Step 3: Editing the modprobe.conf file

#vim /etc/modprobe.conf

and add the following lines at the end

alias bond0 bonding

options bond0 mode=1 arp_ip_target=192.168.52.1 arp_interval=200 primary=eth0

To know more about the parameters to be used here use the command

#modinfo bonding

filename: /lib/modules/2.6.18-92.el5/kernel/drivers/net/bonding/bonding.ko

author: Thomas Davis, tadavis@lbl.gov and many others

description: Ethernet Channel Bonding Driver, v3.2.4

version: 3.2.4

license: GPL

srcversion: DB2ABCD47A83F8567EBE92B

depends:

vermagic: 2.6.18-92.el5 SMP mod_unload gcc-4.1

parm: max_bonds:Max number of bonded devices (int)

parm: miimon:Link check interval in milliseconds (int)

parm: updelay:Delay before considering link up, in milliseconds (int)

parm: downdelay:Delay before considering link down, in milliseconds (int)

parm: use_carrier:Use netif_carrier_ok (vs MII ioctls) in miimon; 0 for off, 1 for on (default) (int)

parm: mode:Mode of operation : 0 for balance-rr, 1 for active-backup, 2 for balance-xor, 3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, 6 for balance-alb (charp)

parm: primary:Primary network device to use (charp)

parm: lacp_rate:LACPDU tx rate to request from 802.3ad partner (slow/fast) (charp)

parm: xmit_hash_policy:XOR hashing method: 0 for layer 2 (default), 1 for layer 3+4 (charp)

parm: arp_interval:arp interval in milliseconds (int)

parm: arp_ip_target:arp targets in n.n.n.n form (array of charp)

parm: arp_validate:validate src/dst of ARP probes: none (default), active, backup or all (charp)

parm: fail_over_mac:For active-backup, do not set all slaves to the same MAC. 0 of off (default), 1 for on. (int)

module_sig: 883f35048175a9e6e24e25c96667c37112449509f5739ebf283efa5295d315b73cee5e956f6e25709cbcf2826571c5ffc20f2d87672bb921d610d7

Step 3: Now load the modules

<!– @page { size: 8.27in 11.69in; margin: 0.79in } P { margin-bottom: 0.08in } –>

#modprobe bonding

#modprobe mii

This will create a bond0 config file in the networks-scripts directory

Step 4: Editting the three configuration files for eth0,eth1,bond0

|# vim /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

NETMASK=255.255.255.0

IPADDR=192.168.52.4

USERCTL=no

GATEWAY=192.168.52.1

TYPE=Ethernet

IPV6INIT=no

PEERDNS=yes

#vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes

USERCTL=no

TYPE=Ethernet

#vim /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=none

ONBOOT=yes

MASTER=bond0

SLAVE=yes

USERCTL=no

TYPE=Ethernet

Step5: Restart your networks service

#/etc/init.d/network restart

#ifconfig

Now use ifconfig command to check the, you will look a new interface called bond0 has been created.  The ip you set for it is going to be your ip address of the system. Enjoy bonding

Bash, Linux, Linux Networking , , ,

  1. Ahmed
    March 13th, 2011 at 12:16 | #1

    I keep on getting the following messages (in /var/log/messages) after bonding two interfaces. What could be the reason?

    bonding: bond0: link status definitely down for interface eth2, disabling it
    Mar 13 11:52:49 dr102 kernel: bonding: bond0: making interface eth3 the new active one.
    Mar 13 11:52:49 dr102 kernel: bonding: bond0: link status definitely up for interface eth2.
    Mar 13 11:52:49 dr102 kernel: bonding: bond0: making interface eth2 the new active one.
    Mar 13 11:52:50 dr102 kernel: bonding: bond0: link status definitely down for interface eth2, disabling it
    Mar 13 11:52:50 dr102 kernel: bonding: bond0: making interface eth3 the new active one.
    Mar 13 11:52:50 dr102 kernel: bonding: bond0: link status definitely up for interface eth2.
    Mar 13 11:52:50 dr102 kernel: bonding: bond0: making interface eth2 the new active one.
    Mar 13 11:52:51 dr102 kernel: bonding: bond0: link status definitely down for interface eth2, disabling it
    Mar 13 11:52:51 dr102 kernel: bonding: bond0: making interface eth3 the new active one.
    Mar 13 11:52:51 dr102 kernel: bonding: bond0: link status definitely up for interface eth2.

  2. March 13th, 2011 at 14:18 | #2

    @Ahmed, What version of redhat are you using?
    1. Double check if the hardware addresses in the files ifcfg-eth1 and /ifcfg-eth0? Normally when copying people forget to change the hardware addresses.

    2. Check the bug fix below
    https://bugzilla.redhat.com/show_bug.cgi?id=483034

    Hope it helps Let me know.

  3. Ahmed
    March 13th, 2011 at 15:10 | #3

    2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

    Red Hat Enterprise Linux Server release 5.5 (Tikanga)

    I did not copy but I checked and hardware address is different.

  4. Ahmed
    March 13th, 2011 at 15:33 | #4

    ]# cat /proc/net/bonding/bond0
    Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)

    Bonding Mode: fault-tolerance (active-backup)
    Primary Slave: eth2 (primary_reselect always)
    Currently Active Slave: eth2
    MII Status: up
    MII Polling Interval (ms): 0
    Up Delay (ms): 0
    Down Delay (ms): 0
    ARP Polling Interval (ms): 200
    ARP IP target/s (n.n.n.n form):

    Slave Interface: eth2
    MII Status: up
    Link Failure Count: 13087
    Permanent HW addr: 68:b5:99:c5:dd:28

    Slave Interface: eth3
    MII Status: up
    Link Failure Count: 1213
    Permanent HW addr: 68:b5:99:c5:dd:2a

  1. No trackbacks yet.