blob: b0fe41da007bf847e8ae2da4c4b2b840461d9353 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001
Jay Vosburgh00354cf2005-07-21 12:18:02 -07002 Linux Ethernet Bonding Driver HOWTO
3
4 Latest update: 21 June 2005
Linus Torvalds1da177e2005-04-16 15:20:36 -07005
6Initial release : Thomas Davis <tadavis at lbl.gov>
7Corrections, HA extensions : 2000/10/03-15 :
8 - Willy Tarreau <willy at meta-x.org>
9 - Constantine Gavrilov <const-g at xpert.com>
10 - Chad N. Tindel <ctindel at ieee dot org>
11 - Janice Girouard <girouard at us dot ibm dot com>
12 - Jay Vosburgh <fubar at us dot ibm dot com>
13
14Reorganized and updated Feb 2005 by Jay Vosburgh
15
Jay Vosburgh00354cf2005-07-21 12:18:02 -070016Introduction
17============
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Jay Vosburgh00354cf2005-07-21 12:18:02 -070019 The Linux bonding driver provides a method for aggregating
20multiple network interfaces into a single logical "bonded" interface.
21The behavior of the bonded interfaces depends upon the mode; generally
22speaking, modes provide either hot standby or load balancing services.
23Additionally, link integrity monitoring may be performed.
24
25 The bonding driver originally came from Donald Becker's
26beowulf patches for kernel 2.0. It has changed quite a bit since, and
27the original tools from extreme-linux and beowulf sites will not work
28with this version of the driver.
29
30 For new versions of the driver, updated userspace tools, and
31who to ask for help, please follow the links at the end of this file.
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
33Table of Contents
34=================
35
361. Bonding Driver Installation
37
382. Bonding Driver Options
39
403. Configuring Bonding Devices
413.1 Configuration with sysconfig support
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700423.1.1 Using DHCP with sysconfig
433.1.2 Configuring Multiple Bonds with sysconfig
Linus Torvalds1da177e2005-04-16 15:20:36 -0700443.2 Configuration with initscripts support
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700453.2.1 Using DHCP with initscripts
463.2.2 Configuring Multiple Bonds with initscripts
Linus Torvalds1da177e2005-04-16 15:20:36 -0700473.3 Configuring Bonding Manually
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700483.3.1 Configuring Multiple Bonds Manually
Linus Torvalds1da177e2005-04-16 15:20:36 -070049
505. Querying Bonding Configuration
515.1 Bonding Configuration
525.2 Network Configuration
53
546. Switch Configuration
55
567. 802.1q VLAN Support
57
588. Link Monitoring
598.1 ARP Monitor Operation
608.2 Configuring Multiple ARP Targets
618.3 MII Monitor Operation
62
639. Potential Trouble Sources
649.1 Adventures in Routing
659.2 Ethernet Device Renaming
669.3 Painfully Slow Or No Failed Link Detection By Miimon
67
6810. SNMP agents
69
7011. Promiscuous mode
71
Jay Vosburgh00354cf2005-07-21 12:18:02 -07007212. Configuring Bonding for High Availability
Linus Torvalds1da177e2005-04-16 15:20:36 -07007312.1 High Availability in a Single Switch Topology
Linus Torvalds1da177e2005-04-16 15:20:36 -07007412.2 High Availability in a Multiple Switch Topology
Jay Vosburgh00354cf2005-07-21 12:18:02 -07007512.2.1 HA Bonding Mode Selection for Multiple Switch Topology
7612.2.2 HA Link Monitoring for Multiple Switch Topology
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
Jay Vosburgh00354cf2005-07-21 12:18:02 -07007813. Configuring Bonding for Maximum Throughput
7913.1 Maximum Throughput in a Single Switch Topology
8013.1.1 MT Bonding Mode Selection for Single Switch Topology
8113.1.2 MT Link Monitoring for Single Switch Topology
8213.2 Maximum Throughput in a Multiple Switch Topology
8313.2.1 MT Bonding Mode Selection for Multiple Switch Topology
8413.2.2 MT Link Monitoring for Multiple Switch Topology
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
Jay Vosburgh00354cf2005-07-21 12:18:02 -07008614. Switch Behavior Issues
8714.1 Link Establishment and Failover Delays
8814.2 Duplicated Incoming Packets
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
Jay Vosburgh00354cf2005-07-21 12:18:02 -07009015. Hardware Specific Considerations
9115.1 IBM BladeCenter
92
9316. Frequently Asked Questions
94
9517. Resources and Links
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
97
981. Bonding Driver Installation
99==============================
100
101 Most popular distro kernels ship with the bonding driver
102already available as a module and the ifenslave user level control
103program installed and ready for use. If your distro does not, or you
104have need to compile bonding from source (e.g., configuring and
105installing a mainline kernel from kernel.org), you'll need to perform
106the following steps:
107
1081.1 Configure and build the kernel with bonding
109-----------------------------------------------
110
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700111 The current version of the bonding driver is available in the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112drivers/net/bonding subdirectory of the most recent kernel source
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700113(which is available on http://kernel.org). Most users "rolling their
114own" will want to use the most recent kernel from kernel.org.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115
116 Configure kernel with "make menuconfig" (or "make xconfig" or
117"make config"), then select "Bonding driver support" in the "Network
118device support" section. It is recommended that you configure the
119driver as module since it is currently the only way to pass parameters
120to the driver or configure more than one bonding device.
121
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700122 Build and install the new kernel and modules, then continue
123below to install ifenslave.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
1251.2 Install ifenslave Control Utility
126-------------------------------------
127
128 The ifenslave user level control program is included in the
129kernel source tree, in the file Documentation/networking/ifenslave.c.
130It is generally recommended that you use the ifenslave that
131corresponds to the kernel that you are using (either from the same
132source tree or supplied with the distro), however, ifenslave
133executables from older kernels should function (but features newer
134than the ifenslave release are not supported). Running an ifenslave
135that is newer than the kernel is not supported, and may or may not
136work.
137
138 To install ifenslave, do the following:
139
140# gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
141# cp ifenslave /sbin/ifenslave
142
143 If your kernel source is not in "/usr/src/linux," then replace
144"/usr/src/linux/include" in the above with the location of your kernel
145source include directory.
146
147 You may wish to back up any existing /sbin/ifenslave, or, for
148testing or informal use, tag the ifenslave to the kernel version
149(e.g., name the ifenslave executable /sbin/ifenslave-2.6.10).
150
151IMPORTANT NOTE:
152
153 If you omit the "-I" or specify an incorrect directory, you
154may end up with an ifenslave that is incompatible with the kernel
155you're trying to build it for. Some distros (e.g., Red Hat from 7.1
156onwards) do not have /usr/include/linux symbolically linked to the
157default kernel source include directory.
158
159
1602. Bonding Driver Options
161=========================
162
163 Options for the bonding driver are supplied as parameters to
164the bonding module at load time. They may be given as command line
165arguments to the insmod or modprobe command, but are usually specified
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700166in either the /etc/modules.conf or /etc/modprobe.conf configuration
167file, or in a distro-specific configuration file (some of which are
168detailed in the next section).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700169
170 The available bonding driver parameters are listed below. If a
171parameter is not specified the default value is used. When initially
172configuring a bond, it is recommended "tail -f /var/log/messages" be
173run in a separate window to watch for bonding driver error messages.
174
175 It is critical that either the miimon or arp_interval and
176arp_ip_target parameters be specified, otherwise serious network
177degradation will occur during link failures. Very few devices do not
178support at least miimon, so there is really no reason not to use it.
179
180 Options with textual values will accept either the text name
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700181or, for backwards compatibility, the option value. E.g.,
182"mode=802.3ad" and "mode=4" set the same mode.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183
184 The parameters are as follows:
185
186arp_interval
187
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700188 Specifies the ARP link monitoring frequency in milliseconds.
189 If ARP monitoring is used in an etherchannel compatible mode
190 (modes 0 and 2), the switch should be configured in a mode
191 that evenly distributes packets across all links. If the
192 switch is configured to distribute the packets in an XOR
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 fashion, all replies from the ARP targets will be received on
194 the same link which could cause the other team members to
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700195 fail. ARP monitoring should not be used in conjunction with
196 miimon. A value of 0 disables ARP monitoring. The default
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197 value is 0.
198
199arp_ip_target
200
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700201 Specifies the IP addresses to use as ARP monitoring peers when
202 arp_interval is > 0. These are the targets of the ARP request
203 sent to determine the health of the link to the targets.
204 Specify these values in ddd.ddd.ddd.ddd format. Multiple IP
205 addresses must be separated by a comma. At least one IP
206 address must be given for ARP monitoring to function. The
207 maximum number of targets that can be specified is 16. The
208 default value is no IP addresses.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700209
210downdelay
211
212 Specifies the time, in milliseconds, to wait before disabling
213 a slave after a link failure has been detected. This option
214 is only valid for the miimon link monitor. The downdelay
215 value should be a multiple of the miimon value; if not, it
216 will be rounded down to the nearest multiple. The default
217 value is 0.
218
219lacp_rate
220
221 Option specifying the rate in which we'll ask our link partner
222 to transmit LACPDU packets in 802.3ad mode. Possible values
223 are:
224
225 slow or 0
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700226 Request partner to transmit LACPDUs every 30 seconds
Linus Torvalds1da177e2005-04-16 15:20:36 -0700227
228 fast or 1
229 Request partner to transmit LACPDUs every 1 second
230
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700231 The default is slow.
232
Linus Torvalds1da177e2005-04-16 15:20:36 -0700233max_bonds
234
235 Specifies the number of bonding devices to create for this
236 instance of the bonding driver. E.g., if max_bonds is 3, and
237 the bonding driver is not already loaded, then bond0, bond1
238 and bond2 will be created. The default value is 1.
239
240miimon
241
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700242 Specifies the MII link monitoring frequency in milliseconds.
243 This determines how often the link state of each slave is
244 inspected for link failures. A value of zero disables MII
245 link monitoring. A value of 100 is a good starting point.
246 The use_carrier option, below, affects how the link state is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 determined. See the High Availability section for additional
248 information. The default value is 0.
249
250mode
251
252 Specifies one of the bonding policies. The default is
253 balance-rr (round robin). Possible values are:
254
255 balance-rr or 0
256
257 Round-robin policy: Transmit packets in sequential
258 order from the first available slave through the
259 last. This mode provides load balancing and fault
260 tolerance.
261
262 active-backup or 1
263
264 Active-backup policy: Only one slave in the bond is
265 active. A different slave becomes active if, and only
266 if, the active slave fails. The bond's MAC address is
267 externally visible on only one port (network adapter)
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700268 to avoid confusing the switch.
269
270 In bonding version 2.6.2 or later, when a failover
271 occurs in active-backup mode, bonding will issue one
272 or more gratuitous ARPs on the newly active slave.
273 One gratutious ARP is issued for the bonding master
274 interface and each VLAN interfaces configured above
275 it, provided that the interface has at least one IP
276 address configured. Gratuitous ARPs issued for VLAN
277 interfaces are tagged with the appropriate VLAN id.
278
279 This mode provides fault tolerance. The primary
280 option, documented below, affects the behavior of this
281 mode.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282
283 balance-xor or 2
284
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700285 XOR policy: Transmit based on the selected transmit
286 hash policy. The default policy is a simple [(source
287 MAC address XOR'd with destination MAC address) modulo
288 slave count]. Alternate transmit policies may be
289 selected via the xmit_hash_policy option, described
290 below.
291
292 This mode provides load balancing and fault tolerance.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293
294 broadcast or 3
295
296 Broadcast policy: transmits everything on all slave
297 interfaces. This mode provides fault tolerance.
298
299 802.3ad or 4
300
301 IEEE 802.3ad Dynamic link aggregation. Creates
302 aggregation groups that share the same speed and
303 duplex settings. Utilizes all slaves in the active
304 aggregator according to the 802.3ad specification.
305
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700306 Slave selection for outgoing traffic is done according
307 to the transmit hash policy, which may be changed from
308 the default simple XOR policy via the xmit_hash_policy
309 option, documented below. Note that not all transmit
310 policies may be 802.3ad compliant, particularly in
311 regards to the packet mis-ordering requirements of
312 section 43.2.4 of the 802.3ad standard. Differing
313 peer implementations will have varying tolerances for
314 noncompliance.
315
316 Prerequisites:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317
318 1. Ethtool support in the base drivers for retrieving
319 the speed and duplex of each slave.
320
321 2. A switch that supports IEEE 802.3ad Dynamic link
322 aggregation.
323
324 Most switches will require some type of configuration
325 to enable 802.3ad mode.
326
327 balance-tlb or 5
328
329 Adaptive transmit load balancing: channel bonding that
330 does not require any special switch support. The
331 outgoing traffic is distributed according to the
332 current load (computed relative to the speed) on each
333 slave. Incoming traffic is received by the current
334 slave. If the receiving slave fails, another slave
335 takes over the MAC address of the failed receiving
336 slave.
337
338 Prerequisite:
339
340 Ethtool support in the base drivers for retrieving the
341 speed of each slave.
342
343 balance-alb or 6
344
345 Adaptive load balancing: includes balance-tlb plus
346 receive load balancing (rlb) for IPV4 traffic, and
347 does not require any special switch support. The
348 receive load balancing is achieved by ARP negotiation.
349 The bonding driver intercepts the ARP Replies sent by
350 the local system on their way out and overwrites the
351 source hardware address with the unique hardware
352 address of one of the slaves in the bond such that
353 different peers use different hardware addresses for
354 the server.
355
356 Receive traffic from connections created by the server
357 is also balanced. When the local system sends an ARP
358 Request the bonding driver copies and saves the peer's
359 IP information from the ARP packet. When the ARP
360 Reply arrives from the peer, its hardware address is
361 retrieved and the bonding driver initiates an ARP
362 reply to this peer assigning it to one of the slaves
363 in the bond. A problematic outcome of using ARP
364 negotiation for balancing is that each time that an
365 ARP request is broadcast it uses the hardware address
366 of the bond. Hence, peers learn the hardware address
367 of the bond and the balancing of receive traffic
368 collapses to the current slave. This is handled by
369 sending updates (ARP Replies) to all the peers with
370 their individually assigned hardware address such that
371 the traffic is redistributed. Receive traffic is also
372 redistributed when a new slave is added to the bond
373 and when an inactive slave is re-activated. The
374 receive load is distributed sequentially (round robin)
375 among the group of highest speed slaves in the bond.
376
377 When a link is reconnected or a new slave joins the
378 bond the receive traffic is redistributed among all
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700379 active slaves in the bond by initiating ARP Replies
Linus Torvalds1da177e2005-04-16 15:20:36 -0700380 with the selected mac address to each of the
381 clients. The updelay parameter (detailed below) must
382 be set to a value equal or greater than the switch's
383 forwarding delay so that the ARP Replies sent to the
384 peers will not be blocked by the switch.
385
386 Prerequisites:
387
388 1. Ethtool support in the base drivers for retrieving
389 the speed of each slave.
390
391 2. Base driver support for setting the hardware
392 address of a device while it is open. This is
393 required so that there will always be one slave in the
394 team using the bond hardware address (the
395 curr_active_slave) while having a unique hardware
396 address for each slave in the bond. If the
397 curr_active_slave fails its hardware address is
398 swapped with the new curr_active_slave that was
399 chosen.
400
401primary
402
403 A string (eth0, eth2, etc) specifying which slave is the
404 primary device. The specified device will always be the
405 active slave while it is available. Only when the primary is
406 off-line will alternate devices be used. This is useful when
407 one slave is preferred over another, e.g., when one slave has
408 higher throughput than another.
409
410 The primary option is only valid for active-backup mode.
411
412updelay
413
414 Specifies the time, in milliseconds, to wait before enabling a
415 slave after a link recovery has been detected. This option is
416 only valid for the miimon link monitor. The updelay value
417 should be a multiple of the miimon value; if not, it will be
418 rounded down to the nearest multiple. The default value is 0.
419
420use_carrier
421
422 Specifies whether or not miimon should use MII or ETHTOOL
423 ioctls vs. netif_carrier_ok() to determine the link
424 status. The MII or ETHTOOL ioctls are less efficient and
425 utilize a deprecated calling sequence within the kernel. The
426 netif_carrier_ok() relies on the device driver to maintain its
427 state with netif_carrier_on/off; at this writing, most, but
428 not all, device drivers support this facility.
429
430 If bonding insists that the link is up when it should not be,
431 it may be that your network device driver does not support
432 netif_carrier_on/off. The default state for netif_carrier is
433 "carrier on," so if a driver does not support netif_carrier,
434 it will appear as if the link is always up. In this case,
435 setting use_carrier to 0 will cause bonding to revert to the
436 MII / ETHTOOL ioctl method to determine the link state.
437
438 A value of 1 enables the use of netif_carrier_ok(), a value of
439 0 will use the deprecated MII / ETHTOOL ioctls. The default
440 value is 1.
441
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700442xmit_hash_policy
443
444 Selects the transmit hash policy to use for slave selection in
445 balance-xor and 802.3ad modes. Possible values are:
446
447 layer2
448
449 Uses XOR of hardware MAC addresses to generate the
450 hash. The formula is
451
452 (source MAC XOR destination MAC) modulo slave count
453
454 This algorithm will place all traffic to a particular
455 network peer on the same slave.
456
457 This algorithm is 802.3ad compliant.
458
459 layer3+4
460
461 This policy uses upper layer protocol information,
462 when available, to generate the hash. This allows for
463 traffic to a particular network peer to span multiple
464 slaves, although a single connection will not span
465 multiple slaves.
466
467 The formula for unfragmented TCP and UDP packets is
468
469 ((source port XOR dest port) XOR
470 ((source IP XOR dest IP) AND 0xffff)
471 modulo slave count
472
473 For fragmented TCP or UDP packets and all other IP
474 protocol traffic, the source and destination port
475 information is omitted. For non-IP traffic, the
476 formula is the same as for the layer2 transmit hash
477 policy.
478
479 This policy is intended to mimic the behavior of
480 certain switches, notably Cisco switches with PFC2 as
481 well as some Foundry and IBM products.
482
483 This algorithm is not fully 802.3ad compliant. A
484 single TCP or UDP conversation containing both
485 fragmented and unfragmented packets will see packets
486 striped across two interfaces. This may result in out
487 of order delivery. Most traffic types will not meet
488 this criteria, as TCP rarely fragments traffic, and
489 most UDP traffic is not involved in extended
490 conversations. Other implementations of 802.3ad may
491 or may not tolerate this noncompliance.
492
493 The default value is layer2. This option was added in bonding
494version 2.6.3. In earlier versions of bonding, this parameter does
495not exist, and the layer2 policy is the only policy.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700496
497
4983. Configuring Bonding Devices
499==============================
500
501 There are, essentially, two methods for configuring bonding:
502with support from the distro's network initialization scripts, and
503without. Distros generally use one of two packages for the network
504initialization scripts: initscripts or sysconfig. Recent versions of
505these packages have support for bonding, while older versions do not.
506
507 We will first describe the options for configuring bonding for
508distros using versions of initscripts and sysconfig with full or
509partial support for bonding, then provide information on enabling
510bonding without support from the network initialization scripts (i.e.,
511older versions of initscripts or sysconfig).
512
513 If you're unsure whether your distro uses sysconfig or
514initscripts, or don't know if it's new enough, have no fear.
515Determining this is fairly straightforward.
516
517 First, issue the command:
518
519$ rpm -qf /sbin/ifup
520
521 It will respond with a line of text starting with either
522"initscripts" or "sysconfig," followed by some numbers. This is the
523package that provides your network initialization scripts.
524
525 Next, to determine if your installation supports bonding,
526issue the command:
527
528$ grep ifenslave /sbin/ifup
529
530 If this returns any matches, then your initscripts or
531sysconfig has support for bonding.
532
5333.1 Configuration with sysconfig support
534----------------------------------------
535
536 This section applies to distros using a version of sysconfig
537with bonding support, for example, SuSE Linux Enterprise Server 9.
538
539 SuSE SLES 9's networking configuration system does support
540bonding, however, at this writing, the YaST system configuration
541frontend does not provide any means to work with bonding devices.
542Bonding devices can be managed by hand, however, as follows.
543
544 First, if they have not already been configured, configure the
545slave devices. On SLES 9, this is most easily done by running the
546yast2 sysconfig configuration utility. The goal is for to create an
547ifcfg-id file for each slave device. The simplest way to accomplish
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700548this is to configure the devices for DHCP (this is only to get the
549file ifcfg-id file created; see below for some issues with DHCP). The
550name of the configuration file for each device will be of the form:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551
552ifcfg-id-xx:xx:xx:xx:xx:xx
553
554 Where the "xx" portion will be replaced with the digits from
555the device's permanent MAC address.
556
557 Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
558created, it is necessary to edit the configuration files for the slave
559devices (the MAC addresses correspond to those of the slave devices).
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700560Before editing, the file will contain multiple lines, and will look
Linus Torvalds1da177e2005-04-16 15:20:36 -0700561something like this:
562
563BOOTPROTO='dhcp'
564STARTMODE='on'
565USERCTL='no'
566UNIQUE='XNzu.WeZGOGF+4wE'
567_nm_name='bus-pci-0001:61:01.0'
568
569 Change the BOOTPROTO and STARTMODE lines to the following:
570
571BOOTPROTO='none'
572STARTMODE='off'
573
574 Do not alter the UNIQUE or _nm_name lines. Remove any other
575lines (USERCTL, etc).
576
577 Once the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified,
578it's time to create the configuration file for the bonding device
579itself. This file is named ifcfg-bondX, where X is the number of the
580bonding device to create, starting at 0. The first such file is
581ifcfg-bond0, the second is ifcfg-bond1, and so on. The sysconfig
582network configuration system will correctly start multiple instances
583of bonding.
584
585 The contents of the ifcfg-bondX file is as follows:
586
587BOOTPROTO="static"
588BROADCAST="10.0.2.255"
589IPADDR="10.0.2.10"
590NETMASK="255.255.0.0"
591NETWORK="10.0.2.0"
592REMOTE_IPADDR=""
593STARTMODE="onboot"
594BONDING_MASTER="yes"
595BONDING_MODULE_OPTS="mode=active-backup miimon=100"
596BONDING_SLAVE0="eth0"
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700597BONDING_SLAVE1="bus-pci-0000:06:08.1"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700598
599 Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK
600values with the appropriate values for your network.
601
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 The STARTMODE specifies when the device is brought online.
603The possible values are:
604
605 onboot: The device is started at boot time. If you're not
606 sure, this is probably what you want.
607
608 manual: The device is started only when ifup is called
609 manually. Bonding devices may be configured this
610 way if you do not wish them to start automatically
611 at boot for some reason.
612
613 hotplug: The device is started by a hotplug event. This is not
614 a valid choice for a bonding device.
615
616 off or ignore: The device configuration is ignored.
617
618 The line BONDING_MASTER='yes' indicates that the device is a
619bonding master device. The only useful value is "yes."
620
621 The contents of BONDING_MODULE_OPTS are supplied to the
622instance of the bonding module for this device. Specify the options
623for the bonding mode, link monitoring, and so on here. Do not include
624the max_bonds bonding parameter; this will confuse the configuration
625system if you have multiple bonding devices.
626
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700627 Finally, supply one BONDING_SLAVEn="slave device" for each
628slave. where "n" is an increasing value, one for each slave. The
629"slave device" is either an interface name, e.g., "eth0", or a device
630specifier for the network device. The interface name is easier to
631find, but the ethN names are subject to change at boot time if, e.g.,
632a device early in the sequence has failed. The device specifiers
633(bus-pci-0000:06:08.1 in the example above) specify the physical
634network device, and will not change unless the device's bus location
635changes (for example, it is moved from one PCI slot to another). The
636example above uses one of each type for demonstration purposes; most
637configurations will choose one or the other for all slave devices.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700638
639 When all configuration files have been modified or created,
640networking must be restarted for the configuration changes to take
641effect. This can be accomplished via the following:
642
643# /etc/init.d/network restart
644
645 Note that the network control script (/sbin/ifdown) will
646remove the bonding module as part of the network shutdown processing,
647so it is not necessary to remove the module by hand if, e.g., the
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700648module parameters have changed.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700649
650 Also, at this writing, YaST/YaST2 will not manage bonding
651devices (they do not show bonding interfaces on its list of network
652devices). It is necessary to edit the configuration file by hand to
653change the bonding configuration.
654
655 Additional general options and details of the ifcfg file
656format can be found in an example ifcfg template file:
657
658/etc/sysconfig/network/ifcfg.template
659
660 Note that the template does not document the various BONDING_
661settings described above, but does describe many of the other options.
662
Jay Vosburgh00354cf2005-07-21 12:18:02 -07006633.1.1 Using DHCP with sysconfig
664-------------------------------
665
666 Under sysconfig, configuring a device with BOOTPROTO='dhcp'
667will cause it to query DHCP for its IP address information. At this
668writing, this does not function for bonding devices; the scripts
669attempt to obtain the device address from DHCP prior to adding any of
670the slave devices. Without active slaves, the DHCP requests are not
671sent to the network.
672
6733.1.2 Configuring Multiple Bonds with sysconfig
674-----------------------------------------------
675
676 The sysconfig network initialization system is capable of
677handling multiple bonding devices. All that is necessary is for each
678bonding instance to have an appropriately configured ifcfg-bondX file
679(as described above). Do not specify the "max_bonds" parameter to any
680instance of bonding, as this will confuse sysconfig. If you require
681multiple bonding devices with identical parameters, create multiple
682ifcfg-bondX files.
683
684 Because the sysconfig scripts supply the bonding module
685options in the ifcfg-bondX file, it is not necessary to add them to
686the system /etc/modules.conf or /etc/modprobe.conf configuration file.
687
Linus Torvalds1da177e2005-04-16 15:20:36 -07006883.2 Configuration with initscripts support
689------------------------------------------
690
691 This section applies to distros using a version of initscripts
692with bonding support, for example, Red Hat Linux 9 or Red Hat
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700693Enterprise Linux version 3 or 4. On these systems, the network
Linus Torvalds1da177e2005-04-16 15:20:36 -0700694initialization scripts have some knowledge of bonding, and can be
695configured to control bonding devices.
696
697 These distros will not automatically load the network adapter
698driver unless the ethX device is configured with an IP address.
699Because of this constraint, users must manually configure a
700network-script file for all physical adapters that will be members of
701a bondX link. Network script files are located in the directory:
702
703/etc/sysconfig/network-scripts
704
705 The file name must be prefixed with "ifcfg-eth" and suffixed
706with the adapter's physical adapter number. For example, the script
707for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.
708Place the following text in the file:
709
710DEVICE=eth0
711USERCTL=no
712ONBOOT=yes
713MASTER=bond0
714SLAVE=yes
715BOOTPROTO=none
716
717 The DEVICE= line will be different for every ethX device and
718must correspond with the name of the file, i.e., ifcfg-eth1 must have
719a device line of DEVICE=eth1. The setting of the MASTER= line will
720also depend on the final bonding interface name chosen for your bond.
721As with other network devices, these typically start at 0, and go up
722one for each device, i.e., the first bonding instance is bond0, the
723second is bond1, and so on.
724
725 Next, create a bond network script. The file name for this
726script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is
727the number of the bond. For bond0 the file is named "ifcfg-bond0",
728for bond1 it is named "ifcfg-bond1", and so on. Within that file,
729place the following text:
730
731DEVICE=bond0
732IPADDR=192.168.1.1
733NETMASK=255.255.255.0
734NETWORK=192.168.1.0
735BROADCAST=192.168.1.255
736ONBOOT=yes
737BOOTPROTO=none
738USERCTL=no
739
740 Be sure to change the networking specific lines (IPADDR,
741NETMASK, NETWORK and BROADCAST) to match your network configuration.
742
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700743 Finally, it is necessary to edit /etc/modules.conf (or
744/etc/modprobe.conf, depending upon your distro) to load the bonding
745module with your desired options when the bond0 interface is brought
746up. The following lines in /etc/modules.conf (or modprobe.conf) will
747load the bonding module, and select its options:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748
749alias bond0 bonding
750options bond0 mode=balance-alb miimon=100
751
752 Replace the sample parameters with the appropriate set of
753options for your configuration.
754
755 Finally run "/etc/rc.d/init.d/network restart" as root. This
756will restart the networking subsystem and your bond link should be now
757up and running.
758
Jay Vosburgh00354cf2005-07-21 12:18:02 -07007593.2.1 Using DHCP with initscripts
760---------------------------------
761
762 Recent versions of initscripts (the version supplied with
763Fedora Core 3 and Red Hat Enterprise Linux 4 is reported to work) do
764have support for assigning IP information to bonding devices via DHCP.
765
766 To configure bonding for DHCP, configure it as described
767above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp"
768and add a line consisting of "TYPE=Bonding". Note that the TYPE value
769is case sensitive.
770
7713.2.2 Configuring Multiple Bonds with initscripts
772-------------------------------------------------
773
774 At this writing, the initscripts package does not directly
775support loading the bonding driver multiple times, so the process for
776doing so is the same as described in the "Configuring Multiple Bonds
777Manually" section, below.
778
779 NOTE: It has been observed that some Red Hat supplied kernels
John W. Linville4cac0182005-10-18 21:30:59 -0400780are apparently unable to rename modules at load time (the "-o bond1"
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700781part). Attempts to pass that option to modprobe will produce an
782"Operation not permitted" error. This has been reported on some
783Fedora Core kernels, and has been seen on RHEL 4 as well. On kernels
784exhibiting this problem, it will be impossible to configure multiple
785bonds with differing parameters.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786
7873.3 Configuring Bonding Manually
788--------------------------------
789
790 This section applies to distros whose network initialization
791scripts (the sysconfig or initscripts package) do not have specific
792knowledge of bonding. One such distro is SuSE Linux Enterprise Server
793version 8.
794
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700795 The general method for these systems is to place the bonding
796module parameters into /etc/modules.conf or /etc/modprobe.conf (as
797appropriate for the installed distro), then add modprobe and/or
798ifenslave commands to the system's global init script. The name of
799the global init script differs; for sysconfig, it is
Linus Torvalds1da177e2005-04-16 15:20:36 -0700800/etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
801
802 For example, if you wanted to make a simple bond of two e100
803devices (presumed to be eth0 and eth1), and have it persist across
804reboots, edit the appropriate file (/etc/init.d/boot.local or
805/etc/rc.d/rc.local), and add the following:
806
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700807modprobe bonding mode=balance-alb miimon=100
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808modprobe e100
809ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
810ifenslave bond0 eth0
811ifenslave bond0 eth1
812
813 Replace the example bonding module parameters and bond0
814network configuration (IP address, netmask, etc) with the appropriate
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700815values for your configuration.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700816
817 Unfortunately, this method will not provide support for the
818ifup and ifdown scripts on the bond devices. To reload the bonding
819configuration, it is necessary to run the initialization script, e.g.,
820
821# /etc/init.d/boot.local
822
823 or
824
825# /etc/rc.d/rc.local
826
827 It may be desirable in such a case to create a separate script
828which only initializes the bonding configuration, then call that
829separate script from within boot.local. This allows for bonding to be
830enabled without re-running the entire global init script.
831
832 To shut down the bonding devices, it is necessary to first
833mark the bonding device itself as being down, then remove the
834appropriate device driver modules. For our example above, you can do
835the following:
836
837# ifconfig bond0 down
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700838# rmmod bonding
Linus Torvalds1da177e2005-04-16 15:20:36 -0700839# rmmod e100
840
841 Again, for convenience, it may be desirable to create a script
842with these commands.
843
844
Jay Vosburgh00354cf2005-07-21 12:18:02 -07008453.3.1 Configuring Multiple Bonds Manually
846-----------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847
848 This section contains information on configuring multiple
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700849bonding devices with differing options for those systems whose network
850initialization scripts lack support for configuring multiple bonds.
851
852 If you require multiple bonding devices, but all with the same
853options, you may wish to use the "max_bonds" module parameter,
854documented above.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700855
856 To create multiple bonding devices with differing options, it
857is necessary to load the bonding driver multiple times. Note that
858current versions of the sysconfig network initialization scripts
859handle this automatically; if your distro uses these scripts, no
860special action is needed. See the section Configuring Bonding
861Devices, above, if you're not sure about your network initialization
862scripts.
863
864 To load multiple instances of the module, it is necessary to
865specify a different name for each instance (the module loading system
866requires that every loaded module, even multiple instances of the same
867module, have a unique name). This is accomplished by supplying
868multiple sets of bonding options in /etc/modprobe.conf, for example:
869
870alias bond0 bonding
871options bond0 -o bond0 mode=balance-rr miimon=100
872
873alias bond1 bonding
874options bond1 -o bond1 mode=balance-alb miimon=50
875
876 will load the bonding module two times. The first instance is
877named "bond0" and creates the bond0 device in balance-rr mode with an
878miimon of 100. The second instance is named "bond1" and creates the
879bond1 device in balance-alb mode with an miimon of 50.
880
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700881 In some circumstances (typically with older distributions),
882the above does not work, and the second bonding instance never sees
883its options. In that case, the second options line can be substituted
884as follows:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885
John W. Linville4cac0182005-10-18 21:30:59 -0400886install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
887 mode=balance-alb miimon=50
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700888
889 This may be repeated any number of times, specifying a new and
890unique name in place of bond1 for each subsequent instance.
891
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892
8935. Querying Bonding Configuration
894=================================
895
8965.1 Bonding Configuration
897-------------------------
898
899 Each bonding device has a read-only file residing in the
900/proc/net/bonding directory. The file contents include information
901about the bonding configuration, options and state of each slave.
902
903 For example, the contents of /proc/net/bonding/bond0 after the
904driver is loaded with parameters of mode=0 and miimon=1000 is
905generally as follows:
906
907 Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
908 Bonding Mode: load balancing (round-robin)
909 Currently Active Slave: eth0
910 MII Status: up
911 MII Polling Interval (ms): 1000
912 Up Delay (ms): 0
913 Down Delay (ms): 0
914
915 Slave Interface: eth1
916 MII Status: up
917 Link Failure Count: 1
918
919 Slave Interface: eth0
920 MII Status: up
921 Link Failure Count: 1
922
923 The precise format and contents will change depending upon the
924bonding configuration, state, and version of the bonding driver.
925
9265.2 Network configuration
927-------------------------
928
929 The network configuration can be inspected using the ifconfig
930command. Bonding devices will have the MASTER flag set; Bonding slave
931devices will have the SLAVE flag set. The ifconfig output does not
932contain information on which slaves are associated with which masters.
933
934 In the example below, the bond0 interface is the master
935(MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of
936bond0 have the same MAC address (HWaddr) as bond0 for all modes except
937TLB and ALB that require a unique MAC address for each slave.
938
939# /sbin/ifconfig
940bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
941 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
942 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
943 RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
944 TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
945 collisions:0 txqueuelen:0
946
947eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
948 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
949 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
950 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
951 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
952 collisions:0 txqueuelen:100
953 Interrupt:10 Base address:0x1080
954
955eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
956 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
957 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
958 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
959 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
960 collisions:0 txqueuelen:100
961 Interrupt:9 Base address:0x1400
962
9636. Switch Configuration
964=======================
965
966 For this section, "switch" refers to whatever system the
967bonded devices are directly connected to (i.e., where the other end of
968the cable plugs into). This may be an actual dedicated switch device,
969or it may be another regular system (e.g., another computer running
970Linux),
971
972 The active-backup, balance-tlb and balance-alb modes do not
973require any specific configuration of the switch.
974
975 The 802.3ad mode requires that the switch have the appropriate
976ports configured as an 802.3ad aggregation. The precise method used
977to configure this varies from switch to switch, but, for example, a
978Cisco 3550 series switch requires that the appropriate ports first be
979grouped together in a single etherchannel instance, then that
980etherchannel is set to mode "lacp" to enable 802.3ad (instead of
981standard EtherChannel).
982
983 The balance-rr, balance-xor and broadcast modes generally
984require that the switch have the appropriate ports grouped together.
985The nomenclature for such a group differs between switches, it may be
986called an "etherchannel" (as in the Cisco example, above), a "trunk
987group" or some other similar variation. For these modes, each switch
988will also have its own configuration options for the switch's transmit
989policy to the bond. Typical choices include XOR of either the MAC or
990IP addresses. The transmit policy of the two peers does not need to
991match. For these three modes, the bonding mode really selects a
992transmit policy for an EtherChannel group; all three will interoperate
993with another EtherChannel group.
994
995
9967. 802.1q VLAN Support
997======================
998
999 It is possible to configure VLAN devices over a bond interface
1000using the 8021q driver. However, only packets coming from the 8021q
1001driver and passing through bonding will be tagged by default. Self
1002generated packets, for example, bonding's learning packets or ARP
1003packets generated by either ALB mode or the ARP monitor mechanism, are
1004tagged internally by bonding itself. As a result, bonding must
1005"learn" the VLAN IDs configured above it, and use those IDs to tag
1006self generated packets.
1007
1008 For reasons of simplicity, and to support the use of adapters
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001009that can do VLAN hardware acceleration offloading, the bonding
1010interface declares itself as fully hardware offloading capable, it gets
Linus Torvalds1da177e2005-04-16 15:20:36 -07001011the add_vid/kill_vid notifications to gather the necessary
1012information, and it propagates those actions to the slaves. In case
1013of mixed adapter types, hardware accelerated tagged packets that
1014should go through an adapter that is not offloading capable are
1015"un-accelerated" by the bonding driver so the VLAN tag sits in the
1016regular location.
1017
1018 VLAN interfaces *must* be added on top of a bonding interface
1019only after enslaving at least one slave. The bonding interface has a
1020hardware address of 00:00:00:00:00:00 until the first slave is added.
1021If the VLAN interface is created prior to the first enslavement, it
1022would pick up the all-zeroes hardware address. Once the first slave
1023is attached to the bond, the bond device itself will pick up the
1024slave's hardware address, which is then available for the VLAN device.
1025
1026 Also, be aware that a similar problem can occur if all slaves
1027are released from a bond that still has one or more VLAN interfaces on
1028top of it. When a new slave is added, the bonding interface will
1029obtain its hardware address from the first slave, which might not
1030match the hardware address of the VLAN interfaces (which was
1031ultimately copied from an earlier slave).
1032
1033 There are two methods to insure that the VLAN device operates
1034with the correct hardware address if all slaves are removed from a
1035bond interface:
1036
1037 1. Remove all VLAN interfaces then recreate them
1038
1039 2. Set the bonding interface's hardware address so that it
1040matches the hardware address of the VLAN interfaces.
1041
1042 Note that changing a VLAN interface's HW address would set the
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001043underlying device -- i.e. the bonding interface -- to promiscuous
Linus Torvalds1da177e2005-04-16 15:20:36 -07001044mode, which might not be what you want.
1045
1046
10478. Link Monitoring
1048==================
1049
1050 The bonding driver at present supports two schemes for
1051monitoring a slave device's link state: the ARP monitor and the MII
1052monitor.
1053
1054 At the present time, due to implementation restrictions in the
1055bonding driver itself, it is not possible to enable both ARP and MII
1056monitoring simultaneously.
1057
10588.1 ARP Monitor Operation
1059-------------------------
1060
1061 The ARP monitor operates as its name suggests: it sends ARP
1062queries to one or more designated peer systems on the network, and
1063uses the response as an indication that the link is operating. This
1064gives some assurance that traffic is actually flowing to and from one
1065or more peers on the local network.
1066
1067 The ARP monitor relies on the device driver itself to verify
1068that traffic is flowing. In particular, the driver must keep up to
1069date the last receive time, dev->last_rx, and transmit start time,
1070dev->trans_start. If these are not updated by the driver, then the
1071ARP monitor will immediately fail any slaves using that driver, and
1072those slaves will stay down. If networking monitoring (tcpdump, etc)
1073shows the ARP requests and replies on the network, then it may be that
1074your device driver is not updating last_rx and trans_start.
1075
10768.2 Configuring Multiple ARP Targets
1077------------------------------------
1078
1079 While ARP monitoring can be done with just one target, it can
1080be useful in a High Availability setup to have several targets to
1081monitor. In the case of just one target, the target itself may go
1082down or have a problem making it unresponsive to ARP requests. Having
1083an additional target (or several) increases the reliability of the ARP
1084monitoring.
1085
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001086 Multiple ARP targets must be separated by commas as follows:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001087
1088# example options for ARP monitoring with three targets
1089alias bond0 bonding
1090options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
1091
1092 For just a single target the options would resemble:
1093
1094# example options for ARP monitoring with one target
1095alias bond0 bonding
1096options bond0 arp_interval=60 arp_ip_target=192.168.0.100
1097
1098
10998.3 MII Monitor Operation
1100-------------------------
1101
1102 The MII monitor monitors only the carrier state of the local
1103network interface. It accomplishes this in one of three ways: by
1104depending upon the device driver to maintain its carrier state, by
1105querying the device's MII registers, or by making an ethtool query to
1106the device.
1107
1108 If the use_carrier module parameter is 1 (the default value),
1109then the MII monitor will rely on the driver for carrier state
1110information (via the netif_carrier subsystem). As explained in the
1111use_carrier parameter information, above, if the MII monitor fails to
1112detect carrier loss on the device (e.g., when the cable is physically
1113disconnected), it may be that the driver does not support
1114netif_carrier.
1115
1116 If use_carrier is 0, then the MII monitor will first query the
1117device's (via ioctl) MII registers and check the link state. If that
1118request fails (not just that it returns carrier down), then the MII
1119monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain
1120the same information. If both methods fail (i.e., the driver either
1121does not support or had some error in processing both the MII register
1122and ethtool requests), then the MII monitor will assume the link is
1123up.
1124
11259. Potential Sources of Trouble
1126===============================
1127
11289.1 Adventures in Routing
1129-------------------------
1130
1131 When bonding is configured, it is important that the slave
1132devices not have routes that supercede routes of the master (or,
1133generally, not have routes at all). For example, suppose the bonding
1134device bond0 has two slaves, eth0 and eth1, and the routing table is
1135as follows:
1136
1137Kernel IP routing table
1138Destination Gateway Genmask Flags MSS Window irtt Iface
113910.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth0
114010.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth1
114110.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 bond0
1142127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
1143
1144 This routing configuration will likely still update the
1145receive/transmit times in the driver (needed by the ARP monitor), but
1146may bypass the bonding driver (because outgoing traffic to, in this
1147case, another host on network 10 would use eth0 or eth1 before bond0).
1148
1149 The ARP monitor (and ARP itself) may become confused by this
1150configuration, because ARP requests (generated by the ARP monitor)
1151will be sent on one interface (bond0), but the corresponding reply
1152will arrive on a different interface (eth0). This reply looks to ARP
1153as an unsolicited ARP reply (because ARP matches replies on an
1154interface basis), and is discarded. The MII monitor is not affected
1155by the state of the routing table.
1156
1157 The solution here is simply to insure that slaves do not have
1158routes of their own, and if for some reason they must, those routes do
1159not supercede routes of their master. This should generally be the
1160case, but unusual configurations or errant manual or automatic static
1161route additions may cause trouble.
1162
11639.2 Ethernet Device Renaming
1164----------------------------
1165
1166 On systems with network configuration scripts that do not
1167associate physical devices directly with network interface names (so
1168that the same physical device always has the same "ethX" name), it may
1169be necessary to add some special logic to either /etc/modules.conf or
1170/etc/modprobe.conf (depending upon which is installed on the system).
1171
1172 For example, given a modules.conf containing the following:
1173
1174alias bond0 bonding
1175options bond0 mode=some-mode miimon=50
1176alias eth0 tg3
1177alias eth1 tg3
1178alias eth2 e1000
1179alias eth3 e1000
1180
1181 If neither eth0 and eth1 are slaves to bond0, then when the
1182bond0 interface comes up, the devices may end up reordered. This
1183happens because bonding is loaded first, then its slave device's
1184drivers are loaded next. Since no other drivers have been loaded,
1185when the e1000 driver loads, it will receive eth0 and eth1 for its
1186devices, but the bonding configuration tries to enslave eth2 and eth3
1187(which may later be assigned to the tg3 devices).
1188
1189 Adding the following:
1190
1191add above bonding e1000 tg3
1192
1193 causes modprobe to load e1000 then tg3, in that order, when
1194bonding is loaded. This command is fully documented in the
1195modules.conf manual page.
1196
1197 On systems utilizing modprobe.conf (or modprobe.conf.local),
1198an equivalent problem can occur. In this case, the following can be
1199added to modprobe.conf (or modprobe.conf.local, as appropriate), as
1200follows (all on one line; it has been split here for clarity):
1201
1202install bonding /sbin/modprobe tg3; /sbin/modprobe e1000;
1203 /sbin/modprobe --ignore-install bonding
1204
1205 This will, when loading the bonding module, rather than
1206performing the normal action, instead execute the provided command.
1207This command loads the device drivers in the order needed, then calls
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001208modprobe with --ignore-install to cause the normal action to then take
Linus Torvalds1da177e2005-04-16 15:20:36 -07001209place. Full documentation on this can be found in the modprobe.conf
1210and modprobe manual pages.
1211
12129.3. Painfully Slow Or No Failed Link Detection By Miimon
1213---------------------------------------------------------
1214
1215 By default, bonding enables the use_carrier option, which
1216instructs bonding to trust the driver to maintain carrier state.
1217
1218 As discussed in the options section, above, some drivers do
1219not support the netif_carrier_on/_off link state tracking system.
1220With use_carrier enabled, bonding will always see these links as up,
1221regardless of their actual state.
1222
1223 Additionally, other drivers do support netif_carrier, but do
1224not maintain it in real time, e.g., only polling the link state at
1225some fixed interval. In this case, miimon will detect failures, but
1226only after some long period of time has expired. If it appears that
1227miimon is very slow in detecting link failures, try specifying
1228use_carrier=0 to see if that improves the failure detection time. If
1229it does, then it may be that the driver checks the carrier state at a
1230fixed interval, but does not cache the MII register values (so the
1231use_carrier=0 method of querying the registers directly works). If
1232use_carrier=0 does not improve the failover, then the driver may cache
1233the registers, or the problem may be elsewhere.
1234
1235 Also, remember that miimon only checks for the device's
1236carrier state. It has no way to determine the state of devices on or
1237beyond other ports of a switch, or if a switch is refusing to pass
1238traffic while still maintaining carrier on.
1239
124010. SNMP agents
1241===============
1242
1243 If running SNMP agents, the bonding driver should be loaded
1244before any network drivers participating in a bond. This requirement
Tobias Klauserd533f672005-09-10 00:26:46 -07001245is due to the interface index (ipAdEntIfIndex) being associated to
Linus Torvalds1da177e2005-04-16 15:20:36 -07001246the first interface found with a given IP address. That is, there is
1247only one ipAdEntIfIndex for each IP address. For example, if eth0 and
1248eth1 are slaves of bond0 and the driver for eth0 is loaded before the
1249bonding driver, the interface for the IP address will be associated
1250with the eth0 interface. This configuration is shown below, the IP
1251address 192.168.1.1 has an interface index of 2 which indexes to eth0
1252in the ifDescr table (ifDescr.2).
1253
1254 interfaces.ifTable.ifEntry.ifDescr.1 = lo
1255 interfaces.ifTable.ifEntry.ifDescr.2 = eth0
1256 interfaces.ifTable.ifEntry.ifDescr.3 = eth1
1257 interfaces.ifTable.ifEntry.ifDescr.4 = eth2
1258 interfaces.ifTable.ifEntry.ifDescr.5 = eth3
1259 interfaces.ifTable.ifEntry.ifDescr.6 = bond0
1260 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
1261 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
1262 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
1263 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
1264
1265 This problem is avoided by loading the bonding driver before
1266any network drivers participating in a bond. Below is an example of
1267loading the bonding driver first, the IP address 192.168.1.1 is
1268correctly associated with ifDescr.2.
1269
1270 interfaces.ifTable.ifEntry.ifDescr.1 = lo
1271 interfaces.ifTable.ifEntry.ifDescr.2 = bond0
1272 interfaces.ifTable.ifEntry.ifDescr.3 = eth0
1273 interfaces.ifTable.ifEntry.ifDescr.4 = eth1
1274 interfaces.ifTable.ifEntry.ifDescr.5 = eth2
1275 interfaces.ifTable.ifEntry.ifDescr.6 = eth3
1276 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
1277 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
1278 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
1279 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
1280
1281 While some distributions may not report the interface name in
1282ifDescr, the association between the IP address and IfIndex remains
1283and SNMP functions such as Interface_Scan_Next will report that
1284association.
1285
128611. Promiscuous mode
1287====================
1288
1289 When running network monitoring tools, e.g., tcpdump, it is
1290common to enable promiscuous mode on the device, so that all traffic
1291is seen (instead of seeing only traffic destined for the local host).
1292The bonding driver handles promiscuous mode changes to the bonding
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001293master device (e.g., bond0), and propagates the setting to the slave
Linus Torvalds1da177e2005-04-16 15:20:36 -07001294devices.
1295
1296 For the balance-rr, balance-xor, broadcast, and 802.3ad modes,
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001297the promiscuous mode setting is propagated to all slaves.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001298
1299 For the active-backup, balance-tlb and balance-alb modes, the
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001300promiscuous mode setting is propagated only to the active slave.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001301
1302 For balance-tlb mode, the active slave is the slave currently
1303receiving inbound traffic.
1304
1305 For balance-alb mode, the active slave is the slave used as a
1306"primary." This slave is used for mode-specific control traffic, for
1307sending to peers that are unassigned or if the load is unbalanced.
1308
1309 For the active-backup, balance-tlb and balance-alb modes, when
1310the active slave changes (e.g., due to a link failure), the
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001311promiscuous setting will be propagated to the new active slave.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001312
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700131312. Configuring Bonding for High Availability
1314=============================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001315
1316 High Availability refers to configurations that provide
1317maximum network availability by having redundant or backup devices,
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001318links or switches between the host and the rest of the world. The
1319goal is to provide the maximum availability of network connectivity
1320(i.e., the network always works), even though other configurations
1321could provide higher throughput.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001322
132312.1 High Availability in a Single Switch Topology
1324--------------------------------------------------
1325
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001326 If two hosts (or a host and a single switch) are directly
1327connected via multiple physical links, then there is no availability
1328penalty to optimizing for maximum bandwidth. In this case, there is
1329only one switch (or peer), so if it fails, there is no alternative
1330access to fail over to. Additionally, the bonding load balance modes
1331support link monitoring of their members, so if individual links fail,
1332the load will be rebalanced across the remaining devices.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001333
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001334 See Section 13, "Configuring Bonding for Maximum Throughput"
1335for information on configuring bonding with one peer device.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001336
133712.2 High Availability in a Multiple Switch Topology
1338----------------------------------------------------
1339
1340 With multiple switches, the configuration of bonding and the
1341network changes dramatically. In multiple switch topologies, there is
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001342a trade off between network availability and usable bandwidth.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001343
1344 Below is a sample network, configured to maximize the
1345availability of the network:
1346
1347 | |
1348 |port3 port3|
1349 +-----+----+ +-----+----+
1350 | |port2 ISL port2| |
1351 | switch A +--------------------------+ switch B |
1352 | | | |
1353 +-----+----+ +-----++---+
1354 |port1 port1|
1355 | +-------+ |
1356 +-------------+ host1 +---------------+
1357 eth0 +-------+ eth1
1358
1359 In this configuration, there is a link between the two
1360switches (ISL, or inter switch link), and multiple ports connecting to
1361the outside world ("port3" on each switch). There is no technical
1362reason that this could not be extended to a third switch.
1363
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700136412.2.1 HA Bonding Mode Selection for Multiple Switch Topology
1365-------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001366
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001367 In a topology such as the example above, the active-backup and
1368broadcast modes are the only useful bonding modes when optimizing for
1369availability; the other modes require all links to terminate on the
1370same peer for them to behave rationally.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001371
1372active-backup: This is generally the preferred mode, particularly if
1373 the switches have an ISL and play together well. If the
1374 network configuration is such that one switch is specifically
1375 a backup switch (e.g., has lower capacity, higher cost, etc),
1376 then the primary option can be used to insure that the
1377 preferred link is always used when it is available.
1378
1379broadcast: This mode is really a special purpose mode, and is suitable
1380 only for very specific needs. For example, if the two
1381 switches are not connected (no ISL), and the networks beyond
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001382 them are totally independent. In this case, if it is
Linus Torvalds1da177e2005-04-16 15:20:36 -07001383 necessary for some specific one-way traffic to reach both
1384 independent networks, then the broadcast mode may be suitable.
1385
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700138612.2.2 HA Link Monitoring Selection for Multiple Switch Topology
1387----------------------------------------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001388
1389 The choice of link monitoring ultimately depends upon your
1390switch. If the switch can reliably fail ports in response to other
1391failures, then either the MII or ARP monitors should work. For
1392example, in the above example, if the "port3" link fails at the remote
1393end, the MII monitor has no direct means to detect this. The ARP
1394monitor could be configured with a target at the remote end of port3,
1395thus detecting that failure without switch support.
1396
1397 In general, however, in a multiple switch topology, the ARP
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001398monitor can provide a higher level of reliability in detecting end to
1399end connectivity failures (which may be caused by the failure of any
1400individual component to pass traffic for any reason). Additionally,
1401the ARP monitor should be configured with multiple targets (at least
1402one for each switch in the network). This will insure that,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001403regardless of which switch is active, the ARP monitor has a suitable
1404target to query.
1405
1406
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700140713. Configuring Bonding for Maximum Throughput
1408==============================================
Linus Torvalds1da177e2005-04-16 15:20:36 -07001409
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700141013.1 Maximizing Throughput in a Single Switch Topology
1411------------------------------------------------------
1412
1413 In a single switch configuration, the best method to maximize
1414throughput depends upon the application and network environment. The
1415various load balancing modes each have strengths and weaknesses in
1416different environments, as detailed below.
1417
1418 For this discussion, we will break down the topologies into
1419two categories. Depending upon the destination of most traffic, we
1420categorize them into either "gatewayed" or "local" configurations.
1421
1422 In a gatewayed configuration, the "switch" is acting primarily
1423as a router, and the majority of traffic passes through this router to
1424other networks. An example would be the following:
1425
1426
1427 +----------+ +----------+
1428 | |eth0 port1| | to other networks
1429 | Host A +---------------------+ router +------------------->
1430 | +---------------------+ | Hosts B and C are out
1431 | |eth1 port2| | here somewhere
1432 +----------+ +----------+
1433
1434 The router may be a dedicated router device, or another host
1435acting as a gateway. For our discussion, the important point is that
1436the majority of traffic from Host A will pass through the router to
1437some other network before reaching its final destination.
1438
1439 In a gatewayed network configuration, although Host A may
1440communicate with many other systems, all of its traffic will be sent
1441and received via one other peer on the local network, the router.
1442
1443 Note that the case of two systems connected directly via
1444multiple physical links is, for purposes of configuring bonding, the
1445same as a gatewayed configuration. In that case, it happens that all
1446traffic is destined for the "gateway" itself, not some other network
1447beyond the gateway.
1448
1449 In a local configuration, the "switch" is acting primarily as
1450a switch, and the majority of traffic passes through this switch to
1451reach other stations on the same network. An example would be the
1452following:
1453
1454 +----------+ +----------+ +--------+
1455 | |eth0 port1| +-------+ Host B |
1456 | Host A +------------+ switch |port3 +--------+
1457 | +------------+ | +--------+
1458 | |eth1 port2| +------------------+ Host C |
1459 +----------+ +----------+port4 +--------+
1460
1461
1462 Again, the switch may be a dedicated switch device, or another
1463host acting as a gateway. For our discussion, the important point is
1464that the majority of traffic from Host A is destined for other hosts
1465on the same local network (Hosts B and C in the above example).
1466
1467 In summary, in a gatewayed configuration, traffic to and from
1468the bonded device will be to the same MAC level peer on the network
1469(the gateway itself, i.e., the router), regardless of its final
1470destination. In a local configuration, traffic flows directly to and
1471from the final destinations, thus, each destination (Host B, Host C)
1472will be addressed directly by their individual MAC addresses.
1473
1474 This distinction between a gatewayed and a local network
1475configuration is important because many of the load balancing modes
1476available use the MAC addresses of the local network source and
1477destination to make load balancing decisions. The behavior of each
1478mode is described below.
1479
1480
148113.1.1 MT Bonding Mode Selection for Single Switch Topology
1482-----------------------------------------------------------
1483
1484 This configuration is the easiest to set up and to understand,
1485although you will have to decide which bonding mode best suits your
1486needs. The trade offs for each mode are detailed below:
1487
1488balance-rr: This mode is the only mode that will permit a single
1489 TCP/IP connection to stripe traffic across multiple
1490 interfaces. It is therefore the only mode that will allow a
1491 single TCP/IP stream to utilize more than one interface's
1492 worth of throughput. This comes at a cost, however: the
1493 striping often results in peer systems receiving packets out
1494 of order, causing TCP/IP's congestion control system to kick
1495 in, often by retransmitting segments.
1496
1497 It is possible to adjust TCP/IP's congestion limits by
1498 altering the net.ipv4.tcp_reordering sysctl parameter. The
1499 usual default value is 3, and the maximum useful value is 127.
1500 For a four interface balance-rr bond, expect that a single
1501 TCP/IP stream will utilize no more than approximately 2.3
1502 interface's worth of throughput, even after adjusting
1503 tcp_reordering.
1504
1505 Note that this out of order delivery occurs when both the
1506 sending and receiving systems are utilizing a multiple
1507 interface bond. Consider a configuration in which a
1508 balance-rr bond feeds into a single higher capacity network
1509 channel (e.g., multiple 100Mb/sec ethernets feeding a single
1510 gigabit ethernet via an etherchannel capable switch). In this
1511 configuration, traffic sent from the multiple 100Mb devices to
1512 a destination connected to the gigabit device will not see
1513 packets out of order. However, traffic sent from the gigabit
1514 device to the multiple 100Mb devices may or may not see
1515 traffic out of order, depending upon the balance policy of the
1516 switch. Many switches do not support any modes that stripe
1517 traffic (instead choosing a port based upon IP or MAC level
1518 addresses); for those devices, traffic flowing from the
1519 gigabit device to the many 100Mb devices will only utilize one
1520 interface.
1521
1522 If you are utilizing protocols other than TCP/IP, UDP for
1523 example, and your application can tolerate out of order
1524 delivery, then this mode can allow for single stream datagram
1525 performance that scales near linearly as interfaces are added
1526 to the bond.
1527
1528 This mode requires the switch to have the appropriate ports
1529 configured for "etherchannel" or "trunking."
1530
1531active-backup: There is not much advantage in this network topology to
1532 the active-backup mode, as the inactive backup devices are all
1533 connected to the same peer as the primary. In this case, a
1534 load balancing mode (with link monitoring) will provide the
1535 same level of network availability, but with increased
1536 available bandwidth. On the plus side, active-backup mode
1537 does not require any configuration of the switch, so it may
1538 have value if the hardware available does not support any of
1539 the load balance modes.
1540
1541balance-xor: This mode will limit traffic such that packets destined
1542 for specific peers will always be sent over the same
1543 interface. Since the destination is determined by the MAC
1544 addresses involved, this mode works best in a "local" network
1545 configuration (as described above), with destinations all on
1546 the same local network. This mode is likely to be suboptimal
1547 if all your traffic is passed through a single router (i.e., a
1548 "gatewayed" network configuration, as described above).
1549
1550 As with balance-rr, the switch ports need to be configured for
1551 "etherchannel" or "trunking."
1552
1553broadcast: Like active-backup, there is not much advantage to this
1554 mode in this type of network topology.
1555
1556802.3ad: This mode can be a good choice for this type of network
1557 topology. The 802.3ad mode is an IEEE standard, so all peers
1558 that implement 802.3ad should interoperate well. The 802.3ad
1559 protocol includes automatic configuration of the aggregates,
1560 so minimal manual configuration of the switch is needed
1561 (typically only to designate that some set of devices is
1562 available for 802.3ad). The 802.3ad standard also mandates
1563 that frames be delivered in order (within certain limits), so
1564 in general single connections will not see misordering of
1565 packets. The 802.3ad mode does have some drawbacks: the
1566 standard mandates that all devices in the aggregate operate at
1567 the same speed and duplex. Also, as with all bonding load
1568 balance modes other than balance-rr, no single connection will
1569 be able to utilize more than a single interface's worth of
1570 bandwidth.
1571
1572 Additionally, the linux bonding 802.3ad implementation
1573 distributes traffic by peer (using an XOR of MAC addresses),
1574 so in a "gatewayed" configuration, all outgoing traffic will
1575 generally use the same device. Incoming traffic may also end
1576 up on a single device, but that is dependent upon the
1577 balancing policy of the peer's 8023.ad implementation. In a
1578 "local" configuration, traffic will be distributed across the
1579 devices in the bond.
1580
1581 Finally, the 802.3ad mode mandates the use of the MII monitor,
1582 therefore, the ARP monitor is not available in this mode.
1583
1584balance-tlb: The balance-tlb mode balances outgoing traffic by peer.
1585 Since the balancing is done according to MAC address, in a
1586 "gatewayed" configuration (as described above), this mode will
1587 send all traffic across a single device. However, in a
1588 "local" network configuration, this mode balances multiple
1589 local network peers across devices in a vaguely intelligent
1590 manner (not a simple XOR as in balance-xor or 802.3ad mode),
1591 so that mathematically unlucky MAC addresses (i.e., ones that
1592 XOR to the same value) will not all "bunch up" on a single
1593 interface.
1594
1595 Unlike 802.3ad, interfaces may be of differing speeds, and no
1596 special switch configuration is required. On the down side,
1597 in this mode all incoming traffic arrives over a single
1598 interface, this mode requires certain ethtool support in the
1599 network device driver of the slave interfaces, and the ARP
1600 monitor is not available.
1601
1602balance-alb: This mode is everything that balance-tlb is, and more.
1603 It has all of the features (and restrictions) of balance-tlb,
1604 and will also balance incoming traffic from local network
1605 peers (as described in the Bonding Module Options section,
1606 above).
1607
1608 The only additional down side to this mode is that the network
1609 device driver must support changing the hardware address while
1610 the device is open.
1611
161213.1.2 MT Link Monitoring for Single Switch Topology
1613----------------------------------------------------
1614
1615 The choice of link monitoring may largely depend upon which
1616mode you choose to use. The more advanced load balancing modes do not
1617support the use of the ARP monitor, and are thus restricted to using
1618the MII monitor (which does not provide as high a level of end to end
1619assurance as the ARP monitor).
1620
162113.2 Maximum Throughput in a Multiple Switch Topology
1622-----------------------------------------------------
1623
1624 Multiple switches may be utilized to optimize for throughput
1625when they are configured in parallel as part of an isolated network
1626between two or more systems, for example:
1627
1628 +-----------+
1629 | Host A |
1630 +-+---+---+-+
1631 | | |
1632 +--------+ | +---------+
1633 | | |
1634 +------+---+ +-----+----+ +-----+----+
1635 | Switch A | | Switch B | | Switch C |
1636 +------+---+ +-----+----+ +-----+----+
1637 | | |
1638 +--------+ | +---------+
1639 | | |
1640 +-+---+---+-+
1641 | Host B |
1642 +-----------+
1643
1644 In this configuration, the switches are isolated from one
1645another. One reason to employ a topology such as this is for an
1646isolated network with many hosts (a cluster configured for high
1647performance, for example), using multiple smaller switches can be more
1648cost effective than a single larger switch, e.g., on a network with 24
1649hosts, three 24 port switches can be significantly less expensive than
1650a single 72 port switch.
1651
1652 If access beyond the network is required, an individual host
1653can be equipped with an additional network device connected to an
1654external network; this host then additionally acts as a gateway.
1655
165613.2.1 MT Bonding Mode Selection for Multiple Switch Topology
1657-------------------------------------------------------------
1658
1659 In actual practice, the bonding mode typically employed in
1660configurations of this type is balance-rr. Historically, in this
1661network configuration, the usual caveats about out of order packet
1662delivery are mitigated by the use of network adapters that do not do
1663any kind of packet coalescing (via the use of NAPI, or because the
1664device itself does not generate interrupts until some number of
1665packets has arrived). When employed in this fashion, the balance-rr
1666mode allows individual connections between two hosts to effectively
1667utilize greater than one interface's bandwidth.
1668
166913.2.2 MT Link Monitoring for Multiple Switch Topology
1670------------------------------------------------------
1671
1672 Again, in actual practice, the MII monitor is most often used
1673in this configuration, as performance is given preference over
1674availability. The ARP monitor will function in this topology, but its
1675advantages over the MII monitor are mitigated by the volume of probes
1676needed as the number of systems involved grows (remember that each
1677host in the network is configured with bonding).
1678
167914. Switch Behavior Issues
1680==========================
1681
168214.1 Link Establishment and Failover Delays
1683-------------------------------------------
1684
1685 Some switches exhibit undesirable behavior with regard to the
1686timing of link up and down reporting by the switch.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001687
1688 First, when a link comes up, some switches may indicate that
1689the link is up (carrier available), but not pass traffic over the
1690interface for some period of time. This delay is typically due to
1691some type of autonegotiation or routing protocol, but may also occur
1692during switch initialization (e.g., during recovery after a switch
1693failure). If you find this to be a problem, specify an appropriate
1694value to the updelay bonding module option to delay the use of the
1695relevant interface(s).
1696
1697 Second, some switches may "bounce" the link state one or more
1698times while a link is changing state. This occurs most commonly while
1699the switch is initializing. Again, an appropriate updelay value may
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001700help.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001701
1702 Note that when a bonding interface has no active links, the
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001703driver will immediately reuse the first link that goes up, even if the
1704updelay parameter has been specified (the updelay is ignored in this
1705case). If there are slave interfaces waiting for the updelay timeout
1706to expire, the interface that first went into that state will be
1707immediately reused. This reduces down time of the network if the
1708value of updelay has been overestimated, and since this occurs only in
1709cases with no connectivity, there is no additional penalty for
1710ignoring the updelay.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001711
1712 In addition to the concerns about switch timings, if your
1713switches take a long time to go into backup mode, it may be desirable
1714to not activate a backup interface immediately after a link goes down.
1715Failover may be delayed via the downdelay bonding module option.
1716
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700171714.2 Duplicated Incoming Packets
1718--------------------------------
1719
1720 It is not uncommon to observe a short burst of duplicated
1721traffic when the bonding device is first used, or after it has been
1722idle for some period of time. This is most easily observed by issuing
1723a "ping" to some other host on the network, and noticing that the
1724output from ping flags duplicates (typically one per slave).
1725
1726 For example, on a bond in active-backup mode with five slaves
1727all connected to one switch, the output may appear as follows:
1728
1729# ping -n 10.0.4.2
1730PING 10.0.4.2 (10.0.4.2) from 10.0.3.10 : 56(84) bytes of data.
173164 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.7 ms
173264 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173364 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173464 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173564 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
173664 bytes from 10.0.4.2: icmp_seq=2 ttl=64 time=0.216 ms
173764 bytes from 10.0.4.2: icmp_seq=3 ttl=64 time=0.267 ms
173864 bytes from 10.0.4.2: icmp_seq=4 ttl=64 time=0.222 ms
1739
1740 This is not due to an error in the bonding driver, rather, it
1741is a side effect of how many switches update their MAC forwarding
1742tables. Initially, the switch does not associate the MAC address in
1743the packet with a particular switch port, and so it may send the
1744traffic to all ports until its MAC forwarding table is updated. Since
1745the interfaces attached to the bond may occupy multiple ports on a
1746single switch, when the switch (temporarily) floods the traffic to all
1747ports, the bond device receives multiple copies of the same packet
1748(one per slave device).
1749
1750 The duplicated packet behavior is switch dependent, some
1751switches exhibit this, and some do not. On switches that display this
1752behavior, it can be induced by clearing the MAC forwarding table (on
1753most Cisco switches, the privileged command "clear mac address-table
1754dynamic" will accomplish this).
1755
175615. Hardware Specific Considerations
Linus Torvalds1da177e2005-04-16 15:20:36 -07001757====================================
1758
1759 This section contains additional information for configuring
1760bonding on specific hardware platforms, or for interfacing bonding
1761with particular switches or other devices.
1762
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700176315.1 IBM BladeCenter
Linus Torvalds1da177e2005-04-16 15:20:36 -07001764--------------------
1765
1766 This applies to the JS20 and similar systems.
1767
1768 On the JS20 blades, the bonding driver supports only
1769balance-rr, active-backup, balance-tlb and balance-alb modes. This is
1770largely due to the network topology inside the BladeCenter, detailed
1771below.
1772
1773JS20 network adapter information
1774--------------------------------
1775
1776 All JS20s come with two Broadcom Gigabit Ethernet ports
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001777integrated on the planar (that's "motherboard" in IBM-speak). In the
1778BladeCenter chassis, the eth0 port of all JS20 blades is hard wired to
1779I/O Module #1; similarly, all eth1 ports are wired to I/O Module #2.
1780An add-on Broadcom daughter card can be installed on a JS20 to provide
1781two more Gigabit Ethernet ports. These ports, eth2 and eth3, are
1782wired to I/O Modules 3 and 4, respectively.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001783
1784 Each I/O Module may contain either a switch or a passthrough
1785module (which allows ports to be directly connected to an external
1786switch). Some bonding modes require a specific BladeCenter internal
1787network topology in order to function; these are detailed below.
1788
1789 Additional BladeCenter-specific networking information can be
1790found in two IBM Redbooks (www.ibm.com/redbooks):
1791
1792"IBM eServer BladeCenter Networking Options"
1793"IBM eServer BladeCenter Layer 2-7 Network Switching"
1794
1795BladeCenter networking configuration
1796------------------------------------
1797
1798 Because a BladeCenter can be configured in a very large number
1799of ways, this discussion will be confined to describing basic
1800configurations.
1801
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001802 Normally, Ethernet Switch Modules (ESMs) are used in I/O
Linus Torvalds1da177e2005-04-16 15:20:36 -07001803modules 1 and 2. In this configuration, the eth0 and eth1 ports of a
1804JS20 will be connected to different internal switches (in the
1805respective I/O modules).
1806
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001807 A passthrough module (OPM or CPM, optical or copper,
1808passthrough module) connects the I/O module directly to an external
1809switch. By using PMs in I/O module #1 and #2, the eth0 and eth1
1810interfaces of a JS20 can be redirected to the outside world and
1811connected to a common external switch.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001812
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001813 Depending upon the mix of ESMs and PMs, the network will
1814appear to bonding as either a single switch topology (all PMs) or as a
1815multiple switch topology (one or more ESMs, zero or more PMs). It is
1816also possible to connect ESMs together, resulting in a configuration
1817much like the example in "High Availability in a Multiple Switch
1818Topology," above.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001819
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001820Requirements for specific modes
1821-------------------------------
Linus Torvalds1da177e2005-04-16 15:20:36 -07001822
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001823 The balance-rr mode requires the use of passthrough modules
1824for devices in the bond, all connected to an common external switch.
1825That switch must be configured for "etherchannel" or "trunking" on the
Linus Torvalds1da177e2005-04-16 15:20:36 -07001826appropriate ports, as is usual for balance-rr.
1827
1828 The balance-alb and balance-tlb modes will function with
1829either switch modules or passthrough modules (or a mix). The only
1830specific requirement for these modes is that all network interfaces
1831must be able to reach all destinations for traffic sent over the
1832bonding device (i.e., the network must converge at some point outside
1833the BladeCenter).
1834
1835 The active-backup mode has no additional requirements.
1836
1837Link monitoring issues
1838----------------------
1839
1840 When an Ethernet Switch Module is in place, only the ARP
1841monitor will reliably detect link loss to an external switch. This is
1842nothing unusual, but examination of the BladeCenter cabinet would
1843suggest that the "external" network ports are the ethernet ports for
1844the system, when it fact there is a switch between these "external"
1845ports and the devices on the JS20 system itself. The MII monitor is
1846only able to detect link failures between the ESM and the JS20 system.
1847
1848 When a passthrough module is in place, the MII monitor does
1849detect failures to the "external" port, which is then directly
1850connected to the JS20 system.
1851
1852Other concerns
1853--------------
1854
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001855 The Serial Over LAN (SoL) link is established over the primary
Linus Torvalds1da177e2005-04-16 15:20:36 -07001856ethernet (eth0) only, therefore, any loss of link to eth0 will result
1857in losing your SoL connection. It will not fail over with other
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001858network traffic, as the SoL system is beyond the control of the
1859bonding driver.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001860
1861 It may be desirable to disable spanning tree on the switch
1862(either the internal Ethernet Switch Module, or an external switch) to
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001863avoid fail-over delay issues when using bonding.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001864
1865
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700186616. Frequently Asked Questions
Linus Torvalds1da177e2005-04-16 15:20:36 -07001867==============================
1868
18691. Is it SMP safe?
1870
1871 Yes. The old 2.0.xx channel bonding patch was not SMP safe.
1872The new driver was designed to be SMP safe from the start.
1873
18742. What type of cards will work with it?
1875
1876 Any Ethernet type cards (you can even mix cards - a Intel
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001877EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes,
1878devices need not be of the same speed.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001879
18803. How many bonding devices can I have?
1881
1882 There is no limit.
1883
18844. How many slaves can a bonding device have?
1885
1886 This is limited only by the number of network interfaces Linux
1887supports and/or the number of network cards you can place in your
1888system.
1889
18905. What happens when a slave link dies?
1891
1892 If link monitoring is enabled, then the failing device will be
1893disabled. The active-backup mode will fail over to a backup link, and
1894other modes will ignore the failed link. The link will continue to be
1895monitored, and should it recover, it will rejoin the bond (in whatever
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001896manner is appropriate for the mode). See the sections on High
1897Availability and the documentation for each mode for additional
1898information.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001899
1900 Link monitoring can be enabled via either the miimon or
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001901arp_interval parameters (described in the module parameters section,
Linus Torvalds1da177e2005-04-16 15:20:36 -07001902above). In general, miimon monitors the carrier state as sensed by
1903the underlying network device, and the arp monitor (arp_interval)
1904monitors connectivity to another host on the local network.
1905
1906 If no link monitoring is configured, the bonding driver will
1907be unable to detect link failures, and will assume that all links are
1908always available. This will likely result in lost packets, and a
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001909resulting degradation of performance. The precise performance loss
Linus Torvalds1da177e2005-04-16 15:20:36 -07001910depends upon the bonding mode and network configuration.
1911
19126. Can bonding be used for High Availability?
1913
1914 Yes. See the section on High Availability for details.
1915
19167. Which switches/systems does it work with?
1917
1918 The full answer to this depends upon the desired mode.
1919
1920 In the basic balance modes (balance-rr and balance-xor), it
1921works with any system that supports etherchannel (also called
1922trunking). Most managed switches currently available have such
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001923support, and many unmanaged switches as well.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001924
1925 The advanced balance modes (balance-tlb and balance-alb) do
1926not have special switch requirements, but do need device drivers that
1927support specific features (described in the appropriate section under
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001928module parameters, above).
Linus Torvalds1da177e2005-04-16 15:20:36 -07001929
1930 In 802.3ad mode, it works with with systems that support IEEE
1931802.3ad Dynamic Link Aggregation. Most managed and many unmanaged
1932switches currently available support 802.3ad.
1933
1934 The active-backup mode should work with any Layer-II switch.
1935
19368. Where does a bonding device get its MAC address from?
1937
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001938 If not explicitly configured (with ifconfig or ip link), the
1939MAC address of the bonding device is taken from its first slave
1940device. This MAC address is then passed to all following slaves and
Tobias Klauserd533f672005-09-10 00:26:46 -07001941remains persistent (even if the first slave is removed) until the
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001942bonding device is brought down or reconfigured.
Linus Torvalds1da177e2005-04-16 15:20:36 -07001943
1944 If you wish to change the MAC address, you can set it with
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001945ifconfig or ip link:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001946
1947# ifconfig bond0 hw ether 00:11:22:33:44:55
1948
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001949# ip link set bond0 address 66:77:88:99:aa:bb
1950
Linus Torvalds1da177e2005-04-16 15:20:36 -07001951 The MAC address can be also changed by bringing down/up the
1952device and then changing its slaves (or their order):
1953
1954# ifconfig bond0 down ; modprobe -r bonding
1955# ifconfig bond0 .... up
1956# ifenslave bond0 eth...
1957
1958 This method will automatically take the address from the next
1959slave that is added.
1960
1961 To restore your slaves' MAC addresses, you need to detach them
1962from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
1963then restore the MAC addresses that the slaves had before they were
1964enslaved.
1965
Jay Vosburgh00354cf2005-07-21 12:18:02 -0700196616. Resources and Links
Linus Torvalds1da177e2005-04-16 15:20:36 -07001967=======================
1968
1969The latest version of the bonding driver can be found in the latest
1970version of the linux kernel, found on http://kernel.org
1971
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001972The latest version of this document can be found in either the latest
1973kernel source (named Documentation/networking/bonding.txt), or on the
1974bonding sourceforge site:
1975
1976http://www.sourceforge.net/projects/bonding
1977
Linus Torvalds1da177e2005-04-16 15:20:36 -07001978Discussions regarding the bonding driver take place primarily on the
1979bonding-devel mailing list, hosted at sourceforge.net. If you have
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001980questions or problems, post them to the list. The list address is:
Linus Torvalds1da177e2005-04-16 15:20:36 -07001981
1982bonding-devel@lists.sourceforge.net
1983
Jay Vosburgh00354cf2005-07-21 12:18:02 -07001984 The administrative interface (to subscribe or unsubscribe) can
1985be found at:
1986
Linus Torvalds1da177e2005-04-16 15:20:36 -07001987https://lists.sourceforge.net/lists/listinfo/bonding-devel
1988
Linus Torvalds1da177e2005-04-16 15:20:36 -07001989Donald Becker's Ethernet Drivers and diag programs may be found at :
1990 - http://www.scyld.com/network/
1991
1992You will also find a lot of information regarding Ethernet, NWay, MII,
1993etc. at www.scyld.com.
1994
1995-- END --