ia64/linux-2.6.18-xen.hg

view Documentation/networking/bonding.txt @ 897:329ea0ccb344

balloon: try harder to balloon up under memory pressure.

Currently if the balloon driver is unable to increase the guest's
reservation it assumes the failure was due to reaching its full
allocation, gives up on the ballooning operation and records the limit
it reached as the "hard limit". The driver will not try again until
the target is set again (even to the same value).

However it is possible that ballooning has in fact failed due to
memory pressure in the host and therefore it is desirable to keep
attempting to reach the target in case memory becomes available. The
most likely scenario is that some guests are ballooning down while
others are ballooning up and therefore there is temporary memory
pressure while things stabilise. You would not expect a well behaved
toolstack to ask a domain to balloon to more than its allocation nor
would you expect it to deliberately over-commit memory by setting
balloon targets which exceed the total host memory.

This patch drops the concept of a hard limit and causes the balloon
driver to retry increasing the reservation on a timer in the same
manner as when decreasing the reservation.

Also if we partially succeed in increasing the reservation
(i.e. receive less pages than we asked for) then we may as well keep
those pages rather than returning them to Xen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 14:01:20 2009 +0100 (2009-06-05)
parents 831230e53067
children
line source
2 Linux Ethernet Bonding Driver HOWTO
4 Latest update: 24 April 2006
6 Initial release : Thomas Davis <tadavis at lbl.gov>
7 Corrections, 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>
14 Reorganized and updated Feb 2005 by Jay Vosburgh
15 Added Sysfs information: 2006/04/24
16 - Mitch Williams <mitch.a.williams at intel.com>
18 Introduction
19 ============
21 The Linux bonding driver provides a method for aggregating
22 multiple network interfaces into a single logical "bonded" interface.
23 The behavior of the bonded interfaces depends upon the mode; generally
24 speaking, modes provide either hot standby or load balancing services.
25 Additionally, link integrity monitoring may be performed.
27 The bonding driver originally came from Donald Becker's
28 beowulf patches for kernel 2.0. It has changed quite a bit since, and
29 the original tools from extreme-linux and beowulf sites will not work
30 with this version of the driver.
32 For new versions of the driver, updated userspace tools, and
33 who to ask for help, please follow the links at the end of this file.
35 Table of Contents
36 =================
38 1. Bonding Driver Installation
40 2. Bonding Driver Options
42 3. Configuring Bonding Devices
43 3.1 Configuration with Sysconfig Support
44 3.1.1 Using DHCP with Sysconfig
45 3.1.2 Configuring Multiple Bonds with Sysconfig
46 3.2 Configuration with Initscripts Support
47 3.2.1 Using DHCP with Initscripts
48 3.2.2 Configuring Multiple Bonds with Initscripts
49 3.3 Configuring Bonding Manually with Ifenslave
50 3.3.1 Configuring Multiple Bonds Manually
51 3.4 Configuring Bonding Manually via Sysfs
53 4. Querying Bonding Configuration
54 4.1 Bonding Configuration
55 4.2 Network Configuration
57 5. Switch Configuration
59 6. 802.1q VLAN Support
61 7. Link Monitoring
62 7.1 ARP Monitor Operation
63 7.2 Configuring Multiple ARP Targets
64 7.3 MII Monitor Operation
66 8. Potential Trouble Sources
67 8.1 Adventures in Routing
68 8.2 Ethernet Device Renaming
69 8.3 Painfully Slow Or No Failed Link Detection By Miimon
71 9. SNMP agents
73 10. Promiscuous mode
75 11. Configuring Bonding for High Availability
76 11.1 High Availability in a Single Switch Topology
77 11.2 High Availability in a Multiple Switch Topology
78 11.2.1 HA Bonding Mode Selection for Multiple Switch Topology
79 11.2.2 HA Link Monitoring for Multiple Switch Topology
81 12. Configuring Bonding for Maximum Throughput
82 12.1 Maximum Throughput in a Single Switch Topology
83 12.1.1 MT Bonding Mode Selection for Single Switch Topology
84 12.1.2 MT Link Monitoring for Single Switch Topology
85 12.2 Maximum Throughput in a Multiple Switch Topology
86 12.2.1 MT Bonding Mode Selection for Multiple Switch Topology
87 12.2.2 MT Link Monitoring for Multiple Switch Topology
89 13. Switch Behavior Issues
90 13.1 Link Establishment and Failover Delays
91 13.2 Duplicated Incoming Packets
93 14. Hardware Specific Considerations
94 14.1 IBM BladeCenter
96 15. Frequently Asked Questions
98 16. Resources and Links
101 1. Bonding Driver Installation
102 ==============================
104 Most popular distro kernels ship with the bonding driver
105 already available as a module and the ifenslave user level control
106 program installed and ready for use. If your distro does not, or you
107 have need to compile bonding from source (e.g., configuring and
108 installing a mainline kernel from kernel.org), you'll need to perform
109 the following steps:
111 1.1 Configure and build the kernel with bonding
112 -----------------------------------------------
114 The current version of the bonding driver is available in the
115 drivers/net/bonding subdirectory of the most recent kernel source
116 (which is available on http://kernel.org). Most users "rolling their
117 own" will want to use the most recent kernel from kernel.org.
119 Configure kernel with "make menuconfig" (or "make xconfig" or
120 "make config"), then select "Bonding driver support" in the "Network
121 device support" section. It is recommended that you configure the
122 driver as module since it is currently the only way to pass parameters
123 to the driver or configure more than one bonding device.
125 Build and install the new kernel and modules, then continue
126 below to install ifenslave.
128 1.2 Install ifenslave Control Utility
129 -------------------------------------
131 The ifenslave user level control program is included in the
132 kernel source tree, in the file Documentation/networking/ifenslave.c.
133 It is generally recommended that you use the ifenslave that
134 corresponds to the kernel that you are using (either from the same
135 source tree or supplied with the distro), however, ifenslave
136 executables from older kernels should function (but features newer
137 than the ifenslave release are not supported). Running an ifenslave
138 that is newer than the kernel is not supported, and may or may not
139 work.
141 To install ifenslave, do the following:
143 # gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
144 # cp ifenslave /sbin/ifenslave
146 If your kernel source is not in "/usr/src/linux," then replace
147 "/usr/src/linux/include" in the above with the location of your kernel
148 source include directory.
150 You may wish to back up any existing /sbin/ifenslave, or, for
151 testing or informal use, tag the ifenslave to the kernel version
152 (e.g., name the ifenslave executable /sbin/ifenslave-2.6.10).
154 IMPORTANT NOTE:
156 If you omit the "-I" or specify an incorrect directory, you
157 may end up with an ifenslave that is incompatible with the kernel
158 you're trying to build it for. Some distros (e.g., Red Hat from 7.1
159 onwards) do not have /usr/include/linux symbolically linked to the
160 default kernel source include directory.
162 SECOND IMPORTANT NOTE:
163 If you plan to configure bonding using sysfs, you do not need
164 to use ifenslave.
166 2. Bonding Driver Options
167 =========================
169 Options for the bonding driver are supplied as parameters to
170 the bonding module at load time. They may be given as command line
171 arguments to the insmod or modprobe command, but are usually specified
172 in either the /etc/modules.conf or /etc/modprobe.conf configuration
173 file, or in a distro-specific configuration file (some of which are
174 detailed in the next section).
176 The available bonding driver parameters are listed below. If a
177 parameter is not specified the default value is used. When initially
178 configuring a bond, it is recommended "tail -f /var/log/messages" be
179 run in a separate window to watch for bonding driver error messages.
181 It is critical that either the miimon or arp_interval and
182 arp_ip_target parameters be specified, otherwise serious network
183 degradation will occur during link failures. Very few devices do not
184 support at least miimon, so there is really no reason not to use it.
186 Options with textual values will accept either the text name
187 or, for backwards compatibility, the option value. E.g.,
188 "mode=802.3ad" and "mode=4" set the same mode.
190 The parameters are as follows:
192 arp_interval
194 Specifies the ARP link monitoring frequency in milliseconds.
195 If ARP monitoring is used in an etherchannel compatible mode
196 (modes 0 and 2), the switch should be configured in a mode
197 that evenly distributes packets across all links. If the
198 switch is configured to distribute the packets in an XOR
199 fashion, all replies from the ARP targets will be received on
200 the same link which could cause the other team members to
201 fail. ARP monitoring should not be used in conjunction with
202 miimon. A value of 0 disables ARP monitoring. The default
203 value is 0.
205 arp_ip_target
207 Specifies the IP addresses to use as ARP monitoring peers when
208 arp_interval is > 0. These are the targets of the ARP request
209 sent to determine the health of the link to the targets.
210 Specify these values in ddd.ddd.ddd.ddd format. Multiple IP
211 addresses must be separated by a comma. At least one IP
212 address must be given for ARP monitoring to function. The
213 maximum number of targets that can be specified is 16. The
214 default value is no IP addresses.
216 downdelay
218 Specifies the time, in milliseconds, to wait before disabling
219 a slave after a link failure has been detected. This option
220 is only valid for the miimon link monitor. The downdelay
221 value should be a multiple of the miimon value; if not, it
222 will be rounded down to the nearest multiple. The default
223 value is 0.
225 lacp_rate
227 Option specifying the rate in which we'll ask our link partner
228 to transmit LACPDU packets in 802.3ad mode. Possible values
229 are:
231 slow or 0
232 Request partner to transmit LACPDUs every 30 seconds
234 fast or 1
235 Request partner to transmit LACPDUs every 1 second
237 The default is slow.
239 max_bonds
241 Specifies the number of bonding devices to create for this
242 instance of the bonding driver. E.g., if max_bonds is 3, and
243 the bonding driver is not already loaded, then bond0, bond1
244 and bond2 will be created. The default value is 1.
246 miimon
248 Specifies the MII link monitoring frequency in milliseconds.
249 This determines how often the link state of each slave is
250 inspected for link failures. A value of zero disables MII
251 link monitoring. A value of 100 is a good starting point.
252 The use_carrier option, below, affects how the link state is
253 determined. See the High Availability section for additional
254 information. The default value is 0.
256 mode
258 Specifies one of the bonding policies. The default is
259 balance-rr (round robin). Possible values are:
261 balance-rr or 0
263 Round-robin policy: Transmit packets in sequential
264 order from the first available slave through the
265 last. This mode provides load balancing and fault
266 tolerance.
268 active-backup or 1
270 Active-backup policy: Only one slave in the bond is
271 active. A different slave becomes active if, and only
272 if, the active slave fails. The bond's MAC address is
273 externally visible on only one port (network adapter)
274 to avoid confusing the switch.
276 In bonding version 2.6.2 or later, when a failover
277 occurs in active-backup mode, bonding will issue one
278 or more gratuitous ARPs on the newly active slave.
279 One gratuitous ARP is issued for the bonding master
280 interface and each VLAN interfaces configured above
281 it, provided that the interface has at least one IP
282 address configured. Gratuitous ARPs issued for VLAN
283 interfaces are tagged with the appropriate VLAN id.
285 This mode provides fault tolerance. The primary
286 option, documented below, affects the behavior of this
287 mode.
289 balance-xor or 2
291 XOR policy: Transmit based on the selected transmit
292 hash policy. The default policy is a simple [(source
293 MAC address XOR'd with destination MAC address) modulo
294 slave count]. Alternate transmit policies may be
295 selected via the xmit_hash_policy option, described
296 below.
298 This mode provides load balancing and fault tolerance.
300 broadcast or 3
302 Broadcast policy: transmits everything on all slave
303 interfaces. This mode provides fault tolerance.
305 802.3ad or 4
307 IEEE 802.3ad Dynamic link aggregation. Creates
308 aggregation groups that share the same speed and
309 duplex settings. Utilizes all slaves in the active
310 aggregator according to the 802.3ad specification.
312 Slave selection for outgoing traffic is done according
313 to the transmit hash policy, which may be changed from
314 the default simple XOR policy via the xmit_hash_policy
315 option, documented below. Note that not all transmit
316 policies may be 802.3ad compliant, particularly in
317 regards to the packet mis-ordering requirements of
318 section 43.2.4 of the 802.3ad standard. Differing
319 peer implementations will have varying tolerances for
320 noncompliance.
322 Prerequisites:
324 1. Ethtool support in the base drivers for retrieving
325 the speed and duplex of each slave.
327 2. A switch that supports IEEE 802.3ad Dynamic link
328 aggregation.
330 Most switches will require some type of configuration
331 to enable 802.3ad mode.
333 balance-tlb or 5
335 Adaptive transmit load balancing: channel bonding that
336 does not require any special switch support. The
337 outgoing traffic is distributed according to the
338 current load (computed relative to the speed) on each
339 slave. Incoming traffic is received by the current
340 slave. If the receiving slave fails, another slave
341 takes over the MAC address of the failed receiving
342 slave.
344 Prerequisite:
346 Ethtool support in the base drivers for retrieving the
347 speed of each slave.
349 balance-alb or 6
351 Adaptive load balancing: includes balance-tlb plus
352 receive load balancing (rlb) for IPV4 traffic, and
353 does not require any special switch support. The
354 receive load balancing is achieved by ARP negotiation.
355 The bonding driver intercepts the ARP Replies sent by
356 the local system on their way out and overwrites the
357 source hardware address with the unique hardware
358 address of one of the slaves in the bond such that
359 different peers use different hardware addresses for
360 the server.
362 Receive traffic from connections created by the server
363 is also balanced. When the local system sends an ARP
364 Request the bonding driver copies and saves the peer's
365 IP information from the ARP packet. When the ARP
366 Reply arrives from the peer, its hardware address is
367 retrieved and the bonding driver initiates an ARP
368 reply to this peer assigning it to one of the slaves
369 in the bond. A problematic outcome of using ARP
370 negotiation for balancing is that each time that an
371 ARP request is broadcast it uses the hardware address
372 of the bond. Hence, peers learn the hardware address
373 of the bond and the balancing of receive traffic
374 collapses to the current slave. This is handled by
375 sending updates (ARP Replies) to all the peers with
376 their individually assigned hardware address such that
377 the traffic is redistributed. Receive traffic is also
378 redistributed when a new slave is added to the bond
379 and when an inactive slave is re-activated. The
380 receive load is distributed sequentially (round robin)
381 among the group of highest speed slaves in the bond.
383 When a link is reconnected or a new slave joins the
384 bond the receive traffic is redistributed among all
385 active slaves in the bond by initiating ARP Replies
386 with the selected MAC address to each of the
387 clients. The updelay parameter (detailed below) must
388 be set to a value equal or greater than the switch's
389 forwarding delay so that the ARP Replies sent to the
390 peers will not be blocked by the switch.
392 Prerequisites:
394 1. Ethtool support in the base drivers for retrieving
395 the speed of each slave.
397 2. Base driver support for setting the hardware
398 address of a device while it is open. This is
399 required so that there will always be one slave in the
400 team using the bond hardware address (the
401 curr_active_slave) while having a unique hardware
402 address for each slave in the bond. If the
403 curr_active_slave fails its hardware address is
404 swapped with the new curr_active_slave that was
405 chosen.
407 primary
409 A string (eth0, eth2, etc) specifying which slave is the
410 primary device. The specified device will always be the
411 active slave while it is available. Only when the primary is
412 off-line will alternate devices be used. This is useful when
413 one slave is preferred over another, e.g., when one slave has
414 higher throughput than another.
416 The primary option is only valid for active-backup mode.
418 updelay
420 Specifies the time, in milliseconds, to wait before enabling a
421 slave after a link recovery has been detected. This option is
422 only valid for the miimon link monitor. The updelay value
423 should be a multiple of the miimon value; if not, it will be
424 rounded down to the nearest multiple. The default value is 0.
426 use_carrier
428 Specifies whether or not miimon should use MII or ETHTOOL
429 ioctls vs. netif_carrier_ok() to determine the link
430 status. The MII or ETHTOOL ioctls are less efficient and
431 utilize a deprecated calling sequence within the kernel. The
432 netif_carrier_ok() relies on the device driver to maintain its
433 state with netif_carrier_on/off; at this writing, most, but
434 not all, device drivers support this facility.
436 If bonding insists that the link is up when it should not be,
437 it may be that your network device driver does not support
438 netif_carrier_on/off. The default state for netif_carrier is
439 "carrier on," so if a driver does not support netif_carrier,
440 it will appear as if the link is always up. In this case,
441 setting use_carrier to 0 will cause bonding to revert to the
442 MII / ETHTOOL ioctl method to determine the link state.
444 A value of 1 enables the use of netif_carrier_ok(), a value of
445 0 will use the deprecated MII / ETHTOOL ioctls. The default
446 value is 1.
448 xmit_hash_policy
450 Selects the transmit hash policy to use for slave selection in
451 balance-xor and 802.3ad modes. Possible values are:
453 layer2
455 Uses XOR of hardware MAC addresses to generate the
456 hash. The formula is
458 (source MAC XOR destination MAC) modulo slave count
460 This algorithm will place all traffic to a particular
461 network peer on the same slave.
463 This algorithm is 802.3ad compliant.
465 layer3+4
467 This policy uses upper layer protocol information,
468 when available, to generate the hash. This allows for
469 traffic to a particular network peer to span multiple
470 slaves, although a single connection will not span
471 multiple slaves.
473 The formula for unfragmented TCP and UDP packets is
475 ((source port XOR dest port) XOR
476 ((source IP XOR dest IP) AND 0xffff)
477 modulo slave count
479 For fragmented TCP or UDP packets and all other IP
480 protocol traffic, the source and destination port
481 information is omitted. For non-IP traffic, the
482 formula is the same as for the layer2 transmit hash
483 policy.
485 This policy is intended to mimic the behavior of
486 certain switches, notably Cisco switches with PFC2 as
487 well as some Foundry and IBM products.
489 This algorithm is not fully 802.3ad compliant. A
490 single TCP or UDP conversation containing both
491 fragmented and unfragmented packets will see packets
492 striped across two interfaces. This may result in out
493 of order delivery. Most traffic types will not meet
494 this criteria, as TCP rarely fragments traffic, and
495 most UDP traffic is not involved in extended
496 conversations. Other implementations of 802.3ad may
497 or may not tolerate this noncompliance.
499 The default value is layer2. This option was added in bonding
500 version 2.6.3. In earlier versions of bonding, this parameter does
501 not exist, and the layer2 policy is the only policy.
504 3. Configuring Bonding Devices
505 ==============================
507 You can configure bonding using either your distro's network
508 initialization scripts, or manually using either ifenslave or the
509 sysfs interface. Distros generally use one of two packages for the
510 network initialization scripts: initscripts or sysconfig. Recent
511 versions of these packages have support for bonding, while older
512 versions do not.
514 We will first describe the options for configuring bonding for
515 distros using versions of initscripts and sysconfig with full or
516 partial support for bonding, then provide information on enabling
517 bonding without support from the network initialization scripts (i.e.,
518 older versions of initscripts or sysconfig).
520 If you're unsure whether your distro uses sysconfig or
521 initscripts, or don't know if it's new enough, have no fear.
522 Determining this is fairly straightforward.
524 First, issue the command:
526 $ rpm -qf /sbin/ifup
528 It will respond with a line of text starting with either
529 "initscripts" or "sysconfig," followed by some numbers. This is the
530 package that provides your network initialization scripts.
532 Next, to determine if your installation supports bonding,
533 issue the command:
535 $ grep ifenslave /sbin/ifup
537 If this returns any matches, then your initscripts or
538 sysconfig has support for bonding.
540 3.1 Configuration with Sysconfig Support
541 ----------------------------------------
543 This section applies to distros using a version of sysconfig
544 with bonding support, for example, SuSE Linux Enterprise Server 9.
546 SuSE SLES 9's networking configuration system does support
547 bonding, however, at this writing, the YaST system configuration
548 front end does not provide any means to work with bonding devices.
549 Bonding devices can be managed by hand, however, as follows.
551 First, if they have not already been configured, configure the
552 slave devices. On SLES 9, this is most easily done by running the
553 yast2 sysconfig configuration utility. The goal is for to create an
554 ifcfg-id file for each slave device. The simplest way to accomplish
555 this is to configure the devices for DHCP (this is only to get the
556 file ifcfg-id file created; see below for some issues with DHCP). The
557 name of the configuration file for each device will be of the form:
559 ifcfg-id-xx:xx:xx:xx:xx:xx
561 Where the "xx" portion will be replaced with the digits from
562 the device's permanent MAC address.
564 Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
565 created, it is necessary to edit the configuration files for the slave
566 devices (the MAC addresses correspond to those of the slave devices).
567 Before editing, the file will contain multiple lines, and will look
568 something like this:
570 BOOTPROTO='dhcp'
571 STARTMODE='on'
572 USERCTL='no'
573 UNIQUE='XNzu.WeZGOGF+4wE'
574 _nm_name='bus-pci-0001:61:01.0'
576 Change the BOOTPROTO and STARTMODE lines to the following:
578 BOOTPROTO='none'
579 STARTMODE='off'
581 Do not alter the UNIQUE or _nm_name lines. Remove any other
582 lines (USERCTL, etc).
584 Once the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified,
585 it's time to create the configuration file for the bonding device
586 itself. This file is named ifcfg-bondX, where X is the number of the
587 bonding device to create, starting at 0. The first such file is
588 ifcfg-bond0, the second is ifcfg-bond1, and so on. The sysconfig
589 network configuration system will correctly start multiple instances
590 of bonding.
592 The contents of the ifcfg-bondX file is as follows:
594 BOOTPROTO="static"
595 BROADCAST="10.0.2.255"
596 IPADDR="10.0.2.10"
597 NETMASK="255.255.0.0"
598 NETWORK="10.0.2.0"
599 REMOTE_IPADDR=""
600 STARTMODE="onboot"
601 BONDING_MASTER="yes"
602 BONDING_MODULE_OPTS="mode=active-backup miimon=100"
603 BONDING_SLAVE0="eth0"
604 BONDING_SLAVE1="bus-pci-0000:06:08.1"
606 Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK
607 values with the appropriate values for your network.
609 The STARTMODE specifies when the device is brought online.
610 The possible values are:
612 onboot: The device is started at boot time. If you're not
613 sure, this is probably what you want.
615 manual: The device is started only when ifup is called
616 manually. Bonding devices may be configured this
617 way if you do not wish them to start automatically
618 at boot for some reason.
620 hotplug: The device is started by a hotplug event. This is not
621 a valid choice for a bonding device.
623 off or ignore: The device configuration is ignored.
625 The line BONDING_MASTER='yes' indicates that the device is a
626 bonding master device. The only useful value is "yes."
628 The contents of BONDING_MODULE_OPTS are supplied to the
629 instance of the bonding module for this device. Specify the options
630 for the bonding mode, link monitoring, and so on here. Do not include
631 the max_bonds bonding parameter; this will confuse the configuration
632 system if you have multiple bonding devices.
634 Finally, supply one BONDING_SLAVEn="slave device" for each
635 slave. where "n" is an increasing value, one for each slave. The
636 "slave device" is either an interface name, e.g., "eth0", or a device
637 specifier for the network device. The interface name is easier to
638 find, but the ethN names are subject to change at boot time if, e.g.,
639 a device early in the sequence has failed. The device specifiers
640 (bus-pci-0000:06:08.1 in the example above) specify the physical
641 network device, and will not change unless the device's bus location
642 changes (for example, it is moved from one PCI slot to another). The
643 example above uses one of each type for demonstration purposes; most
644 configurations will choose one or the other for all slave devices.
646 When all configuration files have been modified or created,
647 networking must be restarted for the configuration changes to take
648 effect. This can be accomplished via the following:
650 # /etc/init.d/network restart
652 Note that the network control script (/sbin/ifdown) will
653 remove the bonding module as part of the network shutdown processing,
654 so it is not necessary to remove the module by hand if, e.g., the
655 module parameters have changed.
657 Also, at this writing, YaST/YaST2 will not manage bonding
658 devices (they do not show bonding interfaces on its list of network
659 devices). It is necessary to edit the configuration file by hand to
660 change the bonding configuration.
662 Additional general options and details of the ifcfg file
663 format can be found in an example ifcfg template file:
665 /etc/sysconfig/network/ifcfg.template
667 Note that the template does not document the various BONDING_
668 settings described above, but does describe many of the other options.
670 3.1.1 Using DHCP with Sysconfig
671 -------------------------------
673 Under sysconfig, configuring a device with BOOTPROTO='dhcp'
674 will cause it to query DHCP for its IP address information. At this
675 writing, this does not function for bonding devices; the scripts
676 attempt to obtain the device address from DHCP prior to adding any of
677 the slave devices. Without active slaves, the DHCP requests are not
678 sent to the network.
680 3.1.2 Configuring Multiple Bonds with Sysconfig
681 -----------------------------------------------
683 The sysconfig network initialization system is capable of
684 handling multiple bonding devices. All that is necessary is for each
685 bonding instance to have an appropriately configured ifcfg-bondX file
686 (as described above). Do not specify the "max_bonds" parameter to any
687 instance of bonding, as this will confuse sysconfig. If you require
688 multiple bonding devices with identical parameters, create multiple
689 ifcfg-bondX files.
691 Because the sysconfig scripts supply the bonding module
692 options in the ifcfg-bondX file, it is not necessary to add them to
693 the system /etc/modules.conf or /etc/modprobe.conf configuration file.
695 3.2 Configuration with Initscripts Support
696 ------------------------------------------
698 This section applies to distros using a version of initscripts
699 with bonding support, for example, Red Hat Linux 9 or Red Hat
700 Enterprise Linux version 3 or 4. On these systems, the network
701 initialization scripts have some knowledge of bonding, and can be
702 configured to control bonding devices.
704 These distros will not automatically load the network adapter
705 driver unless the ethX device is configured with an IP address.
706 Because of this constraint, users must manually configure a
707 network-script file for all physical adapters that will be members of
708 a bondX link. Network script files are located in the directory:
710 /etc/sysconfig/network-scripts
712 The file name must be prefixed with "ifcfg-eth" and suffixed
713 with the adapter's physical adapter number. For example, the script
714 for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.
715 Place the following text in the file:
717 DEVICE=eth0
718 USERCTL=no
719 ONBOOT=yes
720 MASTER=bond0
721 SLAVE=yes
722 BOOTPROTO=none
724 The DEVICE= line will be different for every ethX device and
725 must correspond with the name of the file, i.e., ifcfg-eth1 must have
726 a device line of DEVICE=eth1. The setting of the MASTER= line will
727 also depend on the final bonding interface name chosen for your bond.
728 As with other network devices, these typically start at 0, and go up
729 one for each device, i.e., the first bonding instance is bond0, the
730 second is bond1, and so on.
732 Next, create a bond network script. The file name for this
733 script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is
734 the number of the bond. For bond0 the file is named "ifcfg-bond0",
735 for bond1 it is named "ifcfg-bond1", and so on. Within that file,
736 place the following text:
738 DEVICE=bond0
739 IPADDR=192.168.1.1
740 NETMASK=255.255.255.0
741 NETWORK=192.168.1.0
742 BROADCAST=192.168.1.255
743 ONBOOT=yes
744 BOOTPROTO=none
745 USERCTL=no
747 Be sure to change the networking specific lines (IPADDR,
748 NETMASK, NETWORK and BROADCAST) to match your network configuration.
750 Finally, it is necessary to edit /etc/modules.conf (or
751 /etc/modprobe.conf, depending upon your distro) to load the bonding
752 module with your desired options when the bond0 interface is brought
753 up. The following lines in /etc/modules.conf (or modprobe.conf) will
754 load the bonding module, and select its options:
756 alias bond0 bonding
757 options bond0 mode=balance-alb miimon=100
759 Replace the sample parameters with the appropriate set of
760 options for your configuration.
762 Finally run "/etc/rc.d/init.d/network restart" as root. This
763 will restart the networking subsystem and your bond link should be now
764 up and running.
766 3.2.1 Using DHCP with Initscripts
767 ---------------------------------
769 Recent versions of initscripts (the version supplied with
770 Fedora Core 3 and Red Hat Enterprise Linux 4 is reported to work) do
771 have support for assigning IP information to bonding devices via DHCP.
773 To configure bonding for DHCP, configure it as described
774 above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp"
775 and add a line consisting of "TYPE=Bonding". Note that the TYPE value
776 is case sensitive.
778 3.2.2 Configuring Multiple Bonds with Initscripts
779 -------------------------------------------------
781 At this writing, the initscripts package does not directly
782 support loading the bonding driver multiple times, so the process for
783 doing so is the same as described in the "Configuring Multiple Bonds
784 Manually" section, below.
786 NOTE: It has been observed that some Red Hat supplied kernels
787 are apparently unable to rename modules at load time (the "-o bond1"
788 part). Attempts to pass that option to modprobe will produce an
789 "Operation not permitted" error. This has been reported on some
790 Fedora Core kernels, and has been seen on RHEL 4 as well. On kernels
791 exhibiting this problem, it will be impossible to configure multiple
792 bonds with differing parameters.
794 3.3 Configuring Bonding Manually with Ifenslave
795 -----------------------------------------------
797 This section applies to distros whose network initialization
798 scripts (the sysconfig or initscripts package) do not have specific
799 knowledge of bonding. One such distro is SuSE Linux Enterprise Server
800 version 8.
802 The general method for these systems is to place the bonding
803 module parameters into /etc/modules.conf or /etc/modprobe.conf (as
804 appropriate for the installed distro), then add modprobe and/or
805 ifenslave commands to the system's global init script. The name of
806 the global init script differs; for sysconfig, it is
807 /etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
809 For example, if you wanted to make a simple bond of two e100
810 devices (presumed to be eth0 and eth1), and have it persist across
811 reboots, edit the appropriate file (/etc/init.d/boot.local or
812 /etc/rc.d/rc.local), and add the following:
814 modprobe bonding mode=balance-alb miimon=100
815 modprobe e100
816 ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
817 ifenslave bond0 eth0
818 ifenslave bond0 eth1
820 Replace the example bonding module parameters and bond0
821 network configuration (IP address, netmask, etc) with the appropriate
822 values for your configuration.
824 Unfortunately, this method will not provide support for the
825 ifup and ifdown scripts on the bond devices. To reload the bonding
826 configuration, it is necessary to run the initialization script, e.g.,
828 # /etc/init.d/boot.local
830 or
832 # /etc/rc.d/rc.local
834 It may be desirable in such a case to create a separate script
835 which only initializes the bonding configuration, then call that
836 separate script from within boot.local. This allows for bonding to be
837 enabled without re-running the entire global init script.
839 To shut down the bonding devices, it is necessary to first
840 mark the bonding device itself as being down, then remove the
841 appropriate device driver modules. For our example above, you can do
842 the following:
844 # ifconfig bond0 down
845 # rmmod bonding
846 # rmmod e100
848 Again, for convenience, it may be desirable to create a script
849 with these commands.
852 3.3.1 Configuring Multiple Bonds Manually
853 -----------------------------------------
855 This section contains information on configuring multiple
856 bonding devices with differing options for those systems whose network
857 initialization scripts lack support for configuring multiple bonds.
859 If you require multiple bonding devices, but all with the same
860 options, you may wish to use the "max_bonds" module parameter,
861 documented above.
863 To create multiple bonding devices with differing options, it
864 is necessary to load the bonding driver multiple times. Note that
865 current versions of the sysconfig network initialization scripts
866 handle this automatically; if your distro uses these scripts, no
867 special action is needed. See the section Configuring Bonding
868 Devices, above, if you're not sure about your network initialization
869 scripts.
871 To load multiple instances of the module, it is necessary to
872 specify a different name for each instance (the module loading system
873 requires that every loaded module, even multiple instances of the same
874 module, have a unique name). This is accomplished by supplying
875 multiple sets of bonding options in /etc/modprobe.conf, for example:
877 alias bond0 bonding
878 options bond0 -o bond0 mode=balance-rr miimon=100
880 alias bond1 bonding
881 options bond1 -o bond1 mode=balance-alb miimon=50
883 will load the bonding module two times. The first instance is
884 named "bond0" and creates the bond0 device in balance-rr mode with an
885 miimon of 100. The second instance is named "bond1" and creates the
886 bond1 device in balance-alb mode with an miimon of 50.
888 In some circumstances (typically with older distributions),
889 the above does not work, and the second bonding instance never sees
890 its options. In that case, the second options line can be substituted
891 as follows:
893 install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
894 mode=balance-alb miimon=50
896 This may be repeated any number of times, specifying a new and
897 unique name in place of bond1 for each subsequent instance.
899 3.4 Configuring Bonding Manually via Sysfs
900 ------------------------------------------
902 Starting with version 3.0, Channel Bonding may be configured
903 via the sysfs interface. This interface allows dynamic configuration
904 of all bonds in the system without unloading the module. It also
905 allows for adding and removing bonds at runtime. Ifenslave is no
906 longer required, though it is still supported.
908 Use of the sysfs interface allows you to use multiple bonds
909 with different configurations without having to reload the module.
910 It also allows you to use multiple, differently configured bonds when
911 bonding is compiled into the kernel.
913 You must have the sysfs filesystem mounted to configure
914 bonding this way. The examples in this document assume that you
915 are using the standard mount point for sysfs, e.g. /sys. If your
916 sysfs filesystem is mounted elsewhere, you will need to adjust the
917 example paths accordingly.
919 Creating and Destroying Bonds
920 -----------------------------
921 To add a new bond foo:
922 # echo +foo > /sys/class/net/bonding_masters
924 To remove an existing bond bar:
925 # echo -bar > /sys/class/net/bonding_masters
927 To show all existing bonds:
928 # cat /sys/class/net/bonding_masters
930 NOTE: due to 4K size limitation of sysfs files, this list may be
931 truncated if you have more than a few hundred bonds. This is unlikely
932 to occur under normal operating conditions.
934 Adding and Removing Slaves
935 --------------------------
936 Interfaces may be enslaved to a bond using the file
937 /sys/class/net/<bond>/bonding/slaves. The semantics for this file
938 are the same as for the bonding_masters file.
940 To enslave interface eth0 to bond bond0:
941 # ifconfig bond0 up
942 # echo +eth0 > /sys/class/net/bond0/bonding/slaves
944 To free slave eth0 from bond bond0:
945 # echo -eth0 > /sys/class/net/bond0/bonding/slaves
947 NOTE: The bond must be up before slaves can be added. All
948 slaves are freed when the interface is brought down.
950 When an interface is enslaved to a bond, symlinks between the
951 two are created in the sysfs filesystem. In this case, you would get
952 /sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and
953 /sys/class/net/eth0/master pointing to /sys/class/net/bond0.
955 This means that you can tell quickly whether or not an
956 interface is enslaved by looking for the master symlink. Thus:
957 # echo -eth0 > /sys/class/net/eth0/master/bonding/slaves
958 will free eth0 from whatever bond it is enslaved to, regardless of
959 the name of the bond interface.
961 Changing a Bond's Configuration
962 -------------------------------
963 Each bond may be configured individually by manipulating the
964 files located in /sys/class/net/<bond name>/bonding
966 The names of these files correspond directly with the command-
967 line parameters described elsewhere in in this file, and, with the
968 exception of arp_ip_target, they accept the same values. To see the
969 current setting, simply cat the appropriate file.
971 A few examples will be given here; for specific usage
972 guidelines for each parameter, see the appropriate section in this
973 document.
975 To configure bond0 for balance-alb mode:
976 # ifconfig bond0 down
977 # echo 6 > /sys/class/net/bond0/bonding/mode
978 - or -
979 # echo balance-alb > /sys/class/net/bond0/bonding/mode
980 NOTE: The bond interface must be down before the mode can be
981 changed.
983 To enable MII monitoring on bond0 with a 1 second interval:
984 # echo 1000 > /sys/class/net/bond0/bonding/miimon
985 NOTE: If ARP monitoring is enabled, it will disabled when MII
986 monitoring is enabled, and vice-versa.
988 To add ARP targets:
989 # echo +192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
990 # echo +192.168.0.101 > /sys/class/net/bond0/bonding/arp_ip_target
991 NOTE: up to 10 target addresses may be specified.
993 To remove an ARP target:
994 # echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
996 Example Configuration
997 ---------------------
998 We begin with the same example that is shown in section 3.3,
999 executed with sysfs, and without using ifenslave.
1001 To make a simple bond of two e100 devices (presumed to be eth0
1002 and eth1), and have it persist across reboots, edit the appropriate
1003 file (/etc/init.d/boot.local or /etc/rc.d/rc.local), and add the
1004 following:
1006 modprobe bonding
1007 modprobe e100
1008 echo balance-alb > /sys/class/net/bond0/bonding/mode
1009 ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
1010 echo 100 > /sys/class/net/bond0/bonding/miimon
1011 echo +eth0 > /sys/class/net/bond0/bonding/slaves
1012 echo +eth1 > /sys/class/net/bond0/bonding/slaves
1014 To add a second bond, with two e1000 interfaces in
1015 active-backup mode, using ARP monitoring, add the following lines to
1016 your init script:
1018 modprobe e1000
1019 echo +bond1 > /sys/class/net/bonding_masters
1020 echo active-backup > /sys/class/net/bond1/bonding/mode
1021 ifconfig bond1 192.168.2.1 netmask 255.255.255.0 up
1022 echo +192.168.2.100 /sys/class/net/bond1/bonding/arp_ip_target
1023 echo 2000 > /sys/class/net/bond1/bonding/arp_interval
1024 echo +eth2 > /sys/class/net/bond1/bonding/slaves
1025 echo +eth3 > /sys/class/net/bond1/bonding/slaves
1028 4. Querying Bonding Configuration
1029 =================================
1031 4.1 Bonding Configuration
1032 -------------------------
1034 Each bonding device has a read-only file residing in the
1035 /proc/net/bonding directory. The file contents include information
1036 about the bonding configuration, options and state of each slave.
1038 For example, the contents of /proc/net/bonding/bond0 after the
1039 driver is loaded with parameters of mode=0 and miimon=1000 is
1040 generally as follows:
1042 Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
1043 Bonding Mode: load balancing (round-robin)
1044 Currently Active Slave: eth0
1045 MII Status: up
1046 MII Polling Interval (ms): 1000
1047 Up Delay (ms): 0
1048 Down Delay (ms): 0
1050 Slave Interface: eth1
1051 MII Status: up
1052 Link Failure Count: 1
1054 Slave Interface: eth0
1055 MII Status: up
1056 Link Failure Count: 1
1058 The precise format and contents will change depending upon the
1059 bonding configuration, state, and version of the bonding driver.
1061 4.2 Network configuration
1062 -------------------------
1064 The network configuration can be inspected using the ifconfig
1065 command. Bonding devices will have the MASTER flag set; Bonding slave
1066 devices will have the SLAVE flag set. The ifconfig output does not
1067 contain information on which slaves are associated with which masters.
1069 In the example below, the bond0 interface is the master
1070 (MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of
1071 bond0 have the same MAC address (HWaddr) as bond0 for all modes except
1072 TLB and ALB that require a unique MAC address for each slave.
1074 # /sbin/ifconfig
1075 bond0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
1076 inet addr:XXX.XXX.XXX.YYY Bcast:XXX.XXX.XXX.255 Mask:255.255.252.0
1077 UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
1078 RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
1079 TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
1080 collisions:0 txqueuelen:0
1082 eth0 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
1083 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
1084 RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
1085 TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
1086 collisions:0 txqueuelen:100
1087 Interrupt:10 Base address:0x1080
1089 eth1 Link encap:Ethernet HWaddr 00:C0:F0:1F:37:B4
1090 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
1091 RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
1092 TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
1093 collisions:0 txqueuelen:100
1094 Interrupt:9 Base address:0x1400
1096 5. Switch Configuration
1097 =======================
1099 For this section, "switch" refers to whatever system the
1100 bonded devices are directly connected to (i.e., where the other end of
1101 the cable plugs into). This may be an actual dedicated switch device,
1102 or it may be another regular system (e.g., another computer running
1103 Linux),
1105 The active-backup, balance-tlb and balance-alb modes do not
1106 require any specific configuration of the switch.
1108 The 802.3ad mode requires that the switch have the appropriate
1109 ports configured as an 802.3ad aggregation. The precise method used
1110 to configure this varies from switch to switch, but, for example, a
1111 Cisco 3550 series switch requires that the appropriate ports first be
1112 grouped together in a single etherchannel instance, then that
1113 etherchannel is set to mode "lacp" to enable 802.3ad (instead of
1114 standard EtherChannel).
1116 The balance-rr, balance-xor and broadcast modes generally
1117 require that the switch have the appropriate ports grouped together.
1118 The nomenclature for such a group differs between switches, it may be
1119 called an "etherchannel" (as in the Cisco example, above), a "trunk
1120 group" or some other similar variation. For these modes, each switch
1121 will also have its own configuration options for the switch's transmit
1122 policy to the bond. Typical choices include XOR of either the MAC or
1123 IP addresses. The transmit policy of the two peers does not need to
1124 match. For these three modes, the bonding mode really selects a
1125 transmit policy for an EtherChannel group; all three will interoperate
1126 with another EtherChannel group.
1129 6. 802.1q VLAN Support
1130 ======================
1132 It is possible to configure VLAN devices over a bond interface
1133 using the 8021q driver. However, only packets coming from the 8021q
1134 driver and passing through bonding will be tagged by default. Self
1135 generated packets, for example, bonding's learning packets or ARP
1136 packets generated by either ALB mode or the ARP monitor mechanism, are
1137 tagged internally by bonding itself. As a result, bonding must
1138 "learn" the VLAN IDs configured above it, and use those IDs to tag
1139 self generated packets.
1141 For reasons of simplicity, and to support the use of adapters
1142 that can do VLAN hardware acceleration offloading, the bonding
1143 interface declares itself as fully hardware offloading capable, it gets
1144 the add_vid/kill_vid notifications to gather the necessary
1145 information, and it propagates those actions to the slaves. In case
1146 of mixed adapter types, hardware accelerated tagged packets that
1147 should go through an adapter that is not offloading capable are
1148 "un-accelerated" by the bonding driver so the VLAN tag sits in the
1149 regular location.
1151 VLAN interfaces *must* be added on top of a bonding interface
1152 only after enslaving at least one slave. The bonding interface has a
1153 hardware address of 00:00:00:00:00:00 until the first slave is added.
1154 If the VLAN interface is created prior to the first enslavement, it
1155 would pick up the all-zeroes hardware address. Once the first slave
1156 is attached to the bond, the bond device itself will pick up the
1157 slave's hardware address, which is then available for the VLAN device.
1159 Also, be aware that a similar problem can occur if all slaves
1160 are released from a bond that still has one or more VLAN interfaces on
1161 top of it. When a new slave is added, the bonding interface will
1162 obtain its hardware address from the first slave, which might not
1163 match the hardware address of the VLAN interfaces (which was
1164 ultimately copied from an earlier slave).
1166 There are two methods to insure that the VLAN device operates
1167 with the correct hardware address if all slaves are removed from a
1168 bond interface:
1170 1. Remove all VLAN interfaces then recreate them
1172 2. Set the bonding interface's hardware address so that it
1173 matches the hardware address of the VLAN interfaces.
1175 Note that changing a VLAN interface's HW address would set the
1176 underlying device -- i.e. the bonding interface -- to promiscuous
1177 mode, which might not be what you want.
1180 7. Link Monitoring
1181 ==================
1183 The bonding driver at present supports two schemes for
1184 monitoring a slave device's link state: the ARP monitor and the MII
1185 monitor.
1187 At the present time, due to implementation restrictions in the
1188 bonding driver itself, it is not possible to enable both ARP and MII
1189 monitoring simultaneously.
1191 7.1 ARP Monitor Operation
1192 -------------------------
1194 The ARP monitor operates as its name suggests: it sends ARP
1195 queries to one or more designated peer systems on the network, and
1196 uses the response as an indication that the link is operating. This
1197 gives some assurance that traffic is actually flowing to and from one
1198 or more peers on the local network.
1200 The ARP monitor relies on the device driver itself to verify
1201 that traffic is flowing. In particular, the driver must keep up to
1202 date the last receive time, dev->last_rx, and transmit start time,
1203 dev->trans_start. If these are not updated by the driver, then the
1204 ARP monitor will immediately fail any slaves using that driver, and
1205 those slaves will stay down. If networking monitoring (tcpdump, etc)
1206 shows the ARP requests and replies on the network, then it may be that
1207 your device driver is not updating last_rx and trans_start.
1209 7.2 Configuring Multiple ARP Targets
1210 ------------------------------------
1212 While ARP monitoring can be done with just one target, it can
1213 be useful in a High Availability setup to have several targets to
1214 monitor. In the case of just one target, the target itself may go
1215 down or have a problem making it unresponsive to ARP requests. Having
1216 an additional target (or several) increases the reliability of the ARP
1217 monitoring.
1219 Multiple ARP targets must be separated by commas as follows:
1221 # example options for ARP monitoring with three targets
1222 alias bond0 bonding
1223 options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
1225 For just a single target the options would resemble:
1227 # example options for ARP monitoring with one target
1228 alias bond0 bonding
1229 options bond0 arp_interval=60 arp_ip_target=192.168.0.100
1232 7.3 MII Monitor Operation
1233 -------------------------
1235 The MII monitor monitors only the carrier state of the local
1236 network interface. It accomplishes this in one of three ways: by
1237 depending upon the device driver to maintain its carrier state, by
1238 querying the device's MII registers, or by making an ethtool query to
1239 the device.
1241 If the use_carrier module parameter is 1 (the default value),
1242 then the MII monitor will rely on the driver for carrier state
1243 information (via the netif_carrier subsystem). As explained in the
1244 use_carrier parameter information, above, if the MII monitor fails to
1245 detect carrier loss on the device (e.g., when the cable is physically
1246 disconnected), it may be that the driver does not support
1247 netif_carrier.
1249 If use_carrier is 0, then the MII monitor will first query the
1250 device's (via ioctl) MII registers and check the link state. If that
1251 request fails (not just that it returns carrier down), then the MII
1252 monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain
1253 the same information. If both methods fail (i.e., the driver either
1254 does not support or had some error in processing both the MII register
1255 and ethtool requests), then the MII monitor will assume the link is
1256 up.
1258 8. Potential Sources of Trouble
1259 ===============================
1261 8.1 Adventures in Routing
1262 -------------------------
1264 When bonding is configured, it is important that the slave
1265 devices not have routes that supersede routes of the master (or,
1266 generally, not have routes at all). For example, suppose the bonding
1267 device bond0 has two slaves, eth0 and eth1, and the routing table is
1268 as follows:
1270 Kernel IP routing table
1271 Destination Gateway Genmask Flags MSS Window irtt Iface
1272 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth0
1273 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth1
1274 10.0.0.0 0.0.0.0 255.255.0.0 U 40 0 0 bond0
1275 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo
1277 This routing configuration will likely still update the
1278 receive/transmit times in the driver (needed by the ARP monitor), but
1279 may bypass the bonding driver (because outgoing traffic to, in this
1280 case, another host on network 10 would use eth0 or eth1 before bond0).
1282 The ARP monitor (and ARP itself) may become confused by this
1283 configuration, because ARP requests (generated by the ARP monitor)
1284 will be sent on one interface (bond0), but the corresponding reply
1285 will arrive on a different interface (eth0). This reply looks to ARP
1286 as an unsolicited ARP reply (because ARP matches replies on an
1287 interface basis), and is discarded. The MII monitor is not affected
1288 by the state of the routing table.
1290 The solution here is simply to insure that slaves do not have
1291 routes of their own, and if for some reason they must, those routes do
1292 not supersede routes of their master. This should generally be the
1293 case, but unusual configurations or errant manual or automatic static
1294 route additions may cause trouble.
1296 8.2 Ethernet Device Renaming
1297 ----------------------------
1299 On systems with network configuration scripts that do not
1300 associate physical devices directly with network interface names (so
1301 that the same physical device always has the same "ethX" name), it may
1302 be necessary to add some special logic to either /etc/modules.conf or
1303 /etc/modprobe.conf (depending upon which is installed on the system).
1305 For example, given a modules.conf containing the following:
1307 alias bond0 bonding
1308 options bond0 mode=some-mode miimon=50
1309 alias eth0 tg3
1310 alias eth1 tg3
1311 alias eth2 e1000
1312 alias eth3 e1000
1314 If neither eth0 and eth1 are slaves to bond0, then when the
1315 bond0 interface comes up, the devices may end up reordered. This
1316 happens because bonding is loaded first, then its slave device's
1317 drivers are loaded next. Since no other drivers have been loaded,
1318 when the e1000 driver loads, it will receive eth0 and eth1 for its
1319 devices, but the bonding configuration tries to enslave eth2 and eth3
1320 (which may later be assigned to the tg3 devices).
1322 Adding the following:
1324 add above bonding e1000 tg3
1326 causes modprobe to load e1000 then tg3, in that order, when
1327 bonding is loaded. This command is fully documented in the
1328 modules.conf manual page.
1330 On systems utilizing modprobe.conf (or modprobe.conf.local),
1331 an equivalent problem can occur. In this case, the following can be
1332 added to modprobe.conf (or modprobe.conf.local, as appropriate), as
1333 follows (all on one line; it has been split here for clarity):
1335 install bonding /sbin/modprobe tg3; /sbin/modprobe e1000;
1336 /sbin/modprobe --ignore-install bonding
1338 This will, when loading the bonding module, rather than
1339 performing the normal action, instead execute the provided command.
1340 This command loads the device drivers in the order needed, then calls
1341 modprobe with --ignore-install to cause the normal action to then take
1342 place. Full documentation on this can be found in the modprobe.conf
1343 and modprobe manual pages.
1345 8.3. Painfully Slow Or No Failed Link Detection By Miimon
1346 ---------------------------------------------------------
1348 By default, bonding enables the use_carrier option, which
1349 instructs bonding to trust the driver to maintain carrier state.
1351 As discussed in the options section, above, some drivers do
1352 not support the netif_carrier_on/_off link state tracking system.
1353 With use_carrier enabled, bonding will always see these links as up,
1354 regardless of their actual state.
1356 Additionally, other drivers do support netif_carrier, but do
1357 not maintain it in real time, e.g., only polling the link state at
1358 some fixed interval. In this case, miimon will detect failures, but
1359 only after some long period of time has expired. If it appears that
1360 miimon is very slow in detecting link failures, try specifying
1361 use_carrier=0 to see if that improves the failure detection time. If
1362 it does, then it may be that the driver checks the carrier state at a
1363 fixed interval, but does not cache the MII register values (so the
1364 use_carrier=0 method of querying the registers directly works). If
1365 use_carrier=0 does not improve the failover, then the driver may cache
1366 the registers, or the problem may be elsewhere.
1368 Also, remember that miimon only checks for the device's
1369 carrier state. It has no way to determine the state of devices on or
1370 beyond other ports of a switch, or if a switch is refusing to pass
1371 traffic while still maintaining carrier on.
1373 9. SNMP agents
1374 ===============
1376 If running SNMP agents, the bonding driver should be loaded
1377 before any network drivers participating in a bond. This requirement
1378 is due to the interface index (ipAdEntIfIndex) being associated to
1379 the first interface found with a given IP address. That is, there is
1380 only one ipAdEntIfIndex for each IP address. For example, if eth0 and
1381 eth1 are slaves of bond0 and the driver for eth0 is loaded before the
1382 bonding driver, the interface for the IP address will be associated
1383 with the eth0 interface. This configuration is shown below, the IP
1384 address 192.168.1.1 has an interface index of 2 which indexes to eth0
1385 in the ifDescr table (ifDescr.2).
1387 interfaces.ifTable.ifEntry.ifDescr.1 = lo
1388 interfaces.ifTable.ifEntry.ifDescr.2 = eth0
1389 interfaces.ifTable.ifEntry.ifDescr.3 = eth1
1390 interfaces.ifTable.ifEntry.ifDescr.4 = eth2
1391 interfaces.ifTable.ifEntry.ifDescr.5 = eth3
1392 interfaces.ifTable.ifEntry.ifDescr.6 = bond0
1393 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
1394 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
1395 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
1396 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
1398 This problem is avoided by loading the bonding driver before
1399 any network drivers participating in a bond. Below is an example of
1400 loading the bonding driver first, the IP address 192.168.1.1 is
1401 correctly associated with ifDescr.2.
1403 interfaces.ifTable.ifEntry.ifDescr.1 = lo
1404 interfaces.ifTable.ifEntry.ifDescr.2 = bond0
1405 interfaces.ifTable.ifEntry.ifDescr.3 = eth0
1406 interfaces.ifTable.ifEntry.ifDescr.4 = eth1
1407 interfaces.ifTable.ifEntry.ifDescr.5 = eth2
1408 interfaces.ifTable.ifEntry.ifDescr.6 = eth3
1409 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
1410 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
1411 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
1412 ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
1414 While some distributions may not report the interface name in
1415 ifDescr, the association between the IP address and IfIndex remains
1416 and SNMP functions such as Interface_Scan_Next will report that
1417 association.
1419 10. Promiscuous mode
1420 ====================
1422 When running network monitoring tools, e.g., tcpdump, it is
1423 common to enable promiscuous mode on the device, so that all traffic
1424 is seen (instead of seeing only traffic destined for the local host).
1425 The bonding driver handles promiscuous mode changes to the bonding
1426 master device (e.g., bond0), and propagates the setting to the slave
1427 devices.
1429 For the balance-rr, balance-xor, broadcast, and 802.3ad modes,
1430 the promiscuous mode setting is propagated to all slaves.
1432 For the active-backup, balance-tlb and balance-alb modes, the
1433 promiscuous mode setting is propagated only to the active slave.
1435 For balance-tlb mode, the active slave is the slave currently
1436 receiving inbound traffic.
1438 For balance-alb mode, the active slave is the slave used as a
1439 "primary." This slave is used for mode-specific control traffic, for
1440 sending to peers that are unassigned or if the load is unbalanced.
1442 For the active-backup, balance-tlb and balance-alb modes, when
1443 the active slave changes (e.g., due to a link failure), the
1444 promiscuous setting will be propagated to the new active slave.
1446 11. Configuring Bonding for High Availability
1447 =============================================
1449 High Availability refers to configurations that provide
1450 maximum network availability by having redundant or backup devices,
1451 links or switches between the host and the rest of the world. The
1452 goal is to provide the maximum availability of network connectivity
1453 (i.e., the network always works), even though other configurations
1454 could provide higher throughput.
1456 11.1 High Availability in a Single Switch Topology
1457 --------------------------------------------------
1459 If two hosts (or a host and a single switch) are directly
1460 connected via multiple physical links, then there is no availability
1461 penalty to optimizing for maximum bandwidth. In this case, there is
1462 only one switch (or peer), so if it fails, there is no alternative
1463 access to fail over to. Additionally, the bonding load balance modes
1464 support link monitoring of their members, so if individual links fail,
1465 the load will be rebalanced across the remaining devices.
1467 See Section 13, "Configuring Bonding for Maximum Throughput"
1468 for information on configuring bonding with one peer device.
1470 11.2 High Availability in a Multiple Switch Topology
1471 ----------------------------------------------------
1473 With multiple switches, the configuration of bonding and the
1474 network changes dramatically. In multiple switch topologies, there is
1475 a trade off between network availability and usable bandwidth.
1477 Below is a sample network, configured to maximize the
1478 availability of the network:
1480 | |
1481 |port3 port3|
1482 +-----+----+ +-----+----+
1483 | |port2 ISL port2| |
1484 | switch A +--------------------------+ switch B |
1485 | | | |
1486 +-----+----+ +-----++---+
1487 |port1 port1|
1488 | +-------+ |
1489 +-------------+ host1 +---------------+
1490 eth0 +-------+ eth1
1492 In this configuration, there is a link between the two
1493 switches (ISL, or inter switch link), and multiple ports connecting to
1494 the outside world ("port3" on each switch). There is no technical
1495 reason that this could not be extended to a third switch.
1497 11.2.1 HA Bonding Mode Selection for Multiple Switch Topology
1498 -------------------------------------------------------------
1500 In a topology such as the example above, the active-backup and
1501 broadcast modes are the only useful bonding modes when optimizing for
1502 availability; the other modes require all links to terminate on the
1503 same peer for them to behave rationally.
1505 active-backup: This is generally the preferred mode, particularly if
1506 the switches have an ISL and play together well. If the
1507 network configuration is such that one switch is specifically
1508 a backup switch (e.g., has lower capacity, higher cost, etc),
1509 then the primary option can be used to insure that the
1510 preferred link is always used when it is available.
1512 broadcast: This mode is really a special purpose mode, and is suitable
1513 only for very specific needs. For example, if the two
1514 switches are not connected (no ISL), and the networks beyond
1515 them are totally independent. In this case, if it is
1516 necessary for some specific one-way traffic to reach both
1517 independent networks, then the broadcast mode may be suitable.
1519 11.2.2 HA Link Monitoring Selection for Multiple Switch Topology
1520 ----------------------------------------------------------------
1522 The choice of link monitoring ultimately depends upon your
1523 switch. If the switch can reliably fail ports in response to other
1524 failures, then either the MII or ARP monitors should work. For
1525 example, in the above example, if the "port3" link fails at the remote
1526 end, the MII monitor has no direct means to detect this. The ARP
1527 monitor could be configured with a target at the remote end of port3,
1528 thus detecting that failure without switch support.
1530 In general, however, in a multiple switch topology, the ARP
1531 monitor can provide a higher level of reliability in detecting end to
1532 end connectivity failures (which may be caused by the failure of any
1533 individual component to pass traffic for any reason). Additionally,
1534 the ARP monitor should be configured with multiple targets (at least
1535 one for each switch in the network). This will insure that,
1536 regardless of which switch is active, the ARP monitor has a suitable
1537 target to query.
1540 12. Configuring Bonding for Maximum Throughput
1541 ==============================================
1543 12.1 Maximizing Throughput in a Single Switch Topology
1544 ------------------------------------------------------
1546 In a single switch configuration, the best method to maximize
1547 throughput depends upon the application and network environment. The
1548 various load balancing modes each have strengths and weaknesses in
1549 different environments, as detailed below.
1551 For this discussion, we will break down the topologies into
1552 two categories. Depending upon the destination of most traffic, we
1553 categorize them into either "gatewayed" or "local" configurations.
1555 In a gatewayed configuration, the "switch" is acting primarily
1556 as a router, and the majority of traffic passes through this router to
1557 other networks. An example would be the following:
1560 +----------+ +----------+
1561 | |eth0 port1| | to other networks
1562 | Host A +---------------------+ router +------------------->
1563 | +---------------------+ | Hosts B and C are out
1564 | |eth1 port2| | here somewhere
1565 +----------+ +----------+
1567 The router may be a dedicated router device, or another host
1568 acting as a gateway. For our discussion, the important point is that
1569 the majority of traffic from Host A will pass through the router to
1570 some other network before reaching its final destination.
1572 In a gatewayed network configuration, although Host A may
1573 communicate with many other systems, all of its traffic will be sent
1574 and received via one other peer on the local network, the router.
1576 Note that the case of two systems connected directly via
1577 multiple physical links is, for purposes of configuring bonding, the
1578 same as a gatewayed configuration. In that case, it happens that all
1579 traffic is destined for the "gateway" itself, not some other network
1580 beyond the gateway.
1582 In a local configuration, the "switch" is acting primarily as
1583 a switch, and the majority of traffic passes through this switch to
1584 reach other stations on the same network. An example would be the
1585 following:
1587 +----------+ +----------+ +--------+
1588 | |eth0 port1| +-------+ Host B |
1589 | Host A +------------+ switch |port3 +--------+
1590 | +------------+ | +--------+
1591 | |eth1 port2| +------------------+ Host C |
1592 +----------+ +----------+port4 +--------+
1595 Again, the switch may be a dedicated switch device, or another
1596 host acting as a gateway. For our discussion, the important point is
1597 that the majority of traffic from Host A is destined for other hosts
1598 on the same local network (Hosts B and C in the above example).
1600 In summary, in a gatewayed configuration, traffic to and from
1601 the bonded device will be to the same MAC level peer on the network
1602 (the gateway itself, i.e., the router), regardless of its final
1603 destination. In a local configuration, traffic flows directly to and
1604 from the final destinations, thus, each destination (Host B, Host C)
1605 will be addressed directly by their individual MAC addresses.
1607 This distinction between a gatewayed and a local network
1608 configuration is important because many of the load balancing modes
1609 available use the MAC addresses of the local network source and
1610 destination to make load balancing decisions. The behavior of each
1611 mode is described below.
1614 12.1.1 MT Bonding Mode Selection for Single Switch Topology
1615 -----------------------------------------------------------
1617 This configuration is the easiest to set up and to understand,
1618 although you will have to decide which bonding mode best suits your
1619 needs. The trade offs for each mode are detailed below:
1621 balance-rr: This mode is the only mode that will permit a single
1622 TCP/IP connection to stripe traffic across multiple
1623 interfaces. It is therefore the only mode that will allow a
1624 single TCP/IP stream to utilize more than one interface's
1625 worth of throughput. This comes at a cost, however: the
1626 striping often results in peer systems receiving packets out
1627 of order, causing TCP/IP's congestion control system to kick
1628 in, often by retransmitting segments.
1630 It is possible to adjust TCP/IP's congestion limits by
1631 altering the net.ipv4.tcp_reordering sysctl parameter. The
1632 usual default value is 3, and the maximum useful value is 127.
1633 For a four interface balance-rr bond, expect that a single
1634 TCP/IP stream will utilize no more than approximately 2.3
1635 interface's worth of throughput, even after adjusting
1636 tcp_reordering.
1638 Note that this out of order delivery occurs when both the
1639 sending and receiving systems are utilizing a multiple
1640 interface bond. Consider a configuration in which a
1641 balance-rr bond feeds into a single higher capacity network
1642 channel (e.g., multiple 100Mb/sec ethernets feeding a single
1643 gigabit ethernet via an etherchannel capable switch). In this
1644 configuration, traffic sent from the multiple 100Mb devices to
1645 a destination connected to the gigabit device will not see
1646 packets out of order. However, traffic sent from the gigabit
1647 device to the multiple 100Mb devices may or may not see
1648 traffic out of order, depending upon the balance policy of the
1649 switch. Many switches do not support any modes that stripe
1650 traffic (instead choosing a port based upon IP or MAC level
1651 addresses); for those devices, traffic flowing from the
1652 gigabit device to the many 100Mb devices will only utilize one
1653 interface.
1655 If you are utilizing protocols other than TCP/IP, UDP for
1656 example, and your application can tolerate out of order
1657 delivery, then this mode can allow for single stream datagram
1658 performance that scales near linearly as interfaces are added
1659 to the bond.
1661 This mode requires the switch to have the appropriate ports
1662 configured for "etherchannel" or "trunking."
1664 active-backup: There is not much advantage in this network topology to
1665 the active-backup mode, as the inactive backup devices are all
1666 connected to the same peer as the primary. In this case, a
1667 load balancing mode (with link monitoring) will provide the
1668 same level of network availability, but with increased
1669 available bandwidth. On the plus side, active-backup mode
1670 does not require any configuration of the switch, so it may
1671 have value if the hardware available does not support any of
1672 the load balance modes.
1674 balance-xor: This mode will limit traffic such that packets destined
1675 for specific peers will always be sent over the same
1676 interface. Since the destination is determined by the MAC
1677 addresses involved, this mode works best in a "local" network
1678 configuration (as described above), with destinations all on
1679 the same local network. This mode is likely to be suboptimal
1680 if all your traffic is passed through a single router (i.e., a
1681 "gatewayed" network configuration, as described above).
1683 As with balance-rr, the switch ports need to be configured for
1684 "etherchannel" or "trunking."
1686 broadcast: Like active-backup, there is not much advantage to this
1687 mode in this type of network topology.
1689 802.3ad: This mode can be a good choice for this type of network
1690 topology. The 802.3ad mode is an IEEE standard, so all peers
1691 that implement 802.3ad should interoperate well. The 802.3ad
1692 protocol includes automatic configuration of the aggregates,
1693 so minimal manual configuration of the switch is needed
1694 (typically only to designate that some set of devices is
1695 available for 802.3ad). The 802.3ad standard also mandates
1696 that frames be delivered in order (within certain limits), so
1697 in general single connections will not see misordering of
1698 packets. The 802.3ad mode does have some drawbacks: the
1699 standard mandates that all devices in the aggregate operate at
1700 the same speed and duplex. Also, as with all bonding load
1701 balance modes other than balance-rr, no single connection will
1702 be able to utilize more than a single interface's worth of
1703 bandwidth.
1705 Additionally, the linux bonding 802.3ad implementation
1706 distributes traffic by peer (using an XOR of MAC addresses),
1707 so in a "gatewayed" configuration, all outgoing traffic will
1708 generally use the same device. Incoming traffic may also end
1709 up on a single device, but that is dependent upon the
1710 balancing policy of the peer's 8023.ad implementation. In a
1711 "local" configuration, traffic will be distributed across the
1712 devices in the bond.
1714 Finally, the 802.3ad mode mandates the use of the MII monitor,
1715 therefore, the ARP monitor is not available in this mode.
1717 balance-tlb: The balance-tlb mode balances outgoing traffic by peer.
1718 Since the balancing is done according to MAC address, in a
1719 "gatewayed" configuration (as described above), this mode will
1720 send all traffic across a single device. However, in a
1721 "local" network configuration, this mode balances multiple
1722 local network peers across devices in a vaguely intelligent
1723 manner (not a simple XOR as in balance-xor or 802.3ad mode),
1724 so that mathematically unlucky MAC addresses (i.e., ones that
1725 XOR to the same value) will not all "bunch up" on a single
1726 interface.
1728 Unlike 802.3ad, interfaces may be of differing speeds, and no
1729 special switch configuration is required. On the down side,
1730 in this mode all incoming traffic arrives over a single
1731 interface, this mode requires certain ethtool support in the
1732 network device driver of the slave interfaces, and the ARP
1733 monitor is not available.
1735 balance-alb: This mode is everything that balance-tlb is, and more.
1736 It has all of the features (and restrictions) of balance-tlb,
1737 and will also balance incoming traffic from local network
1738 peers (as described in the Bonding Module Options section,
1739 above).
1741 The only additional down side to this mode is that the network
1742 device driver must support changing the hardware address while
1743 the device is open.
1745 12.1.2 MT Link Monitoring for Single Switch Topology
1746 ----------------------------------------------------
1748 The choice of link monitoring may largely depend upon which
1749 mode you choose to use. The more advanced load balancing modes do not
1750 support the use of the ARP monitor, and are thus restricted to using
1751 the MII monitor (which does not provide as high a level of end to end
1752 assurance as the ARP monitor).
1754 12.2 Maximum Throughput in a Multiple Switch Topology
1755 -----------------------------------------------------
1757 Multiple switches may be utilized to optimize for throughput
1758 when they are configured in parallel as part of an isolated network
1759 between two or more systems, for example:
1761 +-----------+
1762 | Host A |
1763 +-+---+---+-+
1764 | | |
1765 +--------+ | +---------+
1766 | | |
1767 +------+---+ +-----+----+ +-----+----+
1768 | Switch A | | Switch B | | Switch C |
1769 +------+---+ +-----+----+ +-----+----+
1770 | | |
1771 +--------+ | +---------+
1772 | | |
1773 +-+---+---+-+
1774 | Host B |
1775 +-----------+
1777 In this configuration, the switches are isolated from one
1778 another. One reason to employ a topology such as this is for an
1779 isolated network with many hosts (a cluster configured for high
1780 performance, for example), using multiple smaller switches can be more
1781 cost effective than a single larger switch, e.g., on a network with 24
1782 hosts, three 24 port switches can be significantly less expensive than
1783 a single 72 port switch.
1785 If access beyond the network is required, an individual host
1786 can be equipped with an additional network device connected to an
1787 external network; this host then additionally acts as a gateway.
1789 12.2.1 MT Bonding Mode Selection for Multiple Switch Topology
1790 -------------------------------------------------------------
1792 In actual practice, the bonding mode typically employed in
1793 configurations of this type is balance-rr. Historically, in this
1794 network configuration, the usual caveats about out of order packet
1795 delivery are mitigated by the use of network adapters that do not do
1796 any kind of packet coalescing (via the use of NAPI, or because the
1797 device itself does not generate interrupts until some number of
1798 packets has arrived). When employed in this fashion, the balance-rr
1799 mode allows individual connections between two hosts to effectively
1800 utilize greater than one interface's bandwidth.
1802 12.2.2 MT Link Monitoring for Multiple Switch Topology
1803 ------------------------------------------------------
1805 Again, in actual practice, the MII monitor is most often used
1806 in this configuration, as performance is given preference over
1807 availability. The ARP monitor will function in this topology, but its
1808 advantages over the MII monitor are mitigated by the volume of probes
1809 needed as the number of systems involved grows (remember that each
1810 host in the network is configured with bonding).
1812 13. Switch Behavior Issues
1813 ==========================
1815 13.1 Link Establishment and Failover Delays
1816 -------------------------------------------
1818 Some switches exhibit undesirable behavior with regard to the
1819 timing of link up and down reporting by the switch.
1821 First, when a link comes up, some switches may indicate that
1822 the link is up (carrier available), but not pass traffic over the
1823 interface for some period of time. This delay is typically due to
1824 some type of autonegotiation or routing protocol, but may also occur
1825 during switch initialization (e.g., during recovery after a switch
1826 failure). If you find this to be a problem, specify an appropriate
1827 value to the updelay bonding module option to delay the use of the
1828 relevant interface(s).
1830 Second, some switches may "bounce" the link state one or more
1831 times while a link is changing state. This occurs most commonly while
1832 the switch is initializing. Again, an appropriate updelay value may
1833 help.
1835 Note that when a bonding interface has no active links, the
1836 driver will immediately reuse the first link that goes up, even if the
1837 updelay parameter has been specified (the updelay is ignored in this
1838 case). If there are slave interfaces waiting for the updelay timeout
1839 to expire, the interface that first went into that state will be
1840 immediately reused. This reduces down time of the network if the
1841 value of updelay has been overestimated, and since this occurs only in
1842 cases with no connectivity, there is no additional penalty for
1843 ignoring the updelay.
1845 In addition to the concerns about switch timings, if your
1846 switches take a long time to go into backup mode, it may be desirable
1847 to not activate a backup interface immediately after a link goes down.
1848 Failover may be delayed via the downdelay bonding module option.
1850 13.2 Duplicated Incoming Packets
1851 --------------------------------
1853 It is not uncommon to observe a short burst of duplicated
1854 traffic when the bonding device is first used, or after it has been
1855 idle for some period of time. This is most easily observed by issuing
1856 a "ping" to some other host on the network, and noticing that the
1857 output from ping flags duplicates (typically one per slave).
1859 For example, on a bond in active-backup mode with five slaves
1860 all connected to one switch, the output may appear as follows:
1862 # ping -n 10.0.4.2
1863 PING 10.0.4.2 (10.0.4.2) from 10.0.3.10 : 56(84) bytes of data.
1864 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.7 ms
1865 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
1866 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
1867 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
1868 64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
1869 64 bytes from 10.0.4.2: icmp_seq=2 ttl=64 time=0.216 ms
1870 64 bytes from 10.0.4.2: icmp_seq=3 ttl=64 time=0.267 ms
1871 64 bytes from 10.0.4.2: icmp_seq=4 ttl=64 time=0.222 ms
1873 This is not due to an error in the bonding driver, rather, it
1874 is a side effect of how many switches update their MAC forwarding
1875 tables. Initially, the switch does not associate the MAC address in
1876 the packet with a particular switch port, and so it may send the
1877 traffic to all ports until its MAC forwarding table is updated. Since
1878 the interfaces attached to the bond may occupy multiple ports on a
1879 single switch, when the switch (temporarily) floods the traffic to all
1880 ports, the bond device receives multiple copies of the same packet
1881 (one per slave device).
1883 The duplicated packet behavior is switch dependent, some
1884 switches exhibit this, and some do not. On switches that display this
1885 behavior, it can be induced by clearing the MAC forwarding table (on
1886 most Cisco switches, the privileged command "clear mac address-table
1887 dynamic" will accomplish this).
1889 14. Hardware Specific Considerations
1890 ====================================
1892 This section contains additional information for configuring
1893 bonding on specific hardware platforms, or for interfacing bonding
1894 with particular switches or other devices.
1896 14.1 IBM BladeCenter
1897 --------------------
1899 This applies to the JS20 and similar systems.
1901 On the JS20 blades, the bonding driver supports only
1902 balance-rr, active-backup, balance-tlb and balance-alb modes. This is
1903 largely due to the network topology inside the BladeCenter, detailed
1904 below.
1906 JS20 network adapter information
1907 --------------------------------
1909 All JS20s come with two Broadcom Gigabit Ethernet ports
1910 integrated on the planar (that's "motherboard" in IBM-speak). In the
1911 BladeCenter chassis, the eth0 port of all JS20 blades is hard wired to
1912 I/O Module #1; similarly, all eth1 ports are wired to I/O Module #2.
1913 An add-on Broadcom daughter card can be installed on a JS20 to provide
1914 two more Gigabit Ethernet ports. These ports, eth2 and eth3, are
1915 wired to I/O Modules 3 and 4, respectively.
1917 Each I/O Module may contain either a switch or a passthrough
1918 module (which allows ports to be directly connected to an external
1919 switch). Some bonding modes require a specific BladeCenter internal
1920 network topology in order to function; these are detailed below.
1922 Additional BladeCenter-specific networking information can be
1923 found in two IBM Redbooks (www.ibm.com/redbooks):
1925 "IBM eServer BladeCenter Networking Options"
1926 "IBM eServer BladeCenter Layer 2-7 Network Switching"
1928 BladeCenter networking configuration
1929 ------------------------------------
1931 Because a BladeCenter can be configured in a very large number
1932 of ways, this discussion will be confined to describing basic
1933 configurations.
1935 Normally, Ethernet Switch Modules (ESMs) are used in I/O
1936 modules 1 and 2. In this configuration, the eth0 and eth1 ports of a
1937 JS20 will be connected to different internal switches (in the
1938 respective I/O modules).
1940 A passthrough module (OPM or CPM, optical or copper,
1941 passthrough module) connects the I/O module directly to an external
1942 switch. By using PMs in I/O module #1 and #2, the eth0 and eth1
1943 interfaces of a JS20 can be redirected to the outside world and
1944 connected to a common external switch.
1946 Depending upon the mix of ESMs and PMs, the network will
1947 appear to bonding as either a single switch topology (all PMs) or as a
1948 multiple switch topology (one or more ESMs, zero or more PMs). It is
1949 also possible to connect ESMs together, resulting in a configuration
1950 much like the example in "High Availability in a Multiple Switch
1951 Topology," above.
1953 Requirements for specific modes
1954 -------------------------------
1956 The balance-rr mode requires the use of passthrough modules
1957 for devices in the bond, all connected to an common external switch.
1958 That switch must be configured for "etherchannel" or "trunking" on the
1959 appropriate ports, as is usual for balance-rr.
1961 The balance-alb and balance-tlb modes will function with
1962 either switch modules or passthrough modules (or a mix). The only
1963 specific requirement for these modes is that all network interfaces
1964 must be able to reach all destinations for traffic sent over the
1965 bonding device (i.e., the network must converge at some point outside
1966 the BladeCenter).
1968 The active-backup mode has no additional requirements.
1970 Link monitoring issues
1971 ----------------------
1973 When an Ethernet Switch Module is in place, only the ARP
1974 monitor will reliably detect link loss to an external switch. This is
1975 nothing unusual, but examination of the BladeCenter cabinet would
1976 suggest that the "external" network ports are the ethernet ports for
1977 the system, when it fact there is a switch between these "external"
1978 ports and the devices on the JS20 system itself. The MII monitor is
1979 only able to detect link failures between the ESM and the JS20 system.
1981 When a passthrough module is in place, the MII monitor does
1982 detect failures to the "external" port, which is then directly
1983 connected to the JS20 system.
1985 Other concerns
1986 --------------
1988 The Serial Over LAN (SoL) link is established over the primary
1989 ethernet (eth0) only, therefore, any loss of link to eth0 will result
1990 in losing your SoL connection. It will not fail over with other
1991 network traffic, as the SoL system is beyond the control of the
1992 bonding driver.
1994 It may be desirable to disable spanning tree on the switch
1995 (either the internal Ethernet Switch Module, or an external switch) to
1996 avoid fail-over delay issues when using bonding.
1999 15. Frequently Asked Questions
2000 ==============================
2002 1. Is it SMP safe?
2004 Yes. The old 2.0.xx channel bonding patch was not SMP safe.
2005 The new driver was designed to be SMP safe from the start.
2007 2. What type of cards will work with it?
2009 Any Ethernet type cards (you can even mix cards - a Intel
2010 EtherExpress PRO/100 and a 3com 3c905b, for example). For most modes,
2011 devices need not be of the same speed.
2013 3. How many bonding devices can I have?
2015 There is no limit.
2017 4. How many slaves can a bonding device have?
2019 This is limited only by the number of network interfaces Linux
2020 supports and/or the number of network cards you can place in your
2021 system.
2023 5. What happens when a slave link dies?
2025 If link monitoring is enabled, then the failing device will be
2026 disabled. The active-backup mode will fail over to a backup link, and
2027 other modes will ignore the failed link. The link will continue to be
2028 monitored, and should it recover, it will rejoin the bond (in whatever
2029 manner is appropriate for the mode). See the sections on High
2030 Availability and the documentation for each mode for additional
2031 information.
2033 Link monitoring can be enabled via either the miimon or
2034 arp_interval parameters (described in the module parameters section,
2035 above). In general, miimon monitors the carrier state as sensed by
2036 the underlying network device, and the arp monitor (arp_interval)
2037 monitors connectivity to another host on the local network.
2039 If no link monitoring is configured, the bonding driver will
2040 be unable to detect link failures, and will assume that all links are
2041 always available. This will likely result in lost packets, and a
2042 resulting degradation of performance. The precise performance loss
2043 depends upon the bonding mode and network configuration.
2045 6. Can bonding be used for High Availability?
2047 Yes. See the section on High Availability for details.
2049 7. Which switches/systems does it work with?
2051 The full answer to this depends upon the desired mode.
2053 In the basic balance modes (balance-rr and balance-xor), it
2054 works with any system that supports etherchannel (also called
2055 trunking). Most managed switches currently available have such
2056 support, and many unmanaged switches as well.
2058 The advanced balance modes (balance-tlb and balance-alb) do
2059 not have special switch requirements, but do need device drivers that
2060 support specific features (described in the appropriate section under
2061 module parameters, above).
2063 In 802.3ad mode, it works with systems that support IEEE
2064 802.3ad Dynamic Link Aggregation. Most managed and many unmanaged
2065 switches currently available support 802.3ad.
2067 The active-backup mode should work with any Layer-II switch.
2069 8. Where does a bonding device get its MAC address from?
2071 If not explicitly configured (with ifconfig or ip link), the
2072 MAC address of the bonding device is taken from its first slave
2073 device. This MAC address is then passed to all following slaves and
2074 remains persistent (even if the first slave is removed) until the
2075 bonding device is brought down or reconfigured.
2077 If you wish to change the MAC address, you can set it with
2078 ifconfig or ip link:
2080 # ifconfig bond0 hw ether 00:11:22:33:44:55
2082 # ip link set bond0 address 66:77:88:99:aa:bb
2084 The MAC address can be also changed by bringing down/up the
2085 device and then changing its slaves (or their order):
2087 # ifconfig bond0 down ; modprobe -r bonding
2088 # ifconfig bond0 .... up
2089 # ifenslave bond0 eth...
2091 This method will automatically take the address from the next
2092 slave that is added.
2094 To restore your slaves' MAC addresses, you need to detach them
2095 from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
2096 then restore the MAC addresses that the slaves had before they were
2097 enslaved.
2099 16. Resources and Links
2100 =======================
2102 The latest version of the bonding driver can be found in the latest
2103 version of the linux kernel, found on http://kernel.org
2105 The latest version of this document can be found in either the latest
2106 kernel source (named Documentation/networking/bonding.txt), or on the
2107 bonding sourceforge site:
2109 http://www.sourceforge.net/projects/bonding
2111 Discussions regarding the bonding driver take place primarily on the
2112 bonding-devel mailing list, hosted at sourceforge.net. If you have
2113 questions or problems, post them to the list. The list address is:
2115 bonding-devel@lists.sourceforge.net
2117 The administrative interface (to subscribe or unsubscribe) can
2118 be found at:
2120 https://lists.sourceforge.net/lists/listinfo/bonding-devel
2122 Donald Becker's Ethernet Drivers and diag programs may be found at :
2123 - http://www.scyld.com/network/
2125 You will also find a lot of information regarding Ethernet, NWay, MII,
2126 etc. at www.scyld.com.
2128 -- END --