Bond network interfaces in linux

Short intro:

Bonding (or ‘teaming’) network interfaces is a way to bind 2 interfaces as one. This way you can configure a more redundant network connection. A normal bonded setup should of course be connected to a redundant switch (lan port1 to switch 1, lan port 2 to switch 2). It is also possible to do load balancing, but in this case traffic is low but availability should be high so i’m going for redundancy.

This setup is for a IBM Xserver running ubuntu 6.06.1 LTS server, this is a server with two Broadcom NetXtreme BCM5703X Gigabit Ethernet network interfaces which uses the ‘t3’ module.

Before proceeding check what interfaces you have and what module you are using for your network interfaces.

To get started with ‘bonding’ first you will need to look at your situation and check in what ‘mode’ you want to configure the interface, while I normally use ‘mode: 2’ this could maybe not work in your configuration so Google for a few pages that explain the differences (this is a referance base remember..)

The Configuration:

First edit /etc/modprobe.d/aliases and at the end of the file add (be sure to change the module, mode and miimon if necessary) :

1
2
3
4
alias bond0 bonding
alias eth0 t3
alias eth1 t3
options bonding mode=2 miimon=100

Then edit /etc/modprobe.d/arch/i386 (and again be sure to change the module and miimon setting if necessary):

1
2
alias bond0 bonding
options bonding mode=2 miimon=100 downdelay=200 updelay=200

First we need to check what mac interface we are going to use so use ‘ifconfig’ to get the mac for the primary adapter in your server (this is the one I normally use).

trouble@sun:$ /sbin/ifconfig eth0
eth0 Link encap:Ethernet HWaddr YOUR MAC
…..snap….

Now edit /etc/network/interfaces, disable all the settings for the current interface (except lo of course) and add the following:

1
2
3
4
5
6
7
8
9
auto bond0
iface bond0 inet static
   address 192.168.0.100
   netmask 255.255.255.0
   network 192.168.0.0
   broadcast 192.168.0.255
   gateway 192.168.0.1
   hwaddress ether YOUR MAC
   post-up ifenslave bond0 eth0 eth1

Now reboot and you should be ready to go.

Testing the config:

Test it out by starting a ping to a other host in your network and unplug one cable at a time (no unplugging both interfaces won’t work..)

Also you can check the status with:

trouble@sun:$ cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.0.0 (November 8, 2005)

Bonding Mode: load balancing (xor)
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200

Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: MAC

Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: MAC

0

Add a Comment