IpBonding

Using IP Bonding under Linux

 

IP Bonding is the ability to define a virtual network interface NIC) which sends and receives traffic to/from multiple physical NICs.

 

For example, we can create a bonding interface bond0 with slaves eth0 and eth1. Bonding can be configured to always send traffic out over eth0 and only fail over to eth1 when eth0 fails. Or, we can configure it to use round robin load balancing, so the first frame is sent on eth0, the second on eth1, the third on eth0 and so on.

 

Traffic will always be received by bond0, no matter whether the frame was received on eth0 or eth1.

 

Physical NICs are monitored (either with MII or ARP) and - when an interface is down - bonding will exclude this interface to be used until it is up again.

 

It is important to note that the sender's address will always be bond0 !

 

There are many more configuration options, for details refer to the link at the end.

 

Example

 

In this example, we'll manually set up a bonding interface and use round-robin load balancing to send traffc.

 

  • Load the bonding module with MII monitoring and round-robin load balancing: modprobe bonding mode=balance-rr miimon=100

  • Configure the bond0 NIC: ifconfig bond0 192.168.2.10 netmask 255.255.255.0 up

  • Add the 2 slaves: ifenslave bond0 eth0 and ifenslave bond0 eth1

 

That's it  Now the bind_addr for JGroups needs to be 192.168.2.10, and traffic will be load balanced between eth0 and eth1. When eth1 does down, only eth0 will be used, and when eth1 comes back up, it will be used again.

 

Note that for IP multicasting to work, a route may have to be added to bond0:

route add -net 224.0.0.0 netmask 240.0.0.0 dev bond0

 

Tools like iptraf can now be used to monitor the physical NICs. We would see that traffic is split evenly across eth0 and eth1, and when a NIC is brought down, all traffic will be sent to the remaining NIC until the down NIC is brought up again.

 

Link

 

For detailed information regarding bonding on Linux refer to

http://linux-net.osdl.org/index.php/Bonding