Penguin
Blame: LinuxEthernetBonding
EditPageHistoryDiffInfoLikePages
Annotated edit history of LinuxEthernetBonding version 3, including all changes. View license author blame.
Rev Author # Line
1 DanielLawson 1 !!What is Ethernet Bonding
2
3 Ethernet bonding refers to aggregating multiple ethernet channels together to form a single channel. This is primarily used for redundancy in ethernet paths or for load balancing. This page refers in particular to performing ethernet bonding under linux, and so does not limit itself to discussion of 802.3ad Trunk Aggregation.
4
5 !!Bonding Types
6
7 The linux kernel bonding module supports a number of bonding types.
8
9 * Round Robin
10 ** Packets are transmitted in a round robin fashion over the available slave interfaces. Provides both load balancing and fault tolerance
11 * Active Backup
12 ** One slave interface is active at any time. If one interface fails, another interface takes over the MAC address and becomes the active interface. Provides fault tolerance only. Doesn't require special switch support
13 * Balance XOR
14 ** Tranmissions are balanced across the slave interfaces based on ((source MAC) XOR (dest MAC)) modula slave count. The same slave is selected for each destination MAC. Provides load balancing and fault tolerance.
15 * Broadcast
16 ** Transmits everything on all slave interfaces. Provides fault tolerance.
17 * 802.3ad
18 ** This is classic IEEE 802.3ad Dynamic link aggregation. This requires 802.3ad support in the switch and driver support for retrieving the speed and duplex of each slave.
19 * Balance TLB
20 ** Adaptive Transmit Load Balancing. Incoming traffic is received on the active slave only, outgoing traffic is distributed according to the current load on each slave. Doesn't require special switch support
21 * Balance ALB
22 ** Adaptive Load Balancing - provides both transmit load balancing (TLB) and receive load balancing for IPv4 via ARP negotiation. Doesn't require special switch support, but does require the ability to change the MAC address of a device while it is open
23
24 !!Tools
25
26 You need the bonding module for your kernel, and the ifenslave tool which is found within the kernel source at Documentation/networking/ifenslave.c, or you could use a distribution provided package (eg, apt-get install ifenslave-2.4 or apt-get install ifenslave-2.6 depending on your kernel version).
27
28 ! Module alias
29
30 It is recommended that you let the kernel know which module to use for the bonded interface by setting the following in the appropriate place for module options (for debian it is /etc/modutils/aliases):
31
32 <verbatim>
33 alias bond0 bonding
34 </verbatim>
35
36 ! Module options
37 When loading the bonding module, you must specify the mode you wish to use. It's normally best to set this as a modprobe option, the location of which will depend on your distribution. For debian, you could set it in /etc/modutils/options and run update-modules
38
39 Read the kernel docs for which options are supported. At a minimum, you have to set the bonding mode you wish to use, eg:
40
41 <verbatim>
42 options bond0 mode=802.3ad miimon=100
43 </verbatim>
44
45 ! Creating the bonded interface
46
47 To bond eth0 and eth1 into the bonded device bond0, and assign this device the IP address 192.168.1.1 within the 192.168.1.0/24 network, do the following:
48
49 <verbatim>
50 ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
51 ifenslave bond0 eth0
52 ifenslave bond0 eth1
53 </verbatim>
3 MichaelJager 54
55 During a setup I did recently (February 2006) using active-backup, I had to change the MAC address of the interface that was ifenslaved second to be the same as the first. It seemed that something weird was happening like the second interface would answer an ARP request for an IP address, and provide the MAC address of the bridge, but the machine never got packets, because it wouldn't accept packets for anything other than the MAC of the second interface. I didn't investigate further, it could have been something I was doing wrong. -- MichaelJager (IsomerMadeMeDoThis)
1 DanielLawson 56
57 Your distribution will possibly have native interface control support for creating bonded interfaces. Check your manual pages. RedHat and SuSE (and derivatives) have native support; debian doesn't appear to.
58
59 An example of how to do this within debian is as follows:
60 <verbatim>
61 auto eth0 eth1 bond0
62
63 iface eth0 inet manual
64
65 iface eth1 inet manual
66
67 iface bond0 inet static
68 pre-up ifconfig bond0 up
69 pre-up ifenslave bond0 eth0 eth1
70 pre-down ifenslave -d bond0 eth0 eth1
71 address 192.168.1.1
72 netmask 255.255.255.0
73 network 192.168.1.0
74 broadcast 192.168.1.255
75 gateway 192.168.1.254
76
77 </verbatim>
2 DanielLawson 78
79 There is a mailing list post which contains some hook scripts for debian to provide ifupdown bonded interface functionality. These can be found [here|http://lists.debian.org/debian-mentors/2005/10/msg00213.html]
1 DanielLawson 80
81 !!VLANs
82
83 You can specify VLAN interfaces on top of a bonded interface. Simply assign the bond0 interface no IP address (or 0.0.0.0), and then you can use the bond0 interface as the physical device for the VLAN interface. Refer to your distribution documentation on how to setup vlans within your network configuration.
3 MichaelJager 84
85 I've done this, and it works well. I wanted to use bridging at let STP work out which interface to put into forwarding, and which to put into blocking, but the bridging driver didn't work with per-VLAN spanning tree; as a result I ended up using bonding in active-backup mode. -- MichaelJager
1 DanielLawson 86
87
88 !!References
89
90 * Linux kernel documentation, Documentation/networking/bonding.txt
91 * http://www.debian-administration.org/articles/312