Prepare System
First install ‘mii-diag’ and ‘ifenslave’ packages, check links of network interfaces and load modules.
# apt-get install mii-diag ifenslave
# mii-tool
eth0: negotiated 100baseTx-FD, link ok
eth1: negotiated 100baseTx-FD, link ok
eth2: negotiated 100baseTx-FD, link ok
# modprobe bonding
# modprobe mii
ifconfig will show you a new interface named ‘bond0’ now.
# ifconfig -a
bond0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
BROADCAST MASTER MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Now edit ‘/etc/modprobe.d/aliases’ and add the following lines.
You need to change ‘via_rhine‘ to the driver name, which is used by your network hardware.
# /etc/modprobe.d/aliases
alias bond0 bonding
alias eth1 via_rhine
alias eth2 via_rhine
options bonding mode=0 miimon=100
Bonding Modes
Modus | Name | Usage | Comment |
---|---|---|---|
0 | balance-rr | Loadbalancing & Reliability | This mode is sending data round-robin over all interfaces participating in the bond. Inbound traffic can reach a max. thruput of one single participating interface. |
1 | active-backup | Reliability | As the name is telling us, only one interface is active. All other interfaces are in standby and get activated only if the currently active interface failes somehow. |
2 | balance-xor | Loadbalancing & Reliability | This modes calculates the interface to use by XORing the source and destination ethernet addresses and the number of participating interfaces |
3 | broadcast | Reliability | Data is sent on all participating at the same time. |
4 | 802.3ad | Loadbalancing & Reliability | 802.3ad standard can be used if you have interfaces with the same settings like transmission rates or duplex to achieve a higher bandwidth. You can’t connect to more that one switch and the switch itself needs to support 802.3ad standard. Also, you need to have ethtool and mii-tool installed. |
5 | balance-tlb | Loadbalancing | Like balance-xor but the algorhythm is more complex and more effective. You need to have ethtool installed. |
6 | balance-alb | Loadbalancing | Extended balance-tlb, additionally to outbound connections also inbound connections are balanced. You need to have ethtool installed. |
Add the following line to your ‘/etc/modprobe.d/actions’
# /etc/modprobe.d/actions
probeall bond0 eth1 eth2 bonding
Update your system environment
update-modules
Edit your /etc/network/interfaces
# /etc/network/interfaces
auto bond0
iface bond0 inet static
address 192.168.0.100
netmask 255.255.255.0
hwaddress ether 00:40:33:E2:65:87
gateway 192.168.0.1
up ifenslave bond0 eth1 eth2
down ifenslave -d bond0 eth1 eth2
Check if everything is set.
Watch the logs during the following.
rmmod bonding
modprobe bonding
/etc/init.d/networking stop
/etc/init.d/networking start
If everything works fine, pull the cable of for example eth2.
Again, watch the logs during doing that.