Ifenslave is an open source package that can be used to bond interfaces in Ubuntu 10. To install ifenslave, we can use apt-get:
apt-get install ifenslave
Once installed, we will need to take down our existing eth interfaces. Presumably these are eth0 and eth1, but you can use ifconfig to verify:
ifconfig eth0
ifconfig eth1
Once you’ve verified the interfaces you want to bond, bring them down:
ifdown eth0
ifdown eth1
Next, locate the entries in /etc/network/interfaces and comment out the corresponding lines:
vi /etc/network/interfaces
You will then need to add information for the link aggregated bond. Bond levels in ifenslave include:
- bond0: Round Robin with all interfaces active (likely the most common).
- bond1: Fault Tolerance with only one slave to the bond active at a time. The backup kicks in if the active slave fails.
- bond2: XOR with bond policy defined using xmit_hash_policy.
- bond3: Transmits all traffic on all slaves.
- bond4: 802.3ad or dynamic link aggregation. Similar but more robust to bond0, although has more prerequisites.
- bond5: Doesn’t require special switch configuration, but has incoming traffic on one slave and balanced outgoing traffic.
- bond6: Also doesn’t require special switch configuration (although you may need to configure updelay on the switch), otherwise similar to bond4 but more friendly to more members.
Let’s assume we’re going to go with a vanilla round robin bond (bond0). Let’s add the following (which includes the IP address, netmask and gateway as well as the bonding information):
auto bond0
iface bond0 inet static
address 192.168.210.100
netmask 255.255.255.0
gateway 192.168.210.1
slaves all
bond-mode 0
bond-miimon 100
These variables:
- iface: defines the interface (similar to a standard interface)
- address: IP address
- netmask: Defines the subnet/netmask
- gateway: Defines the router, or default gateway
- slaves: Defines which adapters will be a part of the bond (also can use master/primary in addition to slaves according to bond type)
- bond-mode: mode of the bond (corresponds to bond*)
- bond-miimon: An integer from 0 to 100 that defines the number of milliseconds between link monitors
- updelay and downdelay: milliseconds to delay bringing links up and down when failures and additions are detected
- arp_interval and arp_target: The number of milliseconds to test arp connectivity and the address to use for testing
Finally, we can bring the bond online using ifup followed by the bond name:
ifup bond0
You should then be able to ping, use iftop, netperf, etc to test the performance of the bond.