Link Aggregation can also be known as:
- "NIC Bonding" (Mainly Linux world)
- "NIC Teaming" (Mainly Windows world)
- "Port Trunking" (Mainly hardware world)
- "Etherchannel" (Mainly AIX and HP-UX)
- "Ether bonding"
The advantages of aggregation are that the virtual NIC interface created by Link Aggregation provides increased bandwidth by merging the bandwidth of the individual ports/NICs It's primary use _is_ to increase a network link speed beyond the limits of any one single cable or port. Although It can also be used for failover, if one link dies all traffic to and from the machine should be routed to the remaining links. Ok, so thats a brief explanation of the technology. So how do I put it into practice with Dapper (Edubuntu Dapper).
- 1 Requirements
- 2 Bonding Modes
- 3 Installing ifenslave
- 4 Loading bonding driver at boot
- 5 Adjusting /etc/network/interfaces
- 6 Loading Modules & Restarting Networking
- 7 Finish
- 8 Links
At least two NIC's and preferably a switch capable of IEEE 802.3ad Standard Dynamic Link Aggregation (not required if using adaptive load balancing or active/backup).
You can bond your interfaces in a variety of modes, depending on your hardware capabilities, as follows:
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
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.
XOR policy: 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.
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
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.
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.
Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) 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.
ifenslave is a tool to attach and detach slave network interfaces to a bonding device. A bonding device will act like a normal Ethernet network device to the kernel, but will send out the packets via the slave devices using a variety of techniques. This allows for simple load-balancing, identical to "channel bonding" or "trunking" techniques used in switches.
sudo apt-get install ifenslave
Loading bonding driver at boot
To load the bonding module at boot just add the style of bonding you want to use into your
sudo sh -c "echo bonding mode=1 miimon=100 >> /etc/modules"
where 1 in this case represents active-backup (most reliable method & will work with all switches, fastest supporting all switches is 6, fastest with 802.3ad supporting switch is 4)
Firstly NetworkManager will play havoc with any static configurations you setup, and bonding is generally for server environments where you have predefined network settings so to make things easy we just get rid of it!
sudo apt-get remove network-manager
Now load up
/etc/network/interfaces in your favourite editor (try
vimtutor at a prompt to get used to vim)
sudo vim /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback auto bond0 iface bond0 inet static address 192.168.1.1 netmask 255.255.255.0 gateway 192.168.1.254 dns-nameservers 192.168.1.254 post-up ifenslave bond0 eth0 eth1 pre-down ifenslave -d bond0 eth0 eth1
In this case your bonded ip address will be 192.168.1.1 and your gateway (router) & dns server are at the same address (192.168.1.254)
Loading Modules & Restarting Networking
Make sure you use the same mode you selected above in replacement of 1
sudo modprobe bonding mode=1 miimon=100 sudo /etc/init.d/networking restart
OK, you now have to configure your switch/network equipment to accept the newly created aggregated link. Please consult your switch manufacturers manual on how to do this. Congratulations you should now be up and running with an aggregated link.