Aug 252010

Network card aggregation with Linux RHEL 5.x, (also called port bounding). It mean the merging of two network card into one single virtual (bond0) card. This is non exhaustive information, a mini how-to. for more detail see this link.

First be sure you got /sbin/ifenslave installed if not you may not be using RHEL 5.4 or 5.5. Then you will need to add the next line into /etc/modprobe.conf its necessary to define bond0 as the logical or virtual interface name.

/etc/modprobe.conf :

alias bond0 bonding

Note: balance-rr means Round-robin. It transmits packets in sequential order from the first slave through the last. This mode provides load balancing (almost twice the bandwidth) and fault tolerance in any case of cable or card failure. This mode require switch configuration as opposed to balance-alb which does not. There are 7 existing mode. See this link.

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

DEVICE=bond0
IPADDR=192.168.100.1
NETMASK=255.255.255.0
NETWORK=192.168.100.0
BROADCAST=192.168.100.255
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
BONDING_OPTS="mode=0 miimon=100"

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

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

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

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

if the command hostname return localhost.localdomain, and you are not using dhcp, it may be because you did not add your actual hostname and IP address into /etc/hosts file. Simply add this line to /etc/hosts

192.168.100.1  myserver  myserver.mydomain.com

Atfer reboot you may see messages like those entering command: dmesg or /var/log/messages

Ethernet Channel Bonding Driver: v3.4.0 (October 7, 2008)
bonding: Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.
bonding: bond0: setting mode to balance-rr (0).
bonding: bond0: Setting MII monitoring interval to 100.
ADDRCONF(NETDEV_UP): bond0: link is not ready
bonding: bond0: Adding slave eth0.
bnx2: eth0: using MSIX
bonding: bond0: enslaving eth0 as an active interface with a down link.
bonding: bond0: Adding slave eth1.
bnx2: eth1: using MSIX
bonding: bond0: enslaving eth1 as an active interface with a down link.
bnx2: eth0 NIC Copper Link is Up, 1000 Mbps full duplex
bonding: bond0: link status definitely up for interface eth0.
ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
bnx2: eth1 NIC Copper Link is Up, 1000 Mbps full duplex
bonding: bond0: link status definitely up for interface eth1.

Here is the output of ifconfig :

% ifconfig -a
bond0     Link encap:Ethernet  HWaddr A4:BA:DB:FF:FA:KE
          inet addr:192.168.100.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a6ba:dbff:fe10:301e/64 Scope:Link
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
          RX packets:572665 errors:0 dropped:0 overruns:0 frame:0
          TX packets:145041 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:320433098 (305.5 MiB)  TX bytes:11531560 (10.9 MiB)

eth0      Link encap:Ethernet  HWaddr A4:BA:DB:FF:FA:KE
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:286461 errors:0 dropped:0 overruns:0 frame:0
          TX packets:87853 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:160503391 (153.0 MiB)  TX bytes:6747616 (6.4 MiB)
          Interrupt:106 Memory:da000000-da012800 

eth1      Link encap:Ethernet  HWaddr A4:BA:DB:FF:FA:KE
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
          RX packets:286204 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57188 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:159929707 (152.5 MiB)  TX bytes:4783944 (4.5 MiB)
          Interrupt:114 Memory:dc000000-dc012800

Note: You can also setup bonding manually but it won’t stick after reboot. it very simple and may be useful to test with modes : mode 0 (balance-rr) , mode 1, 2, 3, 4, 5 … and mode 6 (balance-alb).

modprobe bonding mode=balance-rr miimon=100
ifconfig bond0 192.168.100.1 netmask 255.255.255.0 up
ifenslave bond0 eth0 eth1
route add default gw 192.168.1.1 bond0

And while at it if you configure static ip you will have to add a default gateway in /etc/sysconfig/network add this line: GATEWAY=192.168.1.1

hope this help.
Rejean

Leave a Reply

(required)

(required)

Return to Panoramic Solution