Ethernet Bonding

Channel Bonding in Linux:

What is it?

Create a virtual network adapter with the aggregate bandwidth of all your physical NICs

Standards: IEEE 802.3ad Link Aggregation, Also called: Trunking (Cisco)

Why Use?

  • Failover of member NICs possible, thus enhancing your network availability.
  • Potential to increase bandwidth or number of network frames exchanged. Theoritical for 2x1Gb/s NICs trunked is 2Gb/s but in real life that is seldom achieved.

If you have a bladecenter populated with two switch modules, you can have switch failover as well as NIC failover, and slightly higher performance.

How to enable?

  1. Remember that your switch has to support 802.3ad. Login to your switch and dedicate two or four ports as members of the trunk group (varies with switch models)
  2. On your Linux server: Ensure your kernel has the right modules - NIC drivers, bonding.o or bonding.ko, you must have the ip utils package ( eg ifenslave etc)

Bonding to increase network bandwidth:

modprobe  bonding
ip addr add 192.168.100.33/24 brd + dev bond0
ip link set dev bond0 up
ifenslave  bond0 eth2 eth3
ifenslave  bond0 eth2 eth3
cat /proc/net/bond0/info

Bonding to introduce failover: (HA)

modprobe bonding mode=1 miimon=100 downdelay=200 updelay=200
ip link set dev bond0 addr 00:80:c8:e7:ab:5c
ip addr add 192.168.100.33/24 brd + dev bond0
ip link set dev bond0 up
ifenslave  bond0 eth2 eth3
ip link show eth2 ; ip link show eth3 ; ip link show bond0

An example with RHEL/CentOS:  
check /etc/modules.conf, if missing, add the following: 
alias bond0 bonding  
options bonding mode=6 miimon=100  

Create a file : 
/etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE=bond0 
BOOTPROTO=none 
ONBOOT=yes 
NETMASK=255.255.255.0 
IPADDR=10.1.1.100 
USERCTL=no  

Edit /etc/sysconfig/network-scripts/eth0 
DEVICE=eth0 
BOOTPROTO=none 
ONBOOT=yes 
MASTER=bond0 
SLAVE=yes 
USERCTL=no  

Edit /etc/sysconfig/network-scripts/eth1 
DEVICE=eth1 
BOOTPROTO=none 
ONBOOT=yes 
MASTER=bond0 
SLAVE=yes 
USERCTL=no  

mode= — Specifies one of four policies allowed for the bonding module. Acceptable values for this parameter are:   

0 — Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.   

1 — Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.   

2 — Sets an XOR (exclusive-or) policy for fault tolerance and load  balancing. Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.   

3 — Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.   

4 — Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.   

5 — Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave.   

6 — Sets an Active Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPV4 traffic. Receive load balancing is achieved through ARP negotiation.