Live Help

Latest Announcements

Guru-host goes to Centos.org

We are thrilled to announce that Guru-host.eu is a sponsor of CentOS project.
A new repository with 100Mbit Internet Connection on Dual Core Xeon CPU will be available to all our customers along with European citizens. This will server data much faster than the US repositories. Guru-host customers will be able to update their CentOS servers without calculating traffic (bandwidth) as the server is running inside our core network. CentOS is 100% compatible with Redhat Enterprise Server.


Network Storage up to 8TB per customer

We can now deliver iSCSI storage on our enterprise class Storage Area Network (SAN) which is based on the industry leading Lefthand Networks platform from HP.

Contact us for a custom quote
Network bonding on Linux

This guide cover almost any version of Ubuntu (tested with 7.10. 8.04,8.10 and 9.04).
Bonding is creation of a single bonded interface by combining two or more Ethernet cards into one. This is called bond0 bond1 and so on.
This helps in high availability and performance improvement.
For example you can have 4 Gigabit Ethernet cards combined into one and from that (4Gigabit in total) to server a file server, a Samba. This will improve a lot the performance of your file server as it is obvious.



Step 1

Type in a terminal:
sudo mii-tool

You will see something like:

sysadmin@masterldap:~$ sudo mii-tool 
eth0: negotiated 1000baseT-FD flow-control, link ok
eth1: negotiated 1000baseT-FD flow-control, link ok

If not, check your Ethernet cables and that all are connected to the appropriate switch (Gigabit for example).

Optional: You can check what is supported by your card via the ethtool command like, ethtool eth0 && ethtool eth1 && ethtool eth2 and so on.


Step 2
Install required packages, type in a terminal:
sudo apt-get update && apt-get install ifenslave


Step 3
Edit /etc/modprobe.d/aliases file and add at the bottom of the file the following:

alias bond0 bonding
options bonding mode=6 miimon=100

Note: See reference [1] regarding supported modes in channel bonding.


Step 4
Edit /etc/network/interfaces and add the following at the end of the file

iface bond0 inet static
    address 192.168.1.239
    netmask 255.255.255.0
    broadcast 192.168.1.255
    network 192.168.1.0
    gateway 192.168.1.250
    up /sbin/ifenslave bond0 eth0 eth1 
    down /sbin/ifenslave -d bond0 eth0 eth1

Also somewhere in your file you will see the auto lo, add at the end of it the bond0. This will be something like:
auto lo bond0

Do not forget to edit your /etc/resolv.conf file in case that you haven't already in order to include your ISP's nameservers. The syntax of the file is like:

sysadmin@masterldap:~$ cat /etc/resolv.conf 
nameserver 192.168.1.248
nameserver 194.219.227.2
nameserver 193.92.150.3

That's all, reboot your machine and you're done.


[1] Network Bonding supported modes

You can set up your bond interface according to your needs. In order to do this, you simply change the mode type depicted in the examples below (mode=X). There are seven mode types available. They are as follows:

mode=0

    This mode uses the Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.

mode=1

    This mode uses an Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.

mode=2

    Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.

mode=3

    Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.

mode=4

    IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.

          *Pre-requisites:

        1. Ethtool support in the base drivers for retrieving the speed and duplex of each slave.

        2. A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require    some type of configuration to enable 802.3ad mode

mode=5

    Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.

        *Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.

mode=6

    Adaptive load balancing: includes balance-transmit load balancing plus receive load balancing for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

Posted on: 10/08/2009

Back to Home page