Loading...
 
UNIX >  Linux

Linux bonding

What is it?


Linux bonding is for grouping network adapters to a single link. This link can be used to distribute network load to the interfaces or to gain high availability or both.

Documentation


Read your /usr/src/linux/Documentation/networking/bonding.txt file. It's the best documentation. Another good site about bonding is:
http://linux-ip.net/html/ether-bonding.htmlQuestion.

For configuration on Suse read http://portal.suse.com/sdb/en/2004/09/tami_sles9_bonding_setup.htmlQuestion

What is this tutorial for?


I don't want to go into the very detail, but provide a easy tutorial to setup bonding on your machine. Ecpect a receipe, play with my setup, then read the documentation above to learn what you can do else.

Scenarion one: The home pc


Preface


You may have some network adapters in your computer or buy additional for less. We assume you have one fileserver at home you use for media data from different clients, so network load may be high and it could benefit from load balancing network adapters. YOu usually have cheap switches that don't support trunking.

The bonding module supports 7 different operation modes:
  • balance-rr or 0
  • active-backup or 1
  • balance-xor or 2
  • broadcast or 3
  • 802.3ad or 4
  • balance-tlb or 5
  • balance-alb or 6

With cheap switches you are limited to the modes 1,5 and 6. Mode 1 (active-backup) does only provide fault tolerance, so we are not really interested in it: We want more. Modes 5 and 6 distribute the outgoing traffic on both interfaces (the bonding "slaves"). Only mode 6 can load balance the incoming traffic. This is not easy since the communication partners on the wire use the Hardware (MAC) address to send packest to our machine. And within one network segment (connected with switches) it is not allowed to use the same MAC address twice. So every machine in our network knows in its arp cache that on of the 2 pyhsical links is connected to the IP address of our machine. This uses mode 6. Mode 6 tries to answer to arp requests in round robin. So the machines on your network have different MAC addresses for your IP address in their cache.

Setup


I describe the setup on newer SuSE linux. This is tested on Suse 9.2 and Suse 10.0. The network adapter settings are in /etc/sysconfig/network/ifcfg-config. We first setup the slaves (use Yast2 if you wish to):

/etc/sysconfig/network/ifcfg-eth-id-00:0b:b4:13:bc:92 (the MAC-addr is included in the name):
BOOTPROTO=static
STARTMODE='auto'
_nm_name='bus-pci-0000:03:06.0'

I'm not sure, but i think the _nm_name is Suse specific. It is to match a configuration to a PCI bus, so that plugging a extra network card in your computer does not change all configurations of all network cards.

The othe slave has:
BOOTPROTO=static
STARTMODE='auto'
_nm_name='bus-pci-0000:03:06.1'

Next we configure the bonding device ifcfg-bond0:
STARTMODE='auto'
BOOTPROTO=static
BROADCAST=192.168.150.255
IPADDR=192.168.150.100
NETMASK=255.255.255.0
NETWORK=192.168.150.0
BONDING_MODULE_OPTS='mode=6 miimon=100'
BONDING_MASTER=yes
BONDING_SLAVE_0='bus-pci-0000:03:06.0'
BONDING_SLAVE_1='bus-pci-0000:03:06.1'

The BONDING_SLAVE can also set with "eth0" and "eth1".

If we do now a
ifup bond0
we have a bonding device. Watch /var/log/messages for errors and warnings.
Created by admin. Last Modification: Friday 11 of November, 2005 12:57:38 UTC by admin.

Flattr me!