Blame README.bonding

Packit Service 6f2e62
Packit Service 6f2e62
		Linux Ethernet Bonding Driver HOWTO
Packit Service 6f2e62
Packit Service 6f2e62
		Latest update: 27 April 2011
Packit Service 6f2e62
Packit Service 6f2e62
Initial release : Thomas Davis <tadavis at lbl.gov>
Packit Service 6f2e62
Corrections, HA extensions : 2000/10/03-15 :
Packit Service 6f2e62
  - Willy Tarreau <willy at meta-x.org>
Packit Service 6f2e62
  - Constantine Gavrilov <const-g at xpert.com>
Packit Service 6f2e62
  - Chad N. Tindel <ctindel at ieee dot org>
Packit Service 6f2e62
  - Janice Girouard <girouard at us dot ibm dot com>
Packit Service 6f2e62
  - Jay Vosburgh <fubar at us dot ibm dot com>
Packit Service 6f2e62
Packit Service 6f2e62
Reorganized and updated Feb 2005 by Jay Vosburgh
Packit Service 6f2e62
Added Sysfs information: 2006/04/24
Packit Service 6f2e62
  - Mitch Williams <mitch.a.williams at intel.com>
Packit Service 6f2e62
Packit Service 6f2e62
Introduction
Packit Service 6f2e62
============
Packit Service 6f2e62
Packit Service 6f2e62
	The Linux bonding driver provides a method for aggregating
Packit Service 6f2e62
multiple network interfaces into a single logical "bonded" interface.
Packit Service 6f2e62
The behavior of the bonded interfaces depends upon the mode; generally
Packit Service 6f2e62
speaking, modes provide either hot standby or load balancing services.
Packit Service 6f2e62
Additionally, link integrity monitoring may be performed.
Packit Service 6f2e62
	
Packit Service 6f2e62
	The bonding driver originally came from Donald Becker's
Packit Service 6f2e62
beowulf patches for kernel 2.0. It has changed quite a bit since, and
Packit Service 6f2e62
the original tools from extreme-linux and beowulf sites will not work
Packit Service 6f2e62
with this version of the driver.
Packit Service 6f2e62
Packit Service 6f2e62
	For new versions of the driver, updated userspace tools, and
Packit Service 6f2e62
who to ask for help, please follow the links at the end of this file.
Packit Service 6f2e62
Packit Service 6f2e62
Table of Contents
Packit Service 6f2e62
=================
Packit Service 6f2e62
Packit Service 6f2e62
1. Bonding Driver Installation
Packit Service 6f2e62
Packit Service 6f2e62
2. Bonding Driver Options
Packit Service 6f2e62
Packit Service 6f2e62
3. Configuring Bonding Devices
Packit Service 6f2e62
3.1	Configuration with Sysconfig Support
Packit Service 6f2e62
3.1.1		Using DHCP with Sysconfig
Packit Service 6f2e62
3.1.2		Configuring Multiple Bonds with Sysconfig
Packit Service 6f2e62
3.2	Configuration with Initscripts Support
Packit Service 6f2e62
3.2.1		Using DHCP with Initscripts
Packit Service 6f2e62
3.2.2		Configuring Multiple Bonds with Initscripts
Packit Service 6f2e62
3.3	Configuring Bonding Manually with Ifenslave
Packit Service 6f2e62
3.3.1		Configuring Multiple Bonds Manually
Packit Service 6f2e62
3.4	Configuring Bonding Manually via Sysfs
Packit Service 6f2e62
3.5	Configuration with Interfaces Support
Packit Service 6f2e62
3.6	Overriding Configuration for Special Cases
Packit Service 6f2e62
Packit Service 6f2e62
4. Querying Bonding Configuration
Packit Service 6f2e62
4.1	Bonding Configuration
Packit Service 6f2e62
4.2	Network Configuration
Packit Service 6f2e62
Packit Service 6f2e62
5. Switch Configuration
Packit Service 6f2e62
Packit Service 6f2e62
6. 802.1q VLAN Support
Packit Service 6f2e62
Packit Service 6f2e62
7. Link Monitoring
Packit Service 6f2e62
7.1	ARP Monitor Operation
Packit Service 6f2e62
7.2	Configuring Multiple ARP Targets
Packit Service 6f2e62
7.3	MII Monitor Operation
Packit Service 6f2e62
Packit Service 6f2e62
8. Potential Trouble Sources
Packit Service 6f2e62
8.1	Adventures in Routing
Packit Service 6f2e62
8.2	Ethernet Device Renaming
Packit Service 6f2e62
8.3	Painfully Slow Or No Failed Link Detection By Miimon
Packit Service 6f2e62
Packit Service 6f2e62
9. SNMP agents
Packit Service 6f2e62
Packit Service 6f2e62
10. Promiscuous mode
Packit Service 6f2e62
Packit Service 6f2e62
11. Configuring Bonding for High Availability
Packit Service 6f2e62
11.1	High Availability in a Single Switch Topology
Packit Service 6f2e62
11.2	High Availability in a Multiple Switch Topology
Packit Service 6f2e62
11.2.1		HA Bonding Mode Selection for Multiple Switch Topology
Packit Service 6f2e62
11.2.2		HA Link Monitoring for Multiple Switch Topology
Packit Service 6f2e62
Packit Service 6f2e62
12. Configuring Bonding for Maximum Throughput
Packit Service 6f2e62
12.1	Maximum Throughput in a Single Switch Topology
Packit Service 6f2e62
12.1.1		MT Bonding Mode Selection for Single Switch Topology
Packit Service 6f2e62
12.1.2		MT Link Monitoring for Single Switch Topology
Packit Service 6f2e62
12.2	Maximum Throughput in a Multiple Switch Topology
Packit Service 6f2e62
12.2.1		MT Bonding Mode Selection for Multiple Switch Topology
Packit Service 6f2e62
12.2.2		MT Link Monitoring for Multiple Switch Topology
Packit Service 6f2e62
Packit Service 6f2e62
13. Switch Behavior Issues
Packit Service 6f2e62
13.1	Link Establishment and Failover Delays
Packit Service 6f2e62
13.2	Duplicated Incoming Packets
Packit Service 6f2e62
Packit Service 6f2e62
14. Hardware Specific Considerations
Packit Service 6f2e62
14.1	IBM BladeCenter
Packit Service 6f2e62
Packit Service 6f2e62
15. Frequently Asked Questions
Packit Service 6f2e62
Packit Service 6f2e62
16. Resources and Links
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
1. Bonding Driver Installation
Packit Service 6f2e62
==============================
Packit Service 6f2e62
Packit Service 6f2e62
	Most popular distro kernels ship with the bonding driver
Packit Service 6f2e62
already available as a module and the ifenslave user level control
Packit Service 6f2e62
program installed and ready for use. If your distro does not, or you
Packit Service 6f2e62
have need to compile bonding from source (e.g., configuring and
Packit Service 6f2e62
installing a mainline kernel from kernel.org), you'll need to perform
Packit Service 6f2e62
the following steps:
Packit Service 6f2e62
Packit Service 6f2e62
1.1 Configure and build the kernel with bonding
Packit Service 6f2e62
-----------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The current version of the bonding driver is available in the
Packit Service 6f2e62
drivers/net/bonding subdirectory of the most recent kernel source
Packit Service 6f2e62
(which is available on http://kernel.org).  Most users "rolling their
Packit Service 6f2e62
own" will want to use the most recent kernel from kernel.org.
Packit Service 6f2e62
Packit Service 6f2e62
	Configure kernel with "make menuconfig" (or "make xconfig" or
Packit Service 6f2e62
"make config"), then select "Bonding driver support" in the "Network
Packit Service 6f2e62
device support" section.  It is recommended that you configure the
Packit Service 6f2e62
driver as module since it is currently the only way to pass parameters
Packit Service 6f2e62
to the driver or configure more than one bonding device.
Packit Service 6f2e62
Packit Service 6f2e62
	Build and install the new kernel and modules, then continue
Packit Service 6f2e62
below to install ifenslave.
Packit Service 6f2e62
Packit Service 6f2e62
1.2 Install ifenslave Control Utility
Packit Service 6f2e62
-------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The ifenslave user level control program is included in the
Packit Service 6f2e62
kernel source tree, in the file Documentation/networking/ifenslave.c.
Packit Service 6f2e62
It is generally recommended that you use the ifenslave that
Packit Service 6f2e62
corresponds to the kernel that you are using (either from the same
Packit Service 6f2e62
source tree or supplied with the distro), however, ifenslave
Packit Service 6f2e62
executables from older kernels should function (but features newer
Packit Service 6f2e62
than the ifenslave release are not supported).  Running an ifenslave
Packit Service 6f2e62
that is newer than the kernel is not supported, and may or may not
Packit Service 6f2e62
work.
Packit Service 6f2e62
Packit Service 6f2e62
	To install ifenslave, do the following:
Packit Service 6f2e62
Packit Service 6f2e62
# gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
Packit Service 6f2e62
# cp ifenslave /sbin/ifenslave
Packit Service 6f2e62
Packit Service 6f2e62
	If your kernel source is not in "/usr/src/linux," then replace
Packit Service 6f2e62
"/usr/src/linux/include" in the above with the location of your kernel
Packit Service 6f2e62
source include directory.
Packit Service 6f2e62
Packit Service 6f2e62
	You may wish to back up any existing /sbin/ifenslave, or, for
Packit Service 6f2e62
testing or informal use, tag the ifenslave to the kernel version
Packit Service 6f2e62
(e.g., name the ifenslave executable /sbin/ifenslave-2.6.10).
Packit Service 6f2e62
Packit Service 6f2e62
IMPORTANT NOTE:
Packit Service 6f2e62
Packit Service 6f2e62
	If you omit the "-I" or specify an incorrect directory, you
Packit Service 6f2e62
may end up with an ifenslave that is incompatible with the kernel
Packit Service 6f2e62
you're trying to build it for.  Some distros (e.g., Red Hat from 7.1
Packit Service 6f2e62
onwards) do not have /usr/include/linux symbolically linked to the
Packit Service 6f2e62
default kernel source include directory.
Packit Service 6f2e62
Packit Service 6f2e62
SECOND IMPORTANT NOTE:
Packit Service 6f2e62
	If you plan to configure bonding using sysfs or using the
Packit Service 6f2e62
/etc/network/interfaces file, you do not need to use ifenslave.
Packit Service 6f2e62
Packit Service 6f2e62
2. Bonding Driver Options
Packit Service 6f2e62
=========================
Packit Service 6f2e62
Packit Service 6f2e62
	Options for the bonding driver are supplied as parameters to the
Packit Service 6f2e62
bonding module at load time, or are specified via sysfs.
Packit Service 6f2e62
Packit Service 6f2e62
	Module options may be given as command line arguments to the
Packit Service 6f2e62
insmod or modprobe command, but are usually specified in either the
Packit Service 6f2e62
/etc/modrobe.d/*.conf configuration files, or in a distro-specific
Packit Service 6f2e62
configuration file (some of which are detailed in the next section).
Packit Service 6f2e62
Packit Service 6f2e62
	Details on bonding support for sysfs is provided in the
Packit Service 6f2e62
"Configuring Bonding Manually via Sysfs" section, below.
Packit Service 6f2e62
Packit Service 6f2e62
	The available bonding driver parameters are listed below. If a
Packit Service 6f2e62
parameter is not specified the default value is used.  When initially
Packit Service 6f2e62
configuring a bond, it is recommended "tail -f /var/log/messages" be
Packit Service 6f2e62
run in a separate window to watch for bonding driver error messages.
Packit Service 6f2e62
Packit Service 6f2e62
	It is critical that either the miimon or arp_interval and
Packit Service 6f2e62
arp_ip_target parameters be specified, otherwise serious network
Packit Service 6f2e62
degradation will occur during link failures.  Very few devices do not
Packit Service 6f2e62
support at least miimon, so there is really no reason not to use it.
Packit Service 6f2e62
Packit Service 6f2e62
	Options with textual values will accept either the text name
Packit Service 6f2e62
or, for backwards compatibility, the option value.  E.g.,
Packit Service 6f2e62
"mode=802.3ad" and "mode=4" set the same mode.
Packit Service 6f2e62
Packit Service 6f2e62
	The parameters are as follows:
Packit Service 6f2e62
Packit Service 6f2e62
active_slave
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the new active slave for modes that support it
Packit Service 6f2e62
	(active-backup, balance-alb and balance-tlb).  Possible values
Packit Service 6f2e62
	are the name of any currently enslaved interface, or an empty
Packit Service 6f2e62
	string.  If a name is given, the slave and its link must be up in order
Packit Service 6f2e62
	to be selected as the new active slave.  If an empty string is
Packit Service 6f2e62
	specified, the current active slave is cleared, and a new active
Packit Service 6f2e62
	slave is selected automatically.
Packit Service 6f2e62
Packit Service 6f2e62
	Note that this is only available through the sysfs interface. No module
Packit Service 6f2e62
	parameter by this name exists.
Packit Service 6f2e62
Packit Service 6f2e62
	The normal value of this option is the name of the currently
Packit Service 6f2e62
	active slave, or the empty string if there is no active slave or
Packit Service 6f2e62
	the current mode does not use an active slave.
Packit Service 6f2e62
Packit Service 6f2e62
ad_select
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the 802.3ad aggregation selection logic to use.  The
Packit Service 6f2e62
	possible values and their effects are:
Packit Service 6f2e62
Packit Service 6f2e62
	stable or 0
Packit Service 6f2e62
Packit Service 6f2e62
		The active aggregator is chosen by largest aggregate
Packit Service 6f2e62
		bandwidth.
Packit Service 6f2e62
Packit Service 6f2e62
		Reselection of the active aggregator occurs only when all
Packit Service 6f2e62
		slaves of the active aggregator are down or the active
Packit Service 6f2e62
		aggregator has no slaves.
Packit Service 6f2e62
Packit Service 6f2e62
		This is the default value.
Packit Service 6f2e62
Packit Service 6f2e62
	bandwidth or 1
Packit Service 6f2e62
Packit Service 6f2e62
		The active aggregator is chosen by largest aggregate
Packit Service 6f2e62
		bandwidth.  Reselection occurs if:
Packit Service 6f2e62
Packit Service 6f2e62
		- A slave is added to or removed from the bond
Packit Service 6f2e62
Packit Service 6f2e62
		- Any slave's link state changes
Packit Service 6f2e62
Packit Service 6f2e62
		- Any slave's 802.3ad association state changes
Packit Service 6f2e62
Packit Service 6f2e62
		- The bond's administrative state changes to up
Packit Service 6f2e62
Packit Service 6f2e62
	count or 2
Packit Service 6f2e62
Packit Service 6f2e62
		The active aggregator is chosen by the largest number of
Packit Service 6f2e62
		ports (slaves).  Reselection occurs as described under the
Packit Service 6f2e62
		"bandwidth" setting, above.
Packit Service 6f2e62
Packit Service 6f2e62
	The bandwidth and count selection policies permit failover of
Packit Service 6f2e62
	802.3ad aggregations when partial failure of the active aggregator
Packit Service 6f2e62
	occurs.  This keeps the aggregator with the highest availability
Packit Service 6f2e62
	(either in bandwidth or in number of ports) active at all times.
Packit Service 6f2e62
Packit Service 6f2e62
	This option was added in bonding version 3.4.0.
Packit Service 6f2e62
Packit Service 6f2e62
all_slaves_active
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies that duplicate frames (received on inactive ports) should be
Packit Service 6f2e62
	dropped (0) or delivered (1).
Packit Service 6f2e62
Packit Service 6f2e62
	Normally, bonding will drop duplicate frames (received on inactive
Packit Service 6f2e62
	ports), which is desirable for most users. But there are some times
Packit Service 6f2e62
	it is nice to allow duplicate frames to be delivered.
Packit Service 6f2e62
Packit Service 6f2e62
	The default value is 0 (drop duplicate frames received on inactive
Packit Service 6f2e62
	ports).
Packit Service 6f2e62
Packit Service 6f2e62
arp_interval
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the ARP link monitoring frequency in milliseconds.
Packit Service 6f2e62
Packit Service 6f2e62
	The ARP monitor works by periodically checking the slave
Packit Service 6f2e62
	devices to determine whether they have sent or received
Packit Service 6f2e62
	traffic recently (the precise criteria depends upon the
Packit Service 6f2e62
	bonding mode, and the state of the slave).  Regular traffic is
Packit Service 6f2e62
	generated via ARP probes issued for the addresses specified by
Packit Service 6f2e62
	the arp_ip_target option.
Packit Service 6f2e62
Packit Service 6f2e62
	This behavior can be modified by the arp_validate option,
Packit Service 6f2e62
	below.
Packit Service 6f2e62
Packit Service 6f2e62
	If ARP monitoring is used in an etherchannel compatible mode
Packit Service 6f2e62
	(modes 0 and 2), the switch should be configured in a mode
Packit Service 6f2e62
	that evenly distributes packets across all links. If the
Packit Service 6f2e62
	switch is configured to distribute the packets in an XOR
Packit Service 6f2e62
	fashion, all replies from the ARP targets will be received on
Packit Service 6f2e62
	the same link which could cause the other team members to
Packit Service 6f2e62
	fail.  ARP monitoring should not be used in conjunction with
Packit Service 6f2e62
	miimon.  A value of 0 disables ARP monitoring.  The default
Packit Service 6f2e62
	value is 0.
Packit Service 6f2e62
Packit Service 6f2e62
arp_ip_target
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the IP addresses to use as ARP monitoring peers when
Packit Service 6f2e62
	arp_interval is > 0.  These are the targets of the ARP request
Packit Service 6f2e62
	sent to determine the health of the link to the targets.
Packit Service 6f2e62
	Specify these values in ddd.ddd.ddd.ddd format.  Multiple IP
Packit Service 6f2e62
	addresses must be separated by a comma.  At least one IP
Packit Service 6f2e62
	address must be given for ARP monitoring to function.  The
Packit Service 6f2e62
	maximum number of targets that can be specified is 16.  The
Packit Service 6f2e62
	default value is no IP addresses.
Packit Service 6f2e62
Packit Service 6f2e62
arp_validate
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies whether or not ARP probes and replies should be
Packit Service 6f2e62
	validated in the active-backup mode.  This causes the ARP
Packit Service 6f2e62
	monitor to examine the incoming ARP requests and replies, and
Packit Service 6f2e62
	only consider a slave to be up if it is receiving the
Packit Service 6f2e62
	appropriate ARP traffic.
Packit Service 6f2e62
Packit Service 6f2e62
	Possible values are:
Packit Service 6f2e62
Packit Service 6f2e62
	none or 0
Packit Service 6f2e62
Packit Service 6f2e62
		No validation is performed.  This is the default.
Packit Service 6f2e62
Packit Service 6f2e62
	active or 1
Packit Service 6f2e62
Packit Service 6f2e62
		Validation is performed only for the active slave.
Packit Service 6f2e62
Packit Service 6f2e62
	backup or 2
Packit Service 6f2e62
Packit Service 6f2e62
		Validation is performed only for backup slaves.
Packit Service 6f2e62
Packit Service 6f2e62
	all or 3
Packit Service 6f2e62
Packit Service 6f2e62
		Validation is performed for all slaves.
Packit Service 6f2e62
Packit Service 6f2e62
	For the active slave, the validation checks ARP replies to
Packit Service 6f2e62
	confirm that they were generated by an arp_ip_target.  Since
Packit Service 6f2e62
	backup slaves do not typically receive these replies, the
Packit Service 6f2e62
	validation performed for backup slaves is on the ARP request
Packit Service 6f2e62
	sent out via the active slave.  It is possible that some
Packit Service 6f2e62
	switch or network configurations may result in situations
Packit Service 6f2e62
	wherein the backup slaves do not receive the ARP requests; in
Packit Service 6f2e62
	such a situation, validation of backup slaves must be
Packit Service 6f2e62
	disabled.
Packit Service 6f2e62
Packit Service 6f2e62
	This option is useful in network configurations in which
Packit Service 6f2e62
	multiple bonding hosts are concurrently issuing ARPs to one or
Packit Service 6f2e62
	more targets beyond a common switch.  Should the link between
Packit Service 6f2e62
	the switch and target fail (but not the switch itself), the
Packit Service 6f2e62
	probe traffic generated by the multiple bonding instances will
Packit Service 6f2e62
	fool the standard ARP monitor into considering the links as
Packit Service 6f2e62
	still up.  Use of the arp_validate option can resolve this, as
Packit Service 6f2e62
	the ARP monitor will only consider ARP requests and replies
Packit Service 6f2e62
	associated with its own instance of bonding.
Packit Service 6f2e62
Packit Service 6f2e62
	This option was added in bonding version 3.1.0.
Packit Service 6f2e62
Packit Service 6f2e62
downdelay
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the time, in milliseconds, to wait before disabling
Packit Service 6f2e62
	a slave after a link failure has been detected.  This option
Packit Service 6f2e62
	is only valid for the miimon link monitor.  The downdelay
Packit Service 6f2e62
	value should be a multiple of the miimon value; if not, it
Packit Service 6f2e62
	will be rounded down to the nearest multiple.  The default
Packit Service 6f2e62
	value is 0.
Packit Service 6f2e62
Packit Service 6f2e62
fail_over_mac
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies whether active-backup mode should set all slaves to
Packit Service 6f2e62
	the same MAC address at enslavement (the traditional
Packit Service 6f2e62
	behavior), or, when enabled, perform special handling of the
Packit Service 6f2e62
	bond's MAC address in accordance with the selected policy.
Packit Service 6f2e62
Packit Service 6f2e62
	Possible values are:
Packit Service 6f2e62
Packit Service 6f2e62
	none or 0
Packit Service 6f2e62
Packit Service 6f2e62
		This setting disables fail_over_mac, and causes
Packit Service 6f2e62
		bonding to set all slaves of an active-backup bond to
Packit Service 6f2e62
		the same MAC address at enslavement time.  This is the
Packit Service 6f2e62
		default.
Packit Service 6f2e62
Packit Service 6f2e62
	active or 1
Packit Service 6f2e62
Packit Service 6f2e62
		The "active" fail_over_mac policy indicates that the
Packit Service 6f2e62
		MAC address of the bond should always be the MAC
Packit Service 6f2e62
		address of the currently active slave.  The MAC
Packit Service 6f2e62
		address of the slaves is not changed; instead, the MAC
Packit Service 6f2e62
		address of the bond changes during a failover.
Packit Service 6f2e62
Packit Service 6f2e62
		This policy is useful for devices that cannot ever
Packit Service 6f2e62
		alter their MAC address, or for devices that refuse
Packit Service 6f2e62
		incoming broadcasts with their own source MAC (which
Packit Service 6f2e62
		interferes with the ARP monitor).
Packit Service 6f2e62
Packit Service 6f2e62
		The down side of this policy is that every device on
Packit Service 6f2e62
		the network must be updated via gratuitous ARP,
Packit Service 6f2e62
		vs. just updating a switch or set of switches (which
Packit Service 6f2e62
		often takes place for any traffic, not just ARP
Packit Service 6f2e62
		traffic, if the switch snoops incoming traffic to
Packit Service 6f2e62
		update its tables) for the traditional method.  If the
Packit Service 6f2e62
		gratuitous ARP is lost, communication may be
Packit Service 6f2e62
		disrupted.
Packit Service 6f2e62
Packit Service 6f2e62
		When this policy is used in conjunction with the mii
Packit Service 6f2e62
		monitor, devices which assert link up prior to being
Packit Service 6f2e62
		able to actually transmit and receive are particularly
Packit Service 6f2e62
		susceptible to loss of the gratuitous ARP, and an
Packit Service 6f2e62
		appropriate updelay setting may be required.
Packit Service 6f2e62
Packit Service 6f2e62
	follow or 2
Packit Service 6f2e62
Packit Service 6f2e62
		The "follow" fail_over_mac policy causes the MAC
Packit Service 6f2e62
		address of the bond to be selected normally (normally
Packit Service 6f2e62
		the MAC address of the first slave added to the bond).
Packit Service 6f2e62
		However, the second and subsequent slaves are not set
Packit Service 6f2e62
		to this MAC address while they are in a backup role; a
Packit Service 6f2e62
		slave is programmed with the bond's MAC address at
Packit Service 6f2e62
		failover time (and the formerly active slave receives
Packit Service 6f2e62
		the newly active slave's MAC address).
Packit Service 6f2e62
Packit Service 6f2e62
		This policy is useful for multiport devices that
Packit Service 6f2e62
		either become confused or incur a performance penalty
Packit Service 6f2e62
		when multiple ports are programmed with the same MAC
Packit Service 6f2e62
		address.
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
	The default policy is none, unless the first slave cannot
Packit Service 6f2e62
	change its MAC address, in which case the active policy is
Packit Service 6f2e62
	selected by default.
Packit Service 6f2e62
Packit Service 6f2e62
	This option may be modified via sysfs only when no slaves are
Packit Service 6f2e62
	present in the bond.
Packit Service 6f2e62
Packit Service 6f2e62
	This option was added in bonding version 3.2.0.  The "follow"
Packit Service 6f2e62
	policy was added in bonding version 3.3.0.
Packit Service 6f2e62
Packit Service 6f2e62
lacp_rate
Packit Service 6f2e62
Packit Service 6f2e62
	Option specifying the rate in which we'll ask our link partner
Packit Service 6f2e62
	to transmit LACPDU packets in 802.3ad mode.  Possible values
Packit Service 6f2e62
	are:
Packit Service 6f2e62
Packit Service 6f2e62
	slow or 0
Packit Service 6f2e62
		Request partner to transmit LACPDUs every 30 seconds
Packit Service 6f2e62
Packit Service 6f2e62
	fast or 1
Packit Service 6f2e62
		Request partner to transmit LACPDUs every 1 second
Packit Service 6f2e62
Packit Service 6f2e62
	The default is slow.
Packit Service 6f2e62
Packit Service 6f2e62
max_bonds
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the number of bonding devices to create for this
Packit Service 6f2e62
	instance of the bonding driver.  E.g., if max_bonds is 3, and
Packit Service 6f2e62
	the bonding driver is not already loaded, then bond0, bond1
Packit Service 6f2e62
	and bond2 will be created.  The default value is 1.  Specifying
Packit Service 6f2e62
	a value of 0 will load bonding, but will not create any devices.
Packit Service 6f2e62
Packit Service 6f2e62
miimon
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the MII link monitoring frequency in milliseconds.
Packit Service 6f2e62
	This determines how often the link state of each slave is
Packit Service 6f2e62
	inspected for link failures.  A value of zero disables MII
Packit Service 6f2e62
	link monitoring.  A value of 100 is a good starting point.
Packit Service 6f2e62
	The use_carrier option, below, affects how the link state is
Packit Service 6f2e62
	determined.  See the High Availability section for additional
Packit Service 6f2e62
	information.  The default value is 0.
Packit Service 6f2e62
Packit Service 6f2e62
min_links
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the minimum number of links that must be active before
Packit Service 6f2e62
	asserting carrier. It is similar to the Cisco EtherChannel min-links
Packit Service 6f2e62
	feature. This allows setting the minimum number of member ports that
Packit Service 6f2e62
	must be up (link-up state) before marking the bond device as up
Packit Service 6f2e62
	(carrier on). This is useful for situations where higher level services
Packit Service 6f2e62
	such as clustering want to ensure a minimum number of low bandwidth
Packit Service 6f2e62
	links are active before switchover. This option only affect 802.3ad
Packit Service 6f2e62
	mode.
Packit Service 6f2e62
Packit Service 6f2e62
	The default value is 0. This will cause carrier to be asserted (for
Packit Service 6f2e62
	802.3ad mode) whenever there is an active aggregator, regardless of the
Packit Service 6f2e62
	number of available links in that aggregator. Note that, because an
Packit Service 6f2e62
	aggregator cannot be active without at least one available link,
Packit Service 6f2e62
	setting this option to 0 or to 1 has the exact same effect.
Packit Service 6f2e62
Packit Service 6f2e62
mode
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies one of the bonding policies. The default is
Packit Service 6f2e62
	balance-rr (round robin).  Possible values are:
Packit Service 6f2e62
Packit Service 6f2e62
	balance-rr or 0
Packit Service 6f2e62
Packit Service 6f2e62
		Round-robin policy: Transmit packets in sequential
Packit Service 6f2e62
		order from the first available slave through the
Packit Service 6f2e62
		last.  This mode provides load balancing and fault
Packit Service 6f2e62
		tolerance.
Packit Service 6f2e62
Packit Service 6f2e62
	active-backup or 1
Packit Service 6f2e62
Packit Service 6f2e62
		Active-backup policy: Only one slave in the bond is
Packit Service 6f2e62
		active.  A different slave becomes active if, and only
Packit Service 6f2e62
		if, the active slave fails.  The bond's MAC address is
Packit Service 6f2e62
		externally visible on only one port (network adapter)
Packit Service 6f2e62
		to avoid confusing the switch.
Packit Service 6f2e62
Packit Service 6f2e62
		In bonding version 2.6.2 or later, when a failover
Packit Service 6f2e62
		occurs in active-backup mode, bonding will issue one
Packit Service 6f2e62
		or more gratuitous ARPs on the newly active slave.
Packit Service 6f2e62
		One gratuitous ARP is issued for the bonding master
Packit Service 6f2e62
		interface and each VLAN interfaces configured above
Packit Service 6f2e62
		it, provided that the interface has at least one IP
Packit Service 6f2e62
		address configured.  Gratuitous ARPs issued for VLAN
Packit Service 6f2e62
		interfaces are tagged with the appropriate VLAN id.
Packit Service 6f2e62
Packit Service 6f2e62
		This mode provides fault tolerance.  The primary
Packit Service 6f2e62
		option, documented below, affects the behavior of this
Packit Service 6f2e62
		mode.
Packit Service 6f2e62
Packit Service 6f2e62
	balance-xor or 2
Packit Service 6f2e62
Packit Service 6f2e62
		XOR policy: Transmit based on the selected transmit
Packit Service 6f2e62
		hash policy.  The default policy is a simple [(source
Packit Service 6f2e62
		MAC address XOR'd with destination MAC address) modulo
Packit Service 6f2e62
		slave count].  Alternate transmit policies may be
Packit Service 6f2e62
		selected via the xmit_hash_policy option, described
Packit Service 6f2e62
		below.
Packit Service 6f2e62
Packit Service 6f2e62
		This mode provides load balancing and fault tolerance.
Packit Service 6f2e62
Packit Service 6f2e62
	broadcast or 3
Packit Service 6f2e62
Packit Service 6f2e62
		Broadcast policy: transmits everything on all slave
Packit Service 6f2e62
		interfaces.  This mode provides fault tolerance.
Packit Service 6f2e62
Packit Service 6f2e62
	802.3ad or 4
Packit Service 6f2e62
Packit Service 6f2e62
		IEEE 802.3ad Dynamic link aggregation.  Creates
Packit Service 6f2e62
		aggregation groups that share the same speed and
Packit Service 6f2e62
		duplex settings.  Utilizes all slaves in the active
Packit Service 6f2e62
		aggregator according to the 802.3ad specification.
Packit Service 6f2e62
Packit Service 6f2e62
		Slave selection for outgoing traffic is done according
Packit Service 6f2e62
		to the transmit hash policy, which may be changed from
Packit Service 6f2e62
		the default simple XOR policy via the xmit_hash_policy
Packit Service 6f2e62
		option, documented below.  Note that not all transmit
Packit Service 6f2e62
		policies may be 802.3ad compliant, particularly in
Packit Service 6f2e62
		regards to the packet mis-ordering requirements of
Packit Service 6f2e62
		section 43.2.4 of the 802.3ad standard.  Differing
Packit Service 6f2e62
		peer implementations will have varying tolerances for
Packit Service 6f2e62
		noncompliance.
Packit Service 6f2e62
Packit Service 6f2e62
		Prerequisites:
Packit Service 6f2e62
Packit Service 6f2e62
		1. Ethtool support in the base drivers for retrieving
Packit Service 6f2e62
		the speed and duplex of each slave.
Packit Service 6f2e62
Packit Service 6f2e62
		2. A switch that supports IEEE 802.3ad Dynamic link
Packit Service 6f2e62
		aggregation.
Packit Service 6f2e62
Packit Service 6f2e62
		Most switches will require some type of configuration
Packit Service 6f2e62
		to enable 802.3ad mode.
Packit Service 6f2e62
Packit Service 6f2e62
	balance-tlb or 5
Packit Service 6f2e62
Packit Service 6f2e62
		Adaptive transmit load balancing: channel bonding that
Packit Service 6f2e62
		does not require any special switch support.  The
Packit Service 6f2e62
		outgoing traffic is distributed according to the
Packit Service 6f2e62
		current load (computed relative to the speed) on each
Packit Service 6f2e62
		slave.  Incoming traffic is received by the current
Packit Service 6f2e62
		slave.  If the receiving slave fails, another slave
Packit Service 6f2e62
		takes over the MAC address of the failed receiving
Packit Service 6f2e62
		slave.
Packit Service 6f2e62
Packit Service 6f2e62
		Prerequisite:
Packit Service 6f2e62
Packit Service 6f2e62
		Ethtool support in the base drivers for retrieving the
Packit Service 6f2e62
		speed of each slave.
Packit Service 6f2e62
Packit Service 6f2e62
	balance-alb or 6
Packit Service 6f2e62
Packit Service 6f2e62
		Adaptive load balancing: includes balance-tlb plus
Packit Service 6f2e62
		receive load balancing (rlb) for IPV4 traffic, and
Packit Service 6f2e62
		does not require any special switch support.  The
Packit Service 6f2e62
		receive load balancing is achieved by ARP negotiation.
Packit Service 6f2e62
		The bonding driver intercepts the ARP Replies sent by
Packit Service 6f2e62
		the local system on their way out and overwrites the
Packit Service 6f2e62
		source hardware address with the unique hardware
Packit Service 6f2e62
		address of one of the slaves in the bond such that
Packit Service 6f2e62
		different peers use different hardware addresses for
Packit Service 6f2e62
		the server.
Packit Service 6f2e62
Packit Service 6f2e62
		Receive traffic from connections created by the server
Packit Service 6f2e62
		is also balanced.  When the local system sends an ARP
Packit Service 6f2e62
		Request the bonding driver copies and saves the peer's
Packit Service 6f2e62
		IP information from the ARP packet.  When the ARP
Packit Service 6f2e62
		Reply arrives from the peer, its hardware address is
Packit Service 6f2e62
		retrieved and the bonding driver initiates an ARP
Packit Service 6f2e62
		reply to this peer assigning it to one of the slaves
Packit Service 6f2e62
		in the bond.  A problematic outcome of using ARP
Packit Service 6f2e62
		negotiation for balancing is that each time that an
Packit Service 6f2e62
		ARP request is broadcast it uses the hardware address
Packit Service 6f2e62
		of the bond.  Hence, peers learn the hardware address
Packit Service 6f2e62
		of the bond and the balancing of receive traffic
Packit Service 6f2e62
		collapses to the current slave.  This is handled by
Packit Service 6f2e62
		sending updates (ARP Replies) to all the peers with
Packit Service 6f2e62
		their individually assigned hardware address such that
Packit Service 6f2e62
		the traffic is redistributed.  Receive traffic is also
Packit Service 6f2e62
		redistributed when a new slave is added to the bond
Packit Service 6f2e62
		and when an inactive slave is re-activated.  The
Packit Service 6f2e62
		receive load is distributed sequentially (round robin)
Packit Service 6f2e62
		among the group of highest speed slaves in the bond.
Packit Service 6f2e62
Packit Service 6f2e62
		When a link is reconnected or a new slave joins the
Packit Service 6f2e62
		bond the receive traffic is redistributed among all
Packit Service 6f2e62
		active slaves in the bond by initiating ARP Replies
Packit Service 6f2e62
		with the selected MAC address to each of the
Packit Service 6f2e62
		clients. The updelay parameter (detailed below) must
Packit Service 6f2e62
		be set to a value equal or greater than the switch's
Packit Service 6f2e62
		forwarding delay so that the ARP Replies sent to the
Packit Service 6f2e62
		peers will not be blocked by the switch.
Packit Service 6f2e62
Packit Service 6f2e62
		Prerequisites:
Packit Service 6f2e62
Packit Service 6f2e62
		1. Ethtool support in the base drivers for retrieving
Packit Service 6f2e62
		the speed of each slave.
Packit Service 6f2e62
Packit Service 6f2e62
		2. Base driver support for setting the hardware
Packit Service 6f2e62
		address of a device while it is open.  This is
Packit Service 6f2e62
		required so that there will always be one slave in the
Packit Service 6f2e62
		team using the bond hardware address (the
Packit Service 6f2e62
		curr_active_slave) while having a unique hardware
Packit Service 6f2e62
		address for each slave in the bond.  If the
Packit Service 6f2e62
		curr_active_slave fails its hardware address is
Packit Service 6f2e62
		swapped with the new curr_active_slave that was
Packit Service 6f2e62
		chosen.
Packit Service 6f2e62
Packit Service 6f2e62
num_grat_arp
Packit Service 6f2e62
num_unsol_na
Packit Service 6f2e62
Packit Service 6f2e62
	Specify the number of peer notifications (gratuitous ARPs and
Packit Service 6f2e62
	unsolicited IPv6 Neighbor Advertisements) to be issued after a
Packit Service 6f2e62
	failover event.  As soon as the link is up on the new slave
Packit Service 6f2e62
	(possibly immediately) a peer notification is sent on the
Packit Service 6f2e62
	bonding device and each VLAN sub-device.  This is repeated at
Packit Service 6f2e62
	each link monitor interval (arp_interval or miimon, whichever
Packit Service 6f2e62
	is active) if the number is greater than 1.
Packit Service 6f2e62
Packit Service 6f2e62
	The valid range is 0 - 255; the default value is 1.  These options
Packit Service 6f2e62
	affect only the active-backup mode.  These options were added for
Packit Service 6f2e62
	bonding versions 3.3.0 and 3.4.0 respectively.
Packit Service 6f2e62
Packit Service 6f2e62
	From Linux 3.0 and bonding version 3.7.1, these notifications
Packit Service 6f2e62
	are generated by the ipv4 and ipv6 code and the numbers of
Packit Service 6f2e62
	repetitions cannot be set independently.
Packit Service 6f2e62
Packit Service 6f2e62
primary
Packit Service 6f2e62
Packit Service 6f2e62
	A string (eth0, eth2, etc) specifying which slave is the
Packit Service 6f2e62
	primary device.  The specified device will always be the
Packit Service 6f2e62
	active slave while it is available.  Only when the primary is
Packit Service 6f2e62
	off-line will alternate devices be used.  This is useful when
Packit Service 6f2e62
	one slave is preferred over another, e.g., when one slave has
Packit Service 6f2e62
	higher throughput than another.
Packit Service 6f2e62
Packit Service 6f2e62
	The primary option is only valid for active-backup mode.
Packit Service 6f2e62
Packit Service 6f2e62
primary_reselect
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the reselection policy for the primary slave.  This
Packit Service 6f2e62
	affects how the primary slave is chosen to become the active slave
Packit Service 6f2e62
	when failure of the active slave or recovery of the primary slave
Packit Service 6f2e62
	occurs.  This option is designed to prevent flip-flopping between
Packit Service 6f2e62
	the primary slave and other slaves.  Possible values are:
Packit Service 6f2e62
Packit Service 6f2e62
	always or 0 (default)
Packit Service 6f2e62
Packit Service 6f2e62
		The primary slave becomes the active slave whenever it
Packit Service 6f2e62
		comes back up.
Packit Service 6f2e62
Packit Service 6f2e62
	better or 1
Packit Service 6f2e62
Packit Service 6f2e62
		The primary slave becomes the active slave when it comes
Packit Service 6f2e62
		back up, if the speed and duplex of the primary slave is
Packit Service 6f2e62
		better than the speed and duplex of the current active
Packit Service 6f2e62
		slave.
Packit Service 6f2e62
Packit Service 6f2e62
	failure or 2
Packit Service 6f2e62
Packit Service 6f2e62
		The primary slave becomes the active slave only if the
Packit Service 6f2e62
		current active slave fails and the primary slave is up.
Packit Service 6f2e62
Packit Service 6f2e62
	The primary_reselect setting is ignored in two cases:
Packit Service 6f2e62
Packit Service 6f2e62
		If no slaves are active, the first slave to recover is
Packit Service 6f2e62
		made the active slave.
Packit Service 6f2e62
Packit Service 6f2e62
		When initially enslaved, the primary slave is always made
Packit Service 6f2e62
		the active slave.
Packit Service 6f2e62
Packit Service 6f2e62
	Changing the primary_reselect policy via sysfs will cause an
Packit Service 6f2e62
	immediate selection of the best active slave according to the new
Packit Service 6f2e62
	policy.  This may or may not result in a change of the active
Packit Service 6f2e62
	slave, depending upon the circumstances.
Packit Service 6f2e62
Packit Service 6f2e62
	This option was added for bonding version 3.6.0.
Packit Service 6f2e62
Packit Service 6f2e62
updelay
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the time, in milliseconds, to wait before enabling a
Packit Service 6f2e62
	slave after a link recovery has been detected.  This option is
Packit Service 6f2e62
	only valid for the miimon link monitor.  The updelay value
Packit Service 6f2e62
	should be a multiple of the miimon value; if not, it will be
Packit Service 6f2e62
	rounded down to the nearest multiple.  The default value is 0.
Packit Service 6f2e62
Packit Service 6f2e62
use_carrier
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies whether or not miimon should use MII or ETHTOOL
Packit Service 6f2e62
	ioctls vs. netif_carrier_ok() to determine the link
Packit Service 6f2e62
	status. The MII or ETHTOOL ioctls are less efficient and
Packit Service 6f2e62
	utilize a deprecated calling sequence within the kernel.  The
Packit Service 6f2e62
	netif_carrier_ok() relies on the device driver to maintain its
Packit Service 6f2e62
	state with netif_carrier_on/off; at this writing, most, but
Packit Service 6f2e62
	not all, device drivers support this facility.
Packit Service 6f2e62
Packit Service 6f2e62
	If bonding insists that the link is up when it should not be,
Packit Service 6f2e62
	it may be that your network device driver does not support
Packit Service 6f2e62
	netif_carrier_on/off.  The default state for netif_carrier is
Packit Service 6f2e62
	"carrier on," so if a driver does not support netif_carrier,
Packit Service 6f2e62
	it will appear as if the link is always up.  In this case,
Packit Service 6f2e62
	setting use_carrier to 0 will cause bonding to revert to the
Packit Service 6f2e62
	MII / ETHTOOL ioctl method to determine the link state.
Packit Service 6f2e62
Packit Service 6f2e62
	A value of 1 enables the use of netif_carrier_ok(), a value of
Packit Service 6f2e62
	0 will use the deprecated MII / ETHTOOL ioctls.  The default
Packit Service 6f2e62
	value is 1.
Packit Service 6f2e62
Packit Service 6f2e62
xmit_hash_policy
Packit Service 6f2e62
Packit Service 6f2e62
	Selects the transmit hash policy to use for slave selection in
Packit Service 6f2e62
	balance-xor and 802.3ad modes.  Possible values are:
Packit Service 6f2e62
Packit Service 6f2e62
	layer2
Packit Service 6f2e62
Packit Service 6f2e62
		Uses XOR of hardware MAC addresses to generate the
Packit Service 6f2e62
		hash.  The formula is
Packit Service 6f2e62
Packit Service 6f2e62
		(source MAC XOR destination MAC) modulo slave count
Packit Service 6f2e62
Packit Service 6f2e62
		This algorithm will place all traffic to a particular
Packit Service 6f2e62
		network peer on the same slave.
Packit Service 6f2e62
Packit Service 6f2e62
		This algorithm is 802.3ad compliant.
Packit Service 6f2e62
Packit Service 6f2e62
	layer2+3
Packit Service 6f2e62
Packit Service 6f2e62
		This policy uses a combination of layer2 and layer3
Packit Service 6f2e62
		protocol information to generate the hash.
Packit Service 6f2e62
Packit Service 6f2e62
		Uses XOR of hardware MAC addresses and IP addresses to
Packit Service 6f2e62
		generate the hash.  The formula is
Packit Service 6f2e62
Packit Service 6f2e62
		(((source IP XOR dest IP) AND 0xffff) XOR
Packit Service 6f2e62
			( source MAC XOR destination MAC ))
Packit Service 6f2e62
				modulo slave count
Packit Service 6f2e62
Packit Service 6f2e62
		This algorithm will place all traffic to a particular
Packit Service 6f2e62
		network peer on the same slave.  For non-IP traffic,
Packit Service 6f2e62
		the formula is the same as for the layer2 transmit
Packit Service 6f2e62
		hash policy.
Packit Service 6f2e62
Packit Service 6f2e62
		This policy is intended to provide a more balanced
Packit Service 6f2e62
		distribution of traffic than layer2 alone, especially
Packit Service 6f2e62
		in environments where a layer3 gateway device is
Packit Service 6f2e62
		required to reach most destinations.
Packit Service 6f2e62
Packit Service 6f2e62
		This algorithm is 802.3ad compliant.
Packit Service 6f2e62
Packit Service 6f2e62
	layer3+4
Packit Service 6f2e62
Packit Service 6f2e62
		This policy uses upper layer protocol information,
Packit Service 6f2e62
		when available, to generate the hash.  This allows for
Packit Service 6f2e62
		traffic to a particular network peer to span multiple
Packit Service 6f2e62
		slaves, although a single connection will not span
Packit Service 6f2e62
		multiple slaves.
Packit Service 6f2e62
Packit Service 6f2e62
		The formula for unfragmented TCP and UDP packets is
Packit Service 6f2e62
Packit Service 6f2e62
		((source port XOR dest port) XOR
Packit Service 6f2e62
			 ((source IP XOR dest IP) AND 0xffff)
Packit Service 6f2e62
				modulo slave count
Packit Service 6f2e62
Packit Service 6f2e62
		For fragmented TCP or UDP packets and all other IP
Packit Service 6f2e62
		protocol traffic, the source and destination port
Packit Service 6f2e62
		information is omitted.  For non-IP traffic, the
Packit Service 6f2e62
		formula is the same as for the layer2 transmit hash
Packit Service 6f2e62
		policy.
Packit Service 6f2e62
Packit Service 6f2e62
		This policy is intended to mimic the behavior of
Packit Service 6f2e62
		certain switches, notably Cisco switches with PFC2 as
Packit Service 6f2e62
		well as some Foundry and IBM products.
Packit Service 6f2e62
Packit Service 6f2e62
		This algorithm is not fully 802.3ad compliant.  A
Packit Service 6f2e62
		single TCP or UDP conversation containing both
Packit Service 6f2e62
		fragmented and unfragmented packets will see packets
Packit Service 6f2e62
		striped across two interfaces.  This may result in out
Packit Service 6f2e62
		of order delivery.  Most traffic types will not meet
Packit Service 6f2e62
		this criteria, as TCP rarely fragments traffic, and
Packit Service 6f2e62
		most UDP traffic is not involved in extended
Packit Service 6f2e62
		conversations.  Other implementations of 802.3ad may
Packit Service 6f2e62
		or may not tolerate this noncompliance.
Packit Service 6f2e62
Packit Service 6f2e62
	The default value is layer2.  This option was added in bonding
Packit Service 6f2e62
	version 2.6.3.  In earlier versions of bonding, this parameter
Packit Service 6f2e62
	does not exist, and the layer2 policy is the only policy.  The
Packit Service 6f2e62
	layer2+3 value was added for bonding version 3.2.2.
Packit Service 6f2e62
Packit Service 6f2e62
resend_igmp
Packit Service 6f2e62
Packit Service 6f2e62
	Specifies the number of IGMP membership reports to be issued after
Packit Service 6f2e62
	a failover event. One membership report is issued immediately after
Packit Service 6f2e62
	the failover, subsequent packets are sent in each 200ms interval.
Packit Service 6f2e62
Packit Service 6f2e62
	The valid range is 0 - 255; the default value is 1. A value of 0
Packit Service 6f2e62
	prevents the IGMP membership report from being issued in response
Packit Service 6f2e62
	to the failover event.
Packit Service 6f2e62
Packit Service 6f2e62
	This option is useful for bonding modes balance-rr (0), active-backup
Packit Service 6f2e62
	(1), balance-tlb (5) and balance-alb (6), in which a failover can
Packit Service 6f2e62
	switch the IGMP traffic from one slave to another.  Therefore a fresh
Packit Service 6f2e62
	IGMP report must be issued to cause the switch to forward the incoming
Packit Service 6f2e62
	IGMP traffic over the newly selected slave.
Packit Service 6f2e62
Packit Service 6f2e62
	This option was added for bonding version 3.7.0.
Packit Service 6f2e62
Packit Service 6f2e62
3. Configuring Bonding Devices
Packit Service 6f2e62
==============================
Packit Service 6f2e62
Packit Service 6f2e62
	You can configure bonding using either your distro's network
Packit Service 6f2e62
initialization scripts, or manually using either ifenslave or the
Packit Service 6f2e62
sysfs interface.  Distros generally use one of three packages for the
Packit Service 6f2e62
network initialization scripts: initscripts, sysconfig or interfaces.
Packit Service 6f2e62
Recent versions of these packages have support for bonding, while older
Packit Service 6f2e62
versions do not.
Packit Service 6f2e62
Packit Service 6f2e62
	We will first describe the options for configuring bonding for
Packit Service 6f2e62
distros using versions of initscripts, sysconfig and interfaces with full
Packit Service 6f2e62
or partial support for bonding, then provide information on enabling
Packit Service 6f2e62
bonding without support from the network initialization scripts (i.e.,
Packit Service 6f2e62
older versions of initscripts or sysconfig).
Packit Service 6f2e62
Packit Service 6f2e62
	If you're unsure whether your distro uses sysconfig,
Packit Service 6f2e62
initscripts or interfaces, or don't know if it's new enough, have no fear.
Packit Service 6f2e62
Determining this is fairly straightforward.
Packit Service 6f2e62
Packit Service 6f2e62
	First, look for a file called interfaces in /etc/network directory.
Packit Service 6f2e62
If this file is present in your system, then your system use interfaces. See
Packit Service 6f2e62
Configuration with Interfaces Support.
Packit Service 6f2e62
Packit Service 6f2e62
	Else, issue the command:
Packit Service 6f2e62
Packit Service 6f2e62
$ rpm -qf /sbin/ifup
Packit Service 6f2e62
Packit Service 6f2e62
	It will respond with a line of text starting with either
Packit Service 6f2e62
"initscripts" or "sysconfig," followed by some numbers.  This is the
Packit Service 6f2e62
package that provides your network initialization scripts.
Packit Service 6f2e62
Packit Service 6f2e62
	Next, to determine if your installation supports bonding,
Packit Service 6f2e62
issue the command:
Packit Service 6f2e62
Packit Service 6f2e62
$ grep ifenslave /sbin/ifup
Packit Service 6f2e62
Packit Service 6f2e62
	If this returns any matches, then your initscripts or
Packit Service 6f2e62
sysconfig has support for bonding.
Packit Service 6f2e62
Packit Service 6f2e62
3.1 Configuration with Sysconfig Support
Packit Service 6f2e62
----------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	This section applies to distros using a version of sysconfig
Packit Service 6f2e62
with bonding support, for example, SuSE Linux Enterprise Server 9.
Packit Service 6f2e62
Packit Service 6f2e62
	SuSE SLES 9's networking configuration system does support
Packit Service 6f2e62
bonding, however, at this writing, the YaST system configuration
Packit Service 6f2e62
front end does not provide any means to work with bonding devices.
Packit Service 6f2e62
Bonding devices can be managed by hand, however, as follows.
Packit Service 6f2e62
Packit Service 6f2e62
	First, if they have not already been configured, configure the
Packit Service 6f2e62
slave devices.  On SLES 9, this is most easily done by running the
Packit Service 6f2e62
yast2 sysconfig configuration utility.  The goal is for to create an
Packit Service 6f2e62
ifcfg-id file for each slave device.  The simplest way to accomplish
Packit Service 6f2e62
this is to configure the devices for DHCP (this is only to get the
Packit Service 6f2e62
file ifcfg-id file created; see below for some issues with DHCP).  The
Packit Service 6f2e62
name of the configuration file for each device will be of the form:
Packit Service 6f2e62
Packit Service 6f2e62
ifcfg-id-xx:xx:xx:xx:xx:xx
Packit Service 6f2e62
Packit Service 6f2e62
	Where the "xx" portion will be replaced with the digits from
Packit Service 6f2e62
the device's permanent MAC address.
Packit Service 6f2e62
Packit Service 6f2e62
	Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
Packit Service 6f2e62
created, it is necessary to edit the configuration files for the slave
Packit Service 6f2e62
devices (the MAC addresses correspond to those of the slave devices).
Packit Service 6f2e62
Before editing, the file will contain multiple lines, and will look
Packit Service 6f2e62
something like this:
Packit Service 6f2e62
Packit Service 6f2e62
BOOTPROTO='dhcp'
Packit Service 6f2e62
STARTMODE='on'
Packit Service 6f2e62
USERCTL='no'
Packit Service 6f2e62
UNIQUE='XNzu.WeZGOGF+4wE'
Packit Service 6f2e62
_nm_name='bus-pci-0001:61:01.0'
Packit Service 6f2e62
Packit Service 6f2e62
	Change the BOOTPROTO and STARTMODE lines to the following:
Packit Service 6f2e62
Packit Service 6f2e62
BOOTPROTO='none'
Packit Service 6f2e62
STARTMODE='off'
Packit Service 6f2e62
Packit Service 6f2e62
	Do not alter the UNIQUE or _nm_name lines.  Remove any other
Packit Service 6f2e62
lines (USERCTL, etc).
Packit Service 6f2e62
Packit Service 6f2e62
	Once the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified,
Packit Service 6f2e62
it's time to create the configuration file for the bonding device
Packit Service 6f2e62
itself.  This file is named ifcfg-bondX, where X is the number of the
Packit Service 6f2e62
bonding device to create, starting at 0.  The first such file is
Packit Service 6f2e62
ifcfg-bond0, the second is ifcfg-bond1, and so on.  The sysconfig
Packit Service 6f2e62
network configuration system will correctly start multiple instances
Packit Service 6f2e62
of bonding.
Packit Service 6f2e62
Packit Service 6f2e62
	The contents of the ifcfg-bondX file is as follows:
Packit Service 6f2e62
Packit Service 6f2e62
BOOTPROTO="static"
Packit Service 6f2e62
BROADCAST="10.0.2.255"
Packit Service 6f2e62
IPADDR="10.0.2.10"
Packit Service 6f2e62
NETMASK="255.255.0.0"
Packit Service 6f2e62
NETWORK="10.0.2.0"
Packit Service 6f2e62
REMOTE_IPADDR=""
Packit Service 6f2e62
STARTMODE="onboot"
Packit Service 6f2e62
BONDING_MASTER="yes"
Packit Service 6f2e62
BONDING_MODULE_OPTS="mode=active-backup miimon=100"
Packit Service 6f2e62
BONDING_SLAVE0="eth0"
Packit Service 6f2e62
BONDING_SLAVE1="bus-pci-0000:06:08.1"
Packit Service 6f2e62
Packit Service 6f2e62
	Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK
Packit Service 6f2e62
values with the appropriate values for your network.
Packit Service 6f2e62
Packit Service 6f2e62
	The STARTMODE specifies when the device is brought online.
Packit Service 6f2e62
The possible values are:
Packit Service 6f2e62
Packit Service 6f2e62
	onboot:	 The device is started at boot time.  If you're not
Packit Service 6f2e62
		 sure, this is probably what you want.
Packit Service 6f2e62
Packit Service 6f2e62
	manual:	 The device is started only when ifup is called
Packit Service 6f2e62
		 manually.  Bonding devices may be configured this
Packit Service 6f2e62
		 way if you do not wish them to start automatically
Packit Service 6f2e62
		 at boot for some reason.
Packit Service 6f2e62
Packit Service 6f2e62
	hotplug: The device is started by a hotplug event.  This is not
Packit Service 6f2e62
		 a valid choice for a bonding device.
Packit Service 6f2e62
Packit Service 6f2e62
	off or ignore: The device configuration is ignored.
Packit Service 6f2e62
Packit Service 6f2e62
	The line BONDING_MASTER='yes' indicates that the device is a
Packit Service 6f2e62
bonding master device.  The only useful value is "yes."
Packit Service 6f2e62
Packit Service 6f2e62
	The contents of BONDING_MODULE_OPTS are supplied to the
Packit Service 6f2e62
instance of the bonding module for this device.  Specify the options
Packit Service 6f2e62
for the bonding mode, link monitoring, and so on here.  Do not include
Packit Service 6f2e62
the max_bonds bonding parameter; this will confuse the configuration
Packit Service 6f2e62
system if you have multiple bonding devices.
Packit Service 6f2e62
Packit Service 6f2e62
	Finally, supply one BONDING_SLAVEn="slave device" for each
Packit Service 6f2e62
slave.  where "n" is an increasing value, one for each slave.  The
Packit Service 6f2e62
"slave device" is either an interface name, e.g., "eth0", or a device
Packit Service 6f2e62
specifier for the network device.  The interface name is easier to
Packit Service 6f2e62
find, but the ethN names are subject to change at boot time if, e.g.,
Packit Service 6f2e62
a device early in the sequence has failed.  The device specifiers
Packit Service 6f2e62
(bus-pci-0000:06:08.1 in the example above) specify the physical
Packit Service 6f2e62
network device, and will not change unless the device's bus location
Packit Service 6f2e62
changes (for example, it is moved from one PCI slot to another).  The
Packit Service 6f2e62
example above uses one of each type for demonstration purposes; most
Packit Service 6f2e62
configurations will choose one or the other for all slave devices.
Packit Service 6f2e62
Packit Service 6f2e62
	When all configuration files have been modified or created,
Packit Service 6f2e62
networking must be restarted for the configuration changes to take
Packit Service 6f2e62
effect.  This can be accomplished via the following:
Packit Service 6f2e62
Packit Service 6f2e62
# /etc/init.d/network restart
Packit Service 6f2e62
Packit Service 6f2e62
	Note that the network control script (/sbin/ifdown) will
Packit Service 6f2e62
remove the bonding module as part of the network shutdown processing,
Packit Service 6f2e62
so it is not necessary to remove the module by hand if, e.g., the
Packit Service 6f2e62
module parameters have changed.
Packit Service 6f2e62
Packit Service 6f2e62
	Also, at this writing, YaST/YaST2 will not manage bonding
Packit Service 6f2e62
devices (they do not show bonding interfaces on its list of network
Packit Service 6f2e62
devices).  It is necessary to edit the configuration file by hand to
Packit Service 6f2e62
change the bonding configuration.
Packit Service 6f2e62
Packit Service 6f2e62
	Additional general options and details of the ifcfg file
Packit Service 6f2e62
format can be found in an example ifcfg template file:
Packit Service 6f2e62
Packit Service 6f2e62
/etc/sysconfig/network/ifcfg.template
Packit Service 6f2e62
Packit Service 6f2e62
	Note that the template does not document the various BONDING_
Packit Service 6f2e62
settings described above, but does describe many of the other options.
Packit Service 6f2e62
Packit Service 6f2e62
3.1.1 Using DHCP with Sysconfig
Packit Service 6f2e62
-------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Under sysconfig, configuring a device with BOOTPROTO='dhcp'
Packit Service 6f2e62
will cause it to query DHCP for its IP address information.  At this
Packit Service 6f2e62
writing, this does not function for bonding devices; the scripts
Packit Service 6f2e62
attempt to obtain the device address from DHCP prior to adding any of
Packit Service 6f2e62
the slave devices.  Without active slaves, the DHCP requests are not
Packit Service 6f2e62
sent to the network.
Packit Service 6f2e62
Packit Service 6f2e62
3.1.2 Configuring Multiple Bonds with Sysconfig
Packit Service 6f2e62
-----------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The sysconfig network initialization system is capable of
Packit Service 6f2e62
handling multiple bonding devices.  All that is necessary is for each
Packit Service 6f2e62
bonding instance to have an appropriately configured ifcfg-bondX file
Packit Service 6f2e62
(as described above).  Do not specify the "max_bonds" parameter to any
Packit Service 6f2e62
instance of bonding, as this will confuse sysconfig.  If you require
Packit Service 6f2e62
multiple bonding devices with identical parameters, create multiple
Packit Service 6f2e62
ifcfg-bondX files.
Packit Service 6f2e62
Packit Service 6f2e62
	Because the sysconfig scripts supply the bonding module
Packit Service 6f2e62
options in the ifcfg-bondX file, it is not necessary to add them to
Packit Service 6f2e62
the system /etc/modules.d/*.conf configuration files.
Packit Service 6f2e62
Packit Service 6f2e62
3.2 Configuration with Initscripts Support
Packit Service 6f2e62
------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	This section applies to distros using a recent version of
Packit Service 6f2e62
initscripts with bonding support, for example, Red Hat Enterprise Linux
Packit Service 6f2e62
version 3 or later, Fedora, etc.  On these systems, the network
Packit Service 6f2e62
initialization scripts have knowledge of bonding, and can be configured to
Packit Service 6f2e62
control bonding devices.  Note that older versions of the initscripts
Packit Service 6f2e62
package have lower levels of support for bonding; this will be noted where
Packit Service 6f2e62
applicable.
Packit Service 6f2e62
Packit Service 6f2e62
	These distros will not automatically load the network adapter
Packit Service 6f2e62
driver unless the ethX device is configured with an IP address.
Packit Service 6f2e62
Because of this constraint, users must manually configure a
Packit Service 6f2e62
network-script file for all physical adapters that will be members of
Packit Service 6f2e62
a bondX link.  Network script files are located in the directory:
Packit Service 6f2e62
Packit Service 6f2e62
/etc/sysconfig/network-scripts
Packit Service 6f2e62
Packit Service 6f2e62
	The file name must be prefixed with "ifcfg-eth" and suffixed
Packit Service 6f2e62
with the adapter's physical adapter number.  For example, the script
Packit Service 6f2e62
for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.
Packit Service 6f2e62
Place the following text in the file:
Packit Service 6f2e62
Packit Service 6f2e62
DEVICE=eth0
Packit Service 6f2e62
USERCTL=no
Packit Service 6f2e62
ONBOOT=yes
Packit Service 6f2e62
MASTER=bond0
Packit Service 6f2e62
SLAVE=yes
Packit Service 6f2e62
BOOTPROTO=none
Packit Service 6f2e62
Packit Service 6f2e62
	The DEVICE= line will be different for every ethX device and
Packit Service 6f2e62
must correspond with the name of the file, i.e., ifcfg-eth1 must have
Packit Service 6f2e62
a device line of DEVICE=eth1.  The setting of the MASTER= line will
Packit Service 6f2e62
also depend on the final bonding interface name chosen for your bond.
Packit Service 6f2e62
As with other network devices, these typically start at 0, and go up
Packit Service 6f2e62
one for each device, i.e., the first bonding instance is bond0, the
Packit Service 6f2e62
second is bond1, and so on.
Packit Service 6f2e62
Packit Service 6f2e62
	Next, create a bond network script.  The file name for this
Packit Service 6f2e62
script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is
Packit Service 6f2e62
the number of the bond.  For bond0 the file is named "ifcfg-bond0",
Packit Service 6f2e62
for bond1 it is named "ifcfg-bond1", and so on.  Within that file,
Packit Service 6f2e62
place the following text:
Packit Service 6f2e62
Packit Service 6f2e62
DEVICE=bond0
Packit Service 6f2e62
IPADDR=192.168.1.1
Packit Service 6f2e62
NETMASK=255.255.255.0
Packit Service 6f2e62
NETWORK=192.168.1.0
Packit Service 6f2e62
BROADCAST=192.168.1.255
Packit Service 6f2e62
ONBOOT=yes
Packit Service 6f2e62
BOOTPROTO=none
Packit Service 6f2e62
USERCTL=no
Packit Service 6f2e62
Packit Service 6f2e62
	Be sure to change the networking specific lines (IPADDR,
Packit Service 6f2e62
NETMASK, NETWORK and BROADCAST) to match your network configuration.
Packit Service 6f2e62
Packit Service 6f2e62
	For later versions of initscripts, such as that found with Fedora
Packit Service 6f2e62
7 (or later) and Red Hat Enterprise Linux version 5 (or later), it is possible,
Packit Service 6f2e62
and, indeed, preferable, to specify the bonding options in the ifcfg-bond0
Packit Service 6f2e62
file, e.g. a line of the format:
Packit Service 6f2e62
Packit Service 6f2e62
BONDING_OPTS="mode=active-backup arp_interval=60 arp_ip_target=192.168.1.254"
Packit Service 6f2e62
Packit Service 6f2e62
	will configure the bond with the specified options.  The options
Packit Service 6f2e62
specified in BONDING_OPTS are identical to the bonding module parameters
Packit Service 6f2e62
except for the arp_ip_target field when using versions of initscripts older
Packit Service 6f2e62
than and 8.57 (Fedora 8) and 8.45.19 (Red Hat Enterprise Linux 5.2).  When
Packit Service 6f2e62
using older versions each target should be included as a separate option and
Packit Service 6f2e62
should be preceded by a '+' to indicate it should be added to the list of
Packit Service 6f2e62
queried targets, e.g.,
Packit Service 6f2e62
Packit Service 6f2e62
	arp_ip_target=+192.168.1.1 arp_ip_target=+192.168.1.2
Packit Service 6f2e62
Packit Service 6f2e62
	is the proper syntax to specify multiple targets.  When specifying
Packit Service 6f2e62
options via BONDING_OPTS, it is not necessary to edit /etc/modprobe.d/*.conf.
Packit Service 6f2e62
Packit Service 6f2e62
	For even older versions of initscripts that do not support
Packit Service 6f2e62
BONDING_OPTS, it is necessary to edit /etc/modprobe.d/*.conf, depending upon
Packit Service 6f2e62
your distro) to load the bonding module with your desired options when the
Packit Service 6f2e62
bond0 interface is brought up.  The following lines in /etc/modprobe.d/*.conf
Packit Service 6f2e62
will load the bonding module, and select its options:
Packit Service 6f2e62
Packit Service 6f2e62
alias bond0 bonding
Packit Service 6f2e62
options bond0 mode=balance-alb miimon=100
Packit Service 6f2e62
Packit Service 6f2e62
	Replace the sample parameters with the appropriate set of
Packit Service 6f2e62
options for your configuration.
Packit Service 6f2e62
Packit Service 6f2e62
	Finally run "/etc/rc.d/init.d/network restart" as root.  This
Packit Service 6f2e62
will restart the networking subsystem and your bond link should be now
Packit Service 6f2e62
up and running.
Packit Service 6f2e62
Packit Service 6f2e62
3.2.1 Using DHCP with Initscripts
Packit Service 6f2e62
---------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Recent versions of initscripts (the versions supplied with Fedora
Packit Service 6f2e62
Core 3 and Red Hat Enterprise Linux 4, or later versions, are reported to
Packit Service 6f2e62
work) have support for assigning IP information to bonding devices via
Packit Service 6f2e62
DHCP.
Packit Service 6f2e62
Packit Service 6f2e62
	To configure bonding for DHCP, configure it as described
Packit Service 6f2e62
above, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp"
Packit Service 6f2e62
and add a line consisting of "TYPE=Bonding".  Note that the TYPE value
Packit Service 6f2e62
is case sensitive.
Packit Service 6f2e62
Packit Service 6f2e62
3.2.2 Configuring Multiple Bonds with Initscripts
Packit Service 6f2e62
-------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Initscripts packages that are included with Fedora 7 and Red Hat
Packit Service 6f2e62
Enterprise Linux 5 support multiple bonding interfaces by simply
Packit Service 6f2e62
specifying the appropriate BONDING_OPTS= in ifcfg-bondX where X is the
Packit Service 6f2e62
number of the bond.  This support requires sysfs support in the kernel,
Packit Service 6f2e62
and a bonding driver of version 3.0.0 or later.  Other configurations may
Packit Service 6f2e62
not support this method for specifying multiple bonding interfaces; for
Packit Service 6f2e62
those instances, see the "Configuring Multiple Bonds Manually" section,
Packit Service 6f2e62
below.
Packit Service 6f2e62
Packit Service 6f2e62
3.3 Configuring Bonding Manually with Ifenslave
Packit Service 6f2e62
-----------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	This section applies to distros whose network initialization
Packit Service 6f2e62
scripts (the sysconfig or initscripts package) do not have specific
Packit Service 6f2e62
knowledge of bonding.  One such distro is SuSE Linux Enterprise Server
Packit Service 6f2e62
version 8.
Packit Service 6f2e62
Packit Service 6f2e62
	The general method for these systems is to place the bonding
Packit Service 6f2e62
module parameters into a config file in /etc/modprobe.d/ (as
Packit Service 6f2e62
appropriate for the installed distro), then add modprobe and/or
Packit Service 6f2e62
ifenslave commands to the system's global init script.  The name of
Packit Service 6f2e62
the global init script differs; for sysconfig, it is
Packit Service 6f2e62
/etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
Packit Service 6f2e62
Packit Service 6f2e62
	For example, if you wanted to make a simple bond of two e100
Packit Service 6f2e62
devices (presumed to be eth0 and eth1), and have it persist across
Packit Service 6f2e62
reboots, edit the appropriate file (/etc/init.d/boot.local or
Packit Service 6f2e62
/etc/rc.d/rc.local), and add the following:
Packit Service 6f2e62
Packit Service 6f2e62
modprobe bonding mode=balance-alb miimon=100
Packit Service 6f2e62
modprobe e100
Packit Service 6f2e62
ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
Packit Service 6f2e62
ifenslave bond0 eth0
Packit Service 6f2e62
ifenslave bond0 eth1
Packit Service 6f2e62
Packit Service 6f2e62
	Replace the example bonding module parameters and bond0
Packit Service 6f2e62
network configuration (IP address, netmask, etc) with the appropriate
Packit Service 6f2e62
values for your configuration.
Packit Service 6f2e62
Packit Service 6f2e62
	Unfortunately, this method will not provide support for the
Packit Service 6f2e62
ifup and ifdown scripts on the bond devices.  To reload the bonding
Packit Service 6f2e62
configuration, it is necessary to run the initialization script, e.g.,
Packit Service 6f2e62
Packit Service 6f2e62
# /etc/init.d/boot.local
Packit Service 6f2e62
Packit Service 6f2e62
	or
Packit Service 6f2e62
Packit Service 6f2e62
# /etc/rc.d/rc.local
Packit Service 6f2e62
Packit Service 6f2e62
	It may be desirable in such a case to create a separate script
Packit Service 6f2e62
which only initializes the bonding configuration, then call that
Packit Service 6f2e62
separate script from within boot.local.  This allows for bonding to be
Packit Service 6f2e62
enabled without re-running the entire global init script.
Packit Service 6f2e62
Packit Service 6f2e62
	To shut down the bonding devices, it is necessary to first
Packit Service 6f2e62
mark the bonding device itself as being down, then remove the
Packit Service 6f2e62
appropriate device driver modules.  For our example above, you can do
Packit Service 6f2e62
the following:
Packit Service 6f2e62
Packit Service 6f2e62
# ifconfig bond0 down
Packit Service 6f2e62
# rmmod bonding
Packit Service 6f2e62
# rmmod e100
Packit Service 6f2e62
Packit Service 6f2e62
	Again, for convenience, it may be desirable to create a script
Packit Service 6f2e62
with these commands.
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
3.3.1 Configuring Multiple Bonds Manually
Packit Service 6f2e62
-----------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	This section contains information on configuring multiple
Packit Service 6f2e62
bonding devices with differing options for those systems whose network
Packit Service 6f2e62
initialization scripts lack support for configuring multiple bonds.
Packit Service 6f2e62
Packit Service 6f2e62
	If you require multiple bonding devices, but all with the same
Packit Service 6f2e62
options, you may wish to use the "max_bonds" module parameter,
Packit Service 6f2e62
documented above.
Packit Service 6f2e62
Packit Service 6f2e62
	To create multiple bonding devices with differing options, it is
Packit Service 6f2e62
preferable to use bonding parameters exported by sysfs, documented in the
Packit Service 6f2e62
section below.
Packit Service 6f2e62
Packit Service 6f2e62
	For versions of bonding without sysfs support, the only means to
Packit Service 6f2e62
provide multiple instances of bonding with differing options is to load
Packit Service 6f2e62
the bonding driver multiple times.  Note that current versions of the
Packit Service 6f2e62
sysconfig network initialization scripts handle this automatically; if
Packit Service 6f2e62
your distro uses these scripts, no special action is needed.  See the
Packit Service 6f2e62
section Configuring Bonding Devices, above, if you're not sure about your
Packit Service 6f2e62
network initialization scripts.
Packit Service 6f2e62
Packit Service 6f2e62
	To load multiple instances of the module, it is necessary to
Packit Service 6f2e62
specify a different name for each instance (the module loading system
Packit Service 6f2e62
requires that every loaded module, even multiple instances of the same
Packit Service 6f2e62
module, have a unique name).  This is accomplished by supplying multiple
Packit Service 6f2e62
sets of bonding options in /etc/modprobe.d/*.conf, for example:
Packit Service 6f2e62
Packit Service 6f2e62
alias bond0 bonding
Packit Service 6f2e62
options bond0 -o bond0 mode=balance-rr miimon=100
Packit Service 6f2e62
Packit Service 6f2e62
alias bond1 bonding
Packit Service 6f2e62
options bond1 -o bond1 mode=balance-alb miimon=50
Packit Service 6f2e62
Packit Service 6f2e62
	will load the bonding module two times.  The first instance is
Packit Service 6f2e62
named "bond0" and creates the bond0 device in balance-rr mode with an
Packit Service 6f2e62
miimon of 100.  The second instance is named "bond1" and creates the
Packit Service 6f2e62
bond1 device in balance-alb mode with an miimon of 50.
Packit Service 6f2e62
Packit Service 6f2e62
	In some circumstances (typically with older distributions),
Packit Service 6f2e62
the above does not work, and the second bonding instance never sees
Packit Service 6f2e62
its options.  In that case, the second options line can be substituted
Packit Service 6f2e62
as follows:
Packit Service 6f2e62
Packit Service 6f2e62
install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
Packit Service 6f2e62
	mode=balance-alb miimon=50
Packit Service 6f2e62
Packit Service 6f2e62
	This may be repeated any number of times, specifying a new and
Packit Service 6f2e62
unique name in place of bond1 for each subsequent instance.
Packit Service 6f2e62
Packit Service 6f2e62
	It has been observed that some Red Hat supplied kernels are unable
Packit Service 6f2e62
to rename modules at load time (the "-o bond1" part).  Attempts to pass
Packit Service 6f2e62
that option to modprobe will produce an "Operation not permitted" error.
Packit Service 6f2e62
This has been reported on some Fedora Core kernels, and has been seen on
Packit Service 6f2e62
RHEL 4 as well.  On kernels exhibiting this problem, it will be impossible
Packit Service 6f2e62
to configure multiple bonds with differing parameters (as they are older
Packit Service 6f2e62
kernels, and also lack sysfs support).
Packit Service 6f2e62
Packit Service 6f2e62
3.4 Configuring Bonding Manually via Sysfs
Packit Service 6f2e62
------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Starting with version 3.0.0, Channel Bonding may be configured
Packit Service 6f2e62
via the sysfs interface.  This interface allows dynamic configuration
Packit Service 6f2e62
of all bonds in the system without unloading the module.  It also
Packit Service 6f2e62
allows for adding and removing bonds at runtime.  Ifenslave is no
Packit Service 6f2e62
longer required, though it is still supported.
Packit Service 6f2e62
Packit Service 6f2e62
	Use of the sysfs interface allows you to use multiple bonds
Packit Service 6f2e62
with different configurations without having to reload the module.
Packit Service 6f2e62
It also allows you to use multiple, differently configured bonds when
Packit Service 6f2e62
bonding is compiled into the kernel.
Packit Service 6f2e62
Packit Service 6f2e62
	You must have the sysfs filesystem mounted to configure
Packit Service 6f2e62
bonding this way.  The examples in this document assume that you
Packit Service 6f2e62
are using the standard mount point for sysfs, e.g. /sys.  If your
Packit Service 6f2e62
sysfs filesystem is mounted elsewhere, you will need to adjust the
Packit Service 6f2e62
example paths accordingly.
Packit Service 6f2e62
Packit Service 6f2e62
Creating and Destroying Bonds
Packit Service 6f2e62
-----------------------------
Packit Service 6f2e62
To add a new bond foo:
Packit Service 6f2e62
# echo +foo > /sys/class/net/bonding_masters
Packit Service 6f2e62
Packit Service 6f2e62
To remove an existing bond bar:
Packit Service 6f2e62
# echo -bar > /sys/class/net/bonding_masters
Packit Service 6f2e62
Packit Service 6f2e62
To show all existing bonds:
Packit Service 6f2e62
# cat /sys/class/net/bonding_masters
Packit Service 6f2e62
Packit Service 6f2e62
NOTE: due to 4K size limitation of sysfs files, this list may be
Packit Service 6f2e62
truncated if you have more than a few hundred bonds.  This is unlikely
Packit Service 6f2e62
to occur under normal operating conditions.
Packit Service 6f2e62
Packit Service 6f2e62
Adding and Removing Slaves
Packit Service 6f2e62
--------------------------
Packit Service 6f2e62
	Interfaces may be enslaved to a bond using the file
Packit Service 6f2e62
/sys/class/net/<bond>/bonding/slaves.  The semantics for this file
Packit Service 6f2e62
are the same as for the bonding_masters file.
Packit Service 6f2e62
Packit Service 6f2e62
To enslave interface eth0 to bond bond0:
Packit Service 6f2e62
# ifconfig bond0 up
Packit Service 6f2e62
# echo +eth0 > /sys/class/net/bond0/bonding/slaves
Packit Service 6f2e62
Packit Service 6f2e62
To free slave eth0 from bond bond0:
Packit Service 6f2e62
# echo -eth0 > /sys/class/net/bond0/bonding/slaves
Packit Service 6f2e62
Packit Service 6f2e62
	When an interface is enslaved to a bond, symlinks between the
Packit Service 6f2e62
two are created in the sysfs filesystem.  In this case, you would get
Packit Service 6f2e62
/sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and
Packit Service 6f2e62
/sys/class/net/eth0/master pointing to /sys/class/net/bond0.
Packit Service 6f2e62
Packit Service 6f2e62
	This means that you can tell quickly whether or not an
Packit Service 6f2e62
interface is enslaved by looking for the master symlink.  Thus:
Packit Service 6f2e62
# echo -eth0 > /sys/class/net/eth0/master/bonding/slaves
Packit Service 6f2e62
will free eth0 from whatever bond it is enslaved to, regardless of
Packit Service 6f2e62
the name of the bond interface.
Packit Service 6f2e62
Packit Service 6f2e62
Changing a Bond's Configuration
Packit Service 6f2e62
-------------------------------
Packit Service 6f2e62
	Each bond may be configured individually by manipulating the
Packit Service 6f2e62
files located in /sys/class/net/<bond name>/bonding
Packit Service 6f2e62
Packit Service 6f2e62
	The names of these files correspond directly with the command-
Packit Service 6f2e62
line parameters described elsewhere in this file, and, with the
Packit Service 6f2e62
exception of arp_ip_target, they accept the same values.  To see the
Packit Service 6f2e62
current setting, simply cat the appropriate file.
Packit Service 6f2e62
Packit Service 6f2e62
	A few examples will be given here; for specific usage
Packit Service 6f2e62
guidelines for each parameter, see the appropriate section in this
Packit Service 6f2e62
document.
Packit Service 6f2e62
Packit Service 6f2e62
To configure bond0 for balance-alb mode:
Packit Service 6f2e62
# ifconfig bond0 down
Packit Service 6f2e62
# echo 6 > /sys/class/net/bond0/bonding/mode
Packit Service 6f2e62
 - or -
Packit Service 6f2e62
# echo balance-alb > /sys/class/net/bond0/bonding/mode
Packit Service 6f2e62
	NOTE: The bond interface must be down before the mode can be
Packit Service 6f2e62
changed.
Packit Service 6f2e62
Packit Service 6f2e62
To enable MII monitoring on bond0 with a 1 second interval:
Packit Service 6f2e62
# echo 1000 > /sys/class/net/bond0/bonding/miimon
Packit Service 6f2e62
	NOTE: If ARP monitoring is enabled, it will disabled when MII
Packit Service 6f2e62
monitoring is enabled, and vice-versa.
Packit Service 6f2e62
Packit Service 6f2e62
To add ARP targets:
Packit Service 6f2e62
# echo +192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
Packit Service 6f2e62
# echo +192.168.0.101 > /sys/class/net/bond0/bonding/arp_ip_target
Packit Service 6f2e62
	NOTE:  up to 16 target addresses may be specified.
Packit Service 6f2e62
Packit Service 6f2e62
To remove an ARP target:
Packit Service 6f2e62
# echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
Packit Service 6f2e62
Packit Service 6f2e62
Example Configuration
Packit Service 6f2e62
---------------------
Packit Service 6f2e62
	We begin with the same example that is shown in section 3.3,
Packit Service 6f2e62
executed with sysfs, and without using ifenslave.
Packit Service 6f2e62
Packit Service 6f2e62
	To make a simple bond of two e100 devices (presumed to be eth0
Packit Service 6f2e62
and eth1), and have it persist across reboots, edit the appropriate
Packit Service 6f2e62
file (/etc/init.d/boot.local or /etc/rc.d/rc.local), and add the
Packit Service 6f2e62
following:
Packit Service 6f2e62
Packit Service 6f2e62
modprobe bonding
Packit Service 6f2e62
modprobe e100
Packit Service 6f2e62
echo balance-alb > /sys/class/net/bond0/bonding/mode
Packit Service 6f2e62
ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
Packit Service 6f2e62
echo 100 > /sys/class/net/bond0/bonding/miimon
Packit Service 6f2e62
echo +eth0 > /sys/class/net/bond0/bonding/slaves
Packit Service 6f2e62
echo +eth1 > /sys/class/net/bond0/bonding/slaves
Packit Service 6f2e62
Packit Service 6f2e62
	To add a second bond, with two e1000 interfaces in
Packit Service 6f2e62
active-backup mode, using ARP monitoring, add the following lines to
Packit Service 6f2e62
your init script:
Packit Service 6f2e62
Packit Service 6f2e62
modprobe e1000
Packit Service 6f2e62
echo +bond1 > /sys/class/net/bonding_masters
Packit Service 6f2e62
echo active-backup > /sys/class/net/bond1/bonding/mode
Packit Service 6f2e62
ifconfig bond1 192.168.2.1 netmask 255.255.255.0 up
Packit Service 6f2e62
echo +192.168.2.100 /sys/class/net/bond1/bonding/arp_ip_target
Packit Service 6f2e62
echo 2000 > /sys/class/net/bond1/bonding/arp_interval
Packit Service 6f2e62
echo +eth2 > /sys/class/net/bond1/bonding/slaves
Packit Service 6f2e62
echo +eth3 > /sys/class/net/bond1/bonding/slaves
Packit Service 6f2e62
Packit Service 6f2e62
3.5 Configuration with Interfaces Support
Packit Service 6f2e62
-----------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
        This section applies to distros which use /etc/network/interfaces file
Packit Service 6f2e62
to describe network interface configuration, most notably Debian and it's
Packit Service 6f2e62
derivatives.
Packit Service 6f2e62
Packit Service 6f2e62
	The ifup and ifdown commands on Debian don't support bonding out of
Packit Service 6f2e62
the box. The ifenslave-2.6 package should be installed to provide bonding
Packit Service 6f2e62
support.  Once installed, this package will provide bond-* options to be used
Packit Service 6f2e62
into /etc/network/interfaces.
Packit Service 6f2e62
Packit Service 6f2e62
	Note that ifenslave-2.6 package will load the bonding module and use
Packit Service 6f2e62
the ifenslave command when appropriate.
Packit Service 6f2e62
Packit Service 6f2e62
Example Configurations
Packit Service 6f2e62
----------------------
Packit Service 6f2e62
Packit Service 6f2e62
In /etc/network/interfaces, the following stanza will configure bond0, in
Packit Service 6f2e62
active-backup mode, with eth0 and eth1 as slaves.
Packit Service 6f2e62
Packit Service 6f2e62
auto bond0
Packit Service 6f2e62
iface bond0 inet dhcp
Packit Service 6f2e62
	bond-slaves eth0 eth1
Packit Service 6f2e62
	bond-mode active-backup
Packit Service 6f2e62
	bond-miimon 100
Packit Service 6f2e62
	bond-primary eth0 eth1
Packit Service 6f2e62
Packit Service 6f2e62
If the above configuration doesn't work, you might have a system using
Packit Service 6f2e62
upstart for system startup. This is most notably true for recent
Packit Service 6f2e62
Ubuntu versions. The following stanza in /etc/network/interfaces will
Packit Service 6f2e62
produce the same result on those systems.
Packit Service 6f2e62
Packit Service 6f2e62
auto bond0
Packit Service 6f2e62
iface bond0 inet dhcp
Packit Service 6f2e62
	bond-slaves none
Packit Service 6f2e62
	bond-mode active-backup
Packit Service 6f2e62
	bond-miimon 100
Packit Service 6f2e62
Packit Service 6f2e62
auto eth0
Packit Service 6f2e62
iface eth0 inet manual
Packit Service 6f2e62
	bond-master bond0
Packit Service 6f2e62
	bond-primary eth0 eth1
Packit Service 6f2e62
Packit Service 6f2e62
auto eth1
Packit Service 6f2e62
iface eth1 inet manual
Packit Service 6f2e62
	bond-master bond0
Packit Service 6f2e62
	bond-primary eth0 eth1
Packit Service 6f2e62
Packit Service 6f2e62
For a full list of bond-* supported options in /etc/network/interfaces and some
Packit Service 6f2e62
more advanced examples tailored to you particular distros, see the files in
Packit Service 6f2e62
/usr/share/doc/ifenslave-2.6.
Packit Service 6f2e62
Packit Service 6f2e62
3.6 Overriding Configuration for Special Cases
Packit Service 6f2e62
----------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
When using the bonding driver, the physical port which transmits a frame is
Packit Service 6f2e62
typically selected by the bonding driver, and is not relevant to the user or
Packit Service 6f2e62
system administrator.  The output port is simply selected using the policies of
Packit Service 6f2e62
the selected bonding mode.  On occasion however, it is helpful to direct certain
Packit Service 6f2e62
classes of traffic to certain physical interfaces on output to implement
Packit Service 6f2e62
slightly more complex policies.  For example, to reach a web server over a
Packit Service 6f2e62
bonded interface in which eth0 connects to a private network, while eth1
Packit Service 6f2e62
connects via a public network, it may be desirous to bias the bond to send said
Packit Service 6f2e62
traffic over eth0 first, using eth1 only as a fall back, while all other traffic
Packit Service 6f2e62
can safely be sent over either interface.  Such configurations may be achieved
Packit Service 6f2e62
using the traffic control utilities inherent in linux.
Packit Service 6f2e62
Packit Service 6f2e62
By default the bonding driver is multiqueue aware and 16 queues are created
Packit Service 6f2e62
when the driver initializes (see Documentation/networking/multiqueue.txt
Packit Service 6f2e62
for details).  If more or less queues are desired the module parameter
Packit Service 6f2e62
tx_queues can be used to change this value.  There is no sysfs parameter
Packit Service 6f2e62
available as the allocation is done at module init time.
Packit Service 6f2e62
Packit Service 6f2e62
The output of the file /proc/net/bonding/bondX has changed so the output Queue
Packit Service 6f2e62
ID is now printed for each slave:
Packit Service 6f2e62
Packit Service 6f2e62
Bonding Mode: fault-tolerance (active-backup)
Packit Service 6f2e62
Primary Slave: None
Packit Service 6f2e62
Currently Active Slave: eth0
Packit Service 6f2e62
MII Status: up
Packit Service 6f2e62
MII Polling Interval (ms): 0
Packit Service 6f2e62
Up Delay (ms): 0
Packit Service 6f2e62
Down Delay (ms): 0
Packit Service 6f2e62
Packit Service 6f2e62
Slave Interface: eth0
Packit Service 6f2e62
MII Status: up
Packit Service 6f2e62
Link Failure Count: 0
Packit Service 6f2e62
Permanent HW addr: 00:1a:a0:12:8f:cb
Packit Service 6f2e62
Slave queue ID: 0
Packit Service 6f2e62
Packit Service 6f2e62
Slave Interface: eth1
Packit Service 6f2e62
MII Status: up
Packit Service 6f2e62
Link Failure Count: 0
Packit Service 6f2e62
Permanent HW addr: 00:1a:a0:12:8f:cc
Packit Service 6f2e62
Slave queue ID: 2
Packit Service 6f2e62
Packit Service 6f2e62
The queue_id for a slave can be set using the command:
Packit Service 6f2e62
Packit Service 6f2e62
# echo "eth1:2" > /sys/class/net/bond0/bonding/queue_id
Packit Service 6f2e62
Packit Service 6f2e62
Any interface that needs a queue_id set should set it with multiple calls
Packit Service 6f2e62
like the one above until proper priorities are set for all interfaces.  On
Packit Service 6f2e62
distributions that allow configuration via initscripts, multiple 'queue_id'
Packit Service 6f2e62
arguments can be added to BONDING_OPTS to set all needed slave queues.
Packit Service 6f2e62
Packit Service 6f2e62
These queue id's can be used in conjunction with the tc utility to configure
Packit Service 6f2e62
a multiqueue qdisc and filters to bias certain traffic to transmit on certain
Packit Service 6f2e62
slave devices.  For instance, say we wanted, in the above configuration to
Packit Service 6f2e62
force all traffic bound to 192.168.1.100 to use eth1 in the bond as its output
Packit Service 6f2e62
device. The following commands would accomplish this:
Packit Service 6f2e62
Packit Service 6f2e62
# tc qdisc add dev bond0 handle 1 root multiq
Packit Service 6f2e62
Packit Service 6f2e62
# tc filter add dev bond0 protocol ip parent 1: prio 1 u32 match ip dst \
Packit Service 6f2e62
	192.168.1.100 action skbedit queue_mapping 2
Packit Service 6f2e62
Packit Service 6f2e62
These commands tell the kernel to attach a multiqueue queue discipline to the
Packit Service 6f2e62
bond0 interface and filter traffic enqueued to it, such that packets with a dst
Packit Service 6f2e62
ip of 192.168.1.100 have their output queue mapping value overwritten to 2.
Packit Service 6f2e62
This value is then passed into the driver, causing the normal output path
Packit Service 6f2e62
selection policy to be overridden, selecting instead qid 2, which maps to eth1.
Packit Service 6f2e62
Packit Service 6f2e62
Note that qid values begin at 1.  Qid 0 is reserved to initiate to the driver
Packit Service 6f2e62
that normal output policy selection should take place.  One benefit to simply
Packit Service 6f2e62
leaving the qid for a slave to 0 is the multiqueue awareness in the bonding
Packit Service 6f2e62
driver that is now present.  This awareness allows tc filters to be placed on
Packit Service 6f2e62
slave devices as well as bond devices and the bonding driver will simply act as
Packit Service 6f2e62
a pass-through for selecting output queues on the slave device rather than 
Packit Service 6f2e62
output port selection.
Packit Service 6f2e62
Packit Service 6f2e62
This feature first appeared in bonding driver version 3.7.0 and support for
Packit Service 6f2e62
output slave selection was limited to round-robin and active-backup modes.
Packit Service 6f2e62
Packit Service 6f2e62
4 Querying Bonding Configuration
Packit Service 6f2e62
=================================
Packit Service 6f2e62
Packit Service 6f2e62
4.1 Bonding Configuration
Packit Service 6f2e62
-------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Each bonding device has a read-only file residing in the
Packit Service 6f2e62
/proc/net/bonding directory.  The file contents include information
Packit Service 6f2e62
about the bonding configuration, options and state of each slave.
Packit Service 6f2e62
Packit Service 6f2e62
	For example, the contents of /proc/net/bonding/bond0 after the
Packit Service 6f2e62
driver is loaded with parameters of mode=0 and miimon=1000 is
Packit Service 6f2e62
generally as follows:
Packit Service 6f2e62
Packit Service 6f2e62
	Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
Packit Service 6f2e62
        Bonding Mode: load balancing (round-robin)
Packit Service 6f2e62
        Currently Active Slave: eth0
Packit Service 6f2e62
        MII Status: up
Packit Service 6f2e62
        MII Polling Interval (ms): 1000
Packit Service 6f2e62
        Up Delay (ms): 0
Packit Service 6f2e62
        Down Delay (ms): 0
Packit Service 6f2e62
Packit Service 6f2e62
        Slave Interface: eth1
Packit Service 6f2e62
        MII Status: up
Packit Service 6f2e62
        Link Failure Count: 1
Packit Service 6f2e62
Packit Service 6f2e62
        Slave Interface: eth0
Packit Service 6f2e62
        MII Status: up
Packit Service 6f2e62
        Link Failure Count: 1
Packit Service 6f2e62
Packit Service 6f2e62
	The precise format and contents will change depending upon the
Packit Service 6f2e62
bonding configuration, state, and version of the bonding driver.
Packit Service 6f2e62
Packit Service 6f2e62
4.2 Network configuration
Packit Service 6f2e62
-------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The network configuration can be inspected using the ifconfig
Packit Service 6f2e62
command.  Bonding devices will have the MASTER flag set; Bonding slave
Packit Service 6f2e62
devices will have the SLAVE flag set.  The ifconfig output does not
Packit Service 6f2e62
contain information on which slaves are associated with which masters.
Packit Service 6f2e62
Packit Service 6f2e62
	In the example below, the bond0 interface is the master
Packit Service 6f2e62
(MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of
Packit Service 6f2e62
bond0 have the same MAC address (HWaddr) as bond0 for all modes except
Packit Service 6f2e62
TLB and ALB that require a unique MAC address for each slave.
Packit Service 6f2e62
Packit Service 6f2e62
# /sbin/ifconfig
Packit Service 6f2e62
bond0     Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
Packit Service 6f2e62
          inet addr:XXX.XXX.XXX.YYY  Bcast:XXX.XXX.XXX.255  Mask:255.255.252.0
Packit Service 6f2e62
          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
Packit Service 6f2e62
          RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
Packit Service 6f2e62
          TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
Packit Service 6f2e62
          collisions:0 txqueuelen:0
Packit Service 6f2e62
Packit Service 6f2e62
eth0      Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
Packit Service 6f2e62
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
Packit Service 6f2e62
          RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
Packit Service 6f2e62
          TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
Packit Service 6f2e62
          collisions:0 txqueuelen:100
Packit Service 6f2e62
          Interrupt:10 Base address:0x1080
Packit Service 6f2e62
Packit Service 6f2e62
eth1      Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
Packit Service 6f2e62
          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
Packit Service 6f2e62
          RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
Packit Service 6f2e62
          TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
Packit Service 6f2e62
          collisions:0 txqueuelen:100
Packit Service 6f2e62
          Interrupt:9 Base address:0x1400
Packit Service 6f2e62
Packit Service 6f2e62
5. Switch Configuration
Packit Service 6f2e62
=======================
Packit Service 6f2e62
Packit Service 6f2e62
	For this section, "switch" refers to whatever system the
Packit Service 6f2e62
bonded devices are directly connected to (i.e., where the other end of
Packit Service 6f2e62
the cable plugs into).  This may be an actual dedicated switch device,
Packit Service 6f2e62
or it may be another regular system (e.g., another computer running
Packit Service 6f2e62
Linux),
Packit Service 6f2e62
Packit Service 6f2e62
	The active-backup, balance-tlb and balance-alb modes do not
Packit Service 6f2e62
require any specific configuration of the switch.
Packit Service 6f2e62
Packit Service 6f2e62
	The 802.3ad mode requires that the switch have the appropriate
Packit Service 6f2e62
ports configured as an 802.3ad aggregation.  The precise method used
Packit Service 6f2e62
to configure this varies from switch to switch, but, for example, a
Packit Service 6f2e62
Cisco 3550 series switch requires that the appropriate ports first be
Packit Service 6f2e62
grouped together in a single etherchannel instance, then that
Packit Service 6f2e62
etherchannel is set to mode "lacp" to enable 802.3ad (instead of
Packit Service 6f2e62
standard EtherChannel).
Packit Service 6f2e62
Packit Service 6f2e62
	The balance-rr, balance-xor and broadcast modes generally
Packit Service 6f2e62
require that the switch have the appropriate ports grouped together.
Packit Service 6f2e62
The nomenclature for such a group differs between switches, it may be
Packit Service 6f2e62
called an "etherchannel" (as in the Cisco example, above), a "trunk
Packit Service 6f2e62
group" or some other similar variation.  For these modes, each switch
Packit Service 6f2e62
will also have its own configuration options for the switch's transmit
Packit Service 6f2e62
policy to the bond.  Typical choices include XOR of either the MAC or
Packit Service 6f2e62
IP addresses.  The transmit policy of the two peers does not need to
Packit Service 6f2e62
match.  For these three modes, the bonding mode really selects a
Packit Service 6f2e62
transmit policy for an EtherChannel group; all three will interoperate
Packit Service 6f2e62
with another EtherChannel group.
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
6. 802.1q VLAN Support
Packit Service 6f2e62
======================
Packit Service 6f2e62
Packit Service 6f2e62
	It is possible to configure VLAN devices over a bond interface
Packit Service 6f2e62
using the 8021q driver.  However, only packets coming from the 8021q
Packit Service 6f2e62
driver and passing through bonding will be tagged by default.  Self
Packit Service 6f2e62
generated packets, for example, bonding's learning packets or ARP
Packit Service 6f2e62
packets generated by either ALB mode or the ARP monitor mechanism, are
Packit Service 6f2e62
tagged internally by bonding itself.  As a result, bonding must
Packit Service 6f2e62
"learn" the VLAN IDs configured above it, and use those IDs to tag
Packit Service 6f2e62
self generated packets.
Packit Service 6f2e62
Packit Service 6f2e62
	For reasons of simplicity, and to support the use of adapters
Packit Service 6f2e62
that can do VLAN hardware acceleration offloading, the bonding
Packit Service 6f2e62
interface declares itself as fully hardware offloading capable, it gets
Packit Service 6f2e62
the add_vid/kill_vid notifications to gather the necessary
Packit Service 6f2e62
information, and it propagates those actions to the slaves.  In case
Packit Service 6f2e62
of mixed adapter types, hardware accelerated tagged packets that
Packit Service 6f2e62
should go through an adapter that is not offloading capable are
Packit Service 6f2e62
"un-accelerated" by the bonding driver so the VLAN tag sits in the
Packit Service 6f2e62
regular location.
Packit Service 6f2e62
Packit Service 6f2e62
	VLAN interfaces *must* be added on top of a bonding interface
Packit Service 6f2e62
only after enslaving at least one slave.  The bonding interface has a
Packit Service 6f2e62
hardware address of 00:00:00:00:00:00 until the first slave is added.
Packit Service 6f2e62
If the VLAN interface is created prior to the first enslavement, it
Packit Service 6f2e62
would pick up the all-zeroes hardware address.  Once the first slave
Packit Service 6f2e62
is attached to the bond, the bond device itself will pick up the
Packit Service 6f2e62
slave's hardware address, which is then available for the VLAN device.
Packit Service 6f2e62
Packit Service 6f2e62
	Also, be aware that a similar problem can occur if all slaves
Packit Service 6f2e62
are released from a bond that still has one or more VLAN interfaces on
Packit Service 6f2e62
top of it.  When a new slave is added, the bonding interface will
Packit Service 6f2e62
obtain its hardware address from the first slave, which might not
Packit Service 6f2e62
match the hardware address of the VLAN interfaces (which was
Packit Service 6f2e62
ultimately copied from an earlier slave).
Packit Service 6f2e62
Packit Service 6f2e62
	There are two methods to insure that the VLAN device operates
Packit Service 6f2e62
with the correct hardware address if all slaves are removed from a
Packit Service 6f2e62
bond interface:
Packit Service 6f2e62
Packit Service 6f2e62
	1. Remove all VLAN interfaces then recreate them
Packit Service 6f2e62
Packit Service 6f2e62
	2. Set the bonding interface's hardware address so that it
Packit Service 6f2e62
matches the hardware address of the VLAN interfaces.
Packit Service 6f2e62
Packit Service 6f2e62
	Note that changing a VLAN interface's HW address would set the
Packit Service 6f2e62
underlying device -- i.e. the bonding interface -- to promiscuous
Packit Service 6f2e62
mode, which might not be what you want.
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
7. Link Monitoring
Packit Service 6f2e62
==================
Packit Service 6f2e62
Packit Service 6f2e62
	The bonding driver at present supports two schemes for
Packit Service 6f2e62
monitoring a slave device's link state: the ARP monitor and the MII
Packit Service 6f2e62
monitor.
Packit Service 6f2e62
Packit Service 6f2e62
	At the present time, due to implementation restrictions in the
Packit Service 6f2e62
bonding driver itself, it is not possible to enable both ARP and MII
Packit Service 6f2e62
monitoring simultaneously.
Packit Service 6f2e62
Packit Service 6f2e62
7.1 ARP Monitor Operation
Packit Service 6f2e62
-------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The ARP monitor operates as its name suggests: it sends ARP
Packit Service 6f2e62
queries to one or more designated peer systems on the network, and
Packit Service 6f2e62
uses the response as an indication that the link is operating.  This
Packit Service 6f2e62
gives some assurance that traffic is actually flowing to and from one
Packit Service 6f2e62
or more peers on the local network.
Packit Service 6f2e62
Packit Service 6f2e62
	The ARP monitor relies on the device driver itself to verify
Packit Service 6f2e62
that traffic is flowing.  In particular, the driver must keep up to
Packit Service 6f2e62
date the last receive time, dev->last_rx, and transmit start time,
Packit Service 6f2e62
dev->trans_start.  If these are not updated by the driver, then the
Packit Service 6f2e62
ARP monitor will immediately fail any slaves using that driver, and
Packit Service 6f2e62
those slaves will stay down.  If networking monitoring (tcpdump, etc)
Packit Service 6f2e62
shows the ARP requests and replies on the network, then it may be that
Packit Service 6f2e62
your device driver is not updating last_rx and trans_start.
Packit Service 6f2e62
Packit Service 6f2e62
7.2 Configuring Multiple ARP Targets
Packit Service 6f2e62
------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	While ARP monitoring can be done with just one target, it can
Packit Service 6f2e62
be useful in a High Availability setup to have several targets to
Packit Service 6f2e62
monitor.  In the case of just one target, the target itself may go
Packit Service 6f2e62
down or have a problem making it unresponsive to ARP requests.  Having
Packit Service 6f2e62
an additional target (or several) increases the reliability of the ARP
Packit Service 6f2e62
monitoring.
Packit Service 6f2e62
Packit Service 6f2e62
	Multiple ARP targets must be separated by commas as follows:
Packit Service 6f2e62
Packit Service 6f2e62
# example options for ARP monitoring with three targets
Packit Service 6f2e62
alias bond0 bonding
Packit Service 6f2e62
options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
Packit Service 6f2e62
Packit Service 6f2e62
	For just a single target the options would resemble:
Packit Service 6f2e62
Packit Service 6f2e62
# example options for ARP monitoring with one target
Packit Service 6f2e62
alias bond0 bonding
Packit Service 6f2e62
options bond0 arp_interval=60 arp_ip_target=192.168.0.100
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
7.3 MII Monitor Operation
Packit Service 6f2e62
-------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The MII monitor monitors only the carrier state of the local
Packit Service 6f2e62
network interface.  It accomplishes this in one of three ways: by
Packit Service 6f2e62
depending upon the device driver to maintain its carrier state, by
Packit Service 6f2e62
querying the device's MII registers, or by making an ethtool query to
Packit Service 6f2e62
the device.
Packit Service 6f2e62
Packit Service 6f2e62
	If the use_carrier module parameter is 1 (the default value),
Packit Service 6f2e62
then the MII monitor will rely on the driver for carrier state
Packit Service 6f2e62
information (via the netif_carrier subsystem).  As explained in the
Packit Service 6f2e62
use_carrier parameter information, above, if the MII monitor fails to
Packit Service 6f2e62
detect carrier loss on the device (e.g., when the cable is physically
Packit Service 6f2e62
disconnected), it may be that the driver does not support
Packit Service 6f2e62
netif_carrier.
Packit Service 6f2e62
Packit Service 6f2e62
	If use_carrier is 0, then the MII monitor will first query the
Packit Service 6f2e62
device's (via ioctl) MII registers and check the link state.  If that
Packit Service 6f2e62
request fails (not just that it returns carrier down), then the MII
Packit Service 6f2e62
monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain
Packit Service 6f2e62
the same information.  If both methods fail (i.e., the driver either
Packit Service 6f2e62
does not support or had some error in processing both the MII register
Packit Service 6f2e62
and ethtool requests), then the MII monitor will assume the link is
Packit Service 6f2e62
up.
Packit Service 6f2e62
Packit Service 6f2e62
8. Potential Sources of Trouble
Packit Service 6f2e62
===============================
Packit Service 6f2e62
Packit Service 6f2e62
8.1 Adventures in Routing
Packit Service 6f2e62
-------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	When bonding is configured, it is important that the slave
Packit Service 6f2e62
devices not have routes that supersede routes of the master (or,
Packit Service 6f2e62
generally, not have routes at all).  For example, suppose the bonding
Packit Service 6f2e62
device bond0 has two slaves, eth0 and eth1, and the routing table is
Packit Service 6f2e62
as follows:
Packit Service 6f2e62
Packit Service 6f2e62
Kernel IP routing table
Packit Service 6f2e62
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
Packit Service 6f2e62
10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth0
Packit Service 6f2e62
10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth1
Packit Service 6f2e62
10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 bond0
Packit Service 6f2e62
127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
Packit Service 6f2e62
Packit Service 6f2e62
	This routing configuration will likely still update the
Packit Service 6f2e62
receive/transmit times in the driver (needed by the ARP monitor), but
Packit Service 6f2e62
may bypass the bonding driver (because outgoing traffic to, in this
Packit Service 6f2e62
case, another host on network 10 would use eth0 or eth1 before bond0).
Packit Service 6f2e62
Packit Service 6f2e62
	The ARP monitor (and ARP itself) may become confused by this
Packit Service 6f2e62
configuration, because ARP requests (generated by the ARP monitor)
Packit Service 6f2e62
will be sent on one interface (bond0), but the corresponding reply
Packit Service 6f2e62
will arrive on a different interface (eth0).  This reply looks to ARP
Packit Service 6f2e62
as an unsolicited ARP reply (because ARP matches replies on an
Packit Service 6f2e62
interface basis), and is discarded.  The MII monitor is not affected
Packit Service 6f2e62
by the state of the routing table.
Packit Service 6f2e62
Packit Service 6f2e62
	The solution here is simply to insure that slaves do not have
Packit Service 6f2e62
routes of their own, and if for some reason they must, those routes do
Packit Service 6f2e62
not supersede routes of their master.  This should generally be the
Packit Service 6f2e62
case, but unusual configurations or errant manual or automatic static
Packit Service 6f2e62
route additions may cause trouble.
Packit Service 6f2e62
Packit Service 6f2e62
8.2 Ethernet Device Renaming
Packit Service 6f2e62
----------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	On systems with network configuration scripts that do not
Packit Service 6f2e62
associate physical devices directly with network interface names (so
Packit Service 6f2e62
that the same physical device always has the same "ethX" name), it may
Packit Service 6f2e62
be necessary to add some special logic to config files in
Packit Service 6f2e62
/etc/modprobe.d/.
Packit Service 6f2e62
Packit Service 6f2e62
	For example, given a modules.conf containing the following:
Packit Service 6f2e62
Packit Service 6f2e62
alias bond0 bonding
Packit Service 6f2e62
options bond0 mode=some-mode miimon=50
Packit Service 6f2e62
alias eth0 tg3
Packit Service 6f2e62
alias eth1 tg3
Packit Service 6f2e62
alias eth2 e1000
Packit Service 6f2e62
alias eth3 e1000
Packit Service 6f2e62
Packit Service 6f2e62
	If neither eth0 and eth1 are slaves to bond0, then when the
Packit Service 6f2e62
bond0 interface comes up, the devices may end up reordered.  This
Packit Service 6f2e62
happens because bonding is loaded first, then its slave device's
Packit Service 6f2e62
drivers are loaded next.  Since no other drivers have been loaded,
Packit Service 6f2e62
when the e1000 driver loads, it will receive eth0 and eth1 for its
Packit Service 6f2e62
devices, but the bonding configuration tries to enslave eth2 and eth3
Packit Service 6f2e62
(which may later be assigned to the tg3 devices).
Packit Service 6f2e62
Packit Service 6f2e62
	Adding the following:
Packit Service 6f2e62
Packit Service 6f2e62
add above bonding e1000 tg3
Packit Service 6f2e62
Packit Service 6f2e62
	causes modprobe to load e1000 then tg3, in that order, when
Packit Service 6f2e62
bonding is loaded.  This command is fully documented in the
Packit Service 6f2e62
modules.conf manual page.
Packit Service 6f2e62
Packit Service 6f2e62
	On systems utilizing modprobe an equivalent problem can occur.
Packit Service 6f2e62
In this case, the following can be added to config files in
Packit Service 6f2e62
/etc/modprobe.d/ as:
Packit Service 6f2e62
Packit Service 6f2e62
softdep bonding pre: tg3 e1000
Packit Service 6f2e62
Packit Service 6f2e62
	This will load tg3 and e1000 modules before loading the bonding one.
Packit Service 6f2e62
Full documentation on this can be found in the modprobe.d and modprobe
Packit Service 6f2e62
manual pages.
Packit Service 6f2e62
Packit Service 6f2e62
8.3. Painfully Slow Or No Failed Link Detection By Miimon
Packit Service 6f2e62
---------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	By default, bonding enables the use_carrier option, which
Packit Service 6f2e62
instructs bonding to trust the driver to maintain carrier state.
Packit Service 6f2e62
Packit Service 6f2e62
	As discussed in the options section, above, some drivers do
Packit Service 6f2e62
not support the netif_carrier_on/_off link state tracking system.
Packit Service 6f2e62
With use_carrier enabled, bonding will always see these links as up,
Packit Service 6f2e62
regardless of their actual state.
Packit Service 6f2e62
Packit Service 6f2e62
	Additionally, other drivers do support netif_carrier, but do
Packit Service 6f2e62
not maintain it in real time, e.g., only polling the link state at
Packit Service 6f2e62
some fixed interval.  In this case, miimon will detect failures, but
Packit Service 6f2e62
only after some long period of time has expired.  If it appears that
Packit Service 6f2e62
miimon is very slow in detecting link failures, try specifying
Packit Service 6f2e62
use_carrier=0 to see if that improves the failure detection time.  If
Packit Service 6f2e62
it does, then it may be that the driver checks the carrier state at a
Packit Service 6f2e62
fixed interval, but does not cache the MII register values (so the
Packit Service 6f2e62
use_carrier=0 method of querying the registers directly works).  If
Packit Service 6f2e62
use_carrier=0 does not improve the failover, then the driver may cache
Packit Service 6f2e62
the registers, or the problem may be elsewhere.
Packit Service 6f2e62
Packit Service 6f2e62
	Also, remember that miimon only checks for the device's
Packit Service 6f2e62
carrier state.  It has no way to determine the state of devices on or
Packit Service 6f2e62
beyond other ports of a switch, or if a switch is refusing to pass
Packit Service 6f2e62
traffic while still maintaining carrier on.
Packit Service 6f2e62
Packit Service 6f2e62
9. SNMP agents
Packit Service 6f2e62
===============
Packit Service 6f2e62
Packit Service 6f2e62
	If running SNMP agents, the bonding driver should be loaded
Packit Service 6f2e62
before any network drivers participating in a bond.  This requirement
Packit Service 6f2e62
is due to the interface index (ipAdEntIfIndex) being associated to
Packit Service 6f2e62
the first interface found with a given IP address.  That is, there is
Packit Service 6f2e62
only one ipAdEntIfIndex for each IP address.  For example, if eth0 and
Packit Service 6f2e62
eth1 are slaves of bond0 and the driver for eth0 is loaded before the
Packit Service 6f2e62
bonding driver, the interface for the IP address will be associated
Packit Service 6f2e62
with the eth0 interface.  This configuration is shown below, the IP
Packit Service 6f2e62
address 192.168.1.1 has an interface index of 2 which indexes to eth0
Packit Service 6f2e62
in the ifDescr table (ifDescr.2).
Packit Service 6f2e62
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.1 = lo
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.2 = eth0
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.3 = eth1
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.4 = eth2
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.5 = eth3
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.6 = bond0
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
Packit Service 6f2e62
Packit Service 6f2e62
	This problem is avoided by loading the bonding driver before
Packit Service 6f2e62
any network drivers participating in a bond.  Below is an example of
Packit Service 6f2e62
loading the bonding driver first, the IP address 192.168.1.1 is
Packit Service 6f2e62
correctly associated with ifDescr.2.
Packit Service 6f2e62
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.1 = lo
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.2 = bond0
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.3 = eth0
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.4 = eth1
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.5 = eth2
Packit Service 6f2e62
     interfaces.ifTable.ifEntry.ifDescr.6 = eth3
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
Packit Service 6f2e62
     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
Packit Service 6f2e62
Packit Service 6f2e62
	While some distributions may not report the interface name in
Packit Service 6f2e62
ifDescr, the association between the IP address and IfIndex remains
Packit Service 6f2e62
and SNMP functions such as Interface_Scan_Next will report that
Packit Service 6f2e62
association.
Packit Service 6f2e62
Packit Service 6f2e62
10. Promiscuous mode
Packit Service 6f2e62
====================
Packit Service 6f2e62
Packit Service 6f2e62
	When running network monitoring tools, e.g., tcpdump, it is
Packit Service 6f2e62
common to enable promiscuous mode on the device, so that all traffic
Packit Service 6f2e62
is seen (instead of seeing only traffic destined for the local host).
Packit Service 6f2e62
The bonding driver handles promiscuous mode changes to the bonding
Packit Service 6f2e62
master device (e.g., bond0), and propagates the setting to the slave
Packit Service 6f2e62
devices.
Packit Service 6f2e62
Packit Service 6f2e62
	For the balance-rr, balance-xor, broadcast, and 802.3ad modes,
Packit Service 6f2e62
the promiscuous mode setting is propagated to all slaves.
Packit Service 6f2e62
Packit Service 6f2e62
	For the active-backup, balance-tlb and balance-alb modes, the
Packit Service 6f2e62
promiscuous mode setting is propagated only to the active slave.
Packit Service 6f2e62
Packit Service 6f2e62
	For balance-tlb mode, the active slave is the slave currently
Packit Service 6f2e62
receiving inbound traffic.
Packit Service 6f2e62
Packit Service 6f2e62
	For balance-alb mode, the active slave is the slave used as a
Packit Service 6f2e62
"primary."  This slave is used for mode-specific control traffic, for
Packit Service 6f2e62
sending to peers that are unassigned or if the load is unbalanced.
Packit Service 6f2e62
Packit Service 6f2e62
	For the active-backup, balance-tlb and balance-alb modes, when
Packit Service 6f2e62
the active slave changes (e.g., due to a link failure), the
Packit Service 6f2e62
promiscuous setting will be propagated to the new active slave.
Packit Service 6f2e62
Packit Service 6f2e62
11. Configuring Bonding for High Availability
Packit Service 6f2e62
=============================================
Packit Service 6f2e62
Packit Service 6f2e62
	High Availability refers to configurations that provide
Packit Service 6f2e62
maximum network availability by having redundant or backup devices,
Packit Service 6f2e62
links or switches between the host and the rest of the world.  The
Packit Service 6f2e62
goal is to provide the maximum availability of network connectivity
Packit Service 6f2e62
(i.e., the network always works), even though other configurations
Packit Service 6f2e62
could provide higher throughput.
Packit Service 6f2e62
Packit Service 6f2e62
11.1 High Availability in a Single Switch Topology
Packit Service 6f2e62
--------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	If two hosts (or a host and a single switch) are directly
Packit Service 6f2e62
connected via multiple physical links, then there is no availability
Packit Service 6f2e62
penalty to optimizing for maximum bandwidth.  In this case, there is
Packit Service 6f2e62
only one switch (or peer), so if it fails, there is no alternative
Packit Service 6f2e62
access to fail over to.  Additionally, the bonding load balance modes
Packit Service 6f2e62
support link monitoring of their members, so if individual links fail,
Packit Service 6f2e62
the load will be rebalanced across the remaining devices.
Packit Service 6f2e62
Packit Service 6f2e62
	See Section 12, "Configuring Bonding for Maximum Throughput"
Packit Service 6f2e62
for information on configuring bonding with one peer device.
Packit Service 6f2e62
Packit Service 6f2e62
11.2 High Availability in a Multiple Switch Topology
Packit Service 6f2e62
----------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	With multiple switches, the configuration of bonding and the
Packit Service 6f2e62
network changes dramatically.  In multiple switch topologies, there is
Packit Service 6f2e62
a trade off between network availability and usable bandwidth.
Packit Service 6f2e62
Packit Service 6f2e62
	Below is a sample network, configured to maximize the
Packit Service 6f2e62
availability of the network:
Packit Service 6f2e62
Packit Service 6f2e62
                |                                     |
Packit Service 6f2e62
                |port3                           port3|
Packit Service 6f2e62
          +-----+----+                          +-----+----+
Packit Service 6f2e62
          |          |port2       ISL      port2|          |
Packit Service 6f2e62
          | switch A +--------------------------+ switch B |
Packit Service 6f2e62
          |          |                          |          |
Packit Service 6f2e62
          +-----+----+                          +-----++---+
Packit Service 6f2e62
                |port1                           port1|
Packit Service 6f2e62
                |             +-------+               |
Packit Service 6f2e62
                +-------------+ host1 +---------------+
Packit Service 6f2e62
                         eth0 +-------+ eth1
Packit Service 6f2e62
Packit Service 6f2e62
	In this configuration, there is a link between the two
Packit Service 6f2e62
switches (ISL, or inter switch link), and multiple ports connecting to
Packit Service 6f2e62
the outside world ("port3" on each switch).  There is no technical
Packit Service 6f2e62
reason that this could not be extended to a third switch.
Packit Service 6f2e62
Packit Service 6f2e62
11.2.1 HA Bonding Mode Selection for Multiple Switch Topology
Packit Service 6f2e62
-------------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	In a topology such as the example above, the active-backup and
Packit Service 6f2e62
broadcast modes are the only useful bonding modes when optimizing for
Packit Service 6f2e62
availability; the other modes require all links to terminate on the
Packit Service 6f2e62
same peer for them to behave rationally.
Packit Service 6f2e62
Packit Service 6f2e62
active-backup: This is generally the preferred mode, particularly if
Packit Service 6f2e62
	the switches have an ISL and play together well.  If the
Packit Service 6f2e62
	network configuration is such that one switch is specifically
Packit Service 6f2e62
	a backup switch (e.g., has lower capacity, higher cost, etc),
Packit Service 6f2e62
	then the primary option can be used to insure that the
Packit Service 6f2e62
	preferred link is always used when it is available.
Packit Service 6f2e62
Packit Service 6f2e62
broadcast: This mode is really a special purpose mode, and is suitable
Packit Service 6f2e62
	only for very specific needs.  For example, if the two
Packit Service 6f2e62
	switches are not connected (no ISL), and the networks beyond
Packit Service 6f2e62
	them are totally independent.  In this case, if it is
Packit Service 6f2e62
	necessary for some specific one-way traffic to reach both
Packit Service 6f2e62
	independent networks, then the broadcast mode may be suitable.
Packit Service 6f2e62
Packit Service 6f2e62
11.2.2 HA Link Monitoring Selection for Multiple Switch Topology
Packit Service 6f2e62
----------------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The choice of link monitoring ultimately depends upon your
Packit Service 6f2e62
switch.  If the switch can reliably fail ports in response to other
Packit Service 6f2e62
failures, then either the MII or ARP monitors should work.  For
Packit Service 6f2e62
example, in the above example, if the "port3" link fails at the remote
Packit Service 6f2e62
end, the MII monitor has no direct means to detect this.  The ARP
Packit Service 6f2e62
monitor could be configured with a target at the remote end of port3,
Packit Service 6f2e62
thus detecting that failure without switch support.
Packit Service 6f2e62
Packit Service 6f2e62
	In general, however, in a multiple switch topology, the ARP
Packit Service 6f2e62
monitor can provide a higher level of reliability in detecting end to
Packit Service 6f2e62
end connectivity failures (which may be caused by the failure of any
Packit Service 6f2e62
individual component to pass traffic for any reason).  Additionally,
Packit Service 6f2e62
the ARP monitor should be configured with multiple targets (at least
Packit Service 6f2e62
one for each switch in the network).  This will insure that,
Packit Service 6f2e62
regardless of which switch is active, the ARP monitor has a suitable
Packit Service 6f2e62
target to query.
Packit Service 6f2e62
Packit Service 6f2e62
	Note, also, that of late many switches now support a functionality
Packit Service 6f2e62
generally referred to as "trunk failover."  This is a feature of the
Packit Service 6f2e62
switch that causes the link state of a particular switch port to be set
Packit Service 6f2e62
down (or up) when the state of another switch port goes down (or up).
Packit Service 6f2e62
Its purpose is to propagate link failures from logically "exterior" ports
Packit Service 6f2e62
to the logically "interior" ports that bonding is able to monitor via
Packit Service 6f2e62
miimon.  Availability and configuration for trunk failover varies by
Packit Service 6f2e62
switch, but this can be a viable alternative to the ARP monitor when using
Packit Service 6f2e62
suitable switches.
Packit Service 6f2e62
Packit Service 6f2e62
12. Configuring Bonding for Maximum Throughput
Packit Service 6f2e62
==============================================
Packit Service 6f2e62
Packit Service 6f2e62
12.1 Maximizing Throughput in a Single Switch Topology
Packit Service 6f2e62
------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	In a single switch configuration, the best method to maximize
Packit Service 6f2e62
throughput depends upon the application and network environment.  The
Packit Service 6f2e62
various load balancing modes each have strengths and weaknesses in
Packit Service 6f2e62
different environments, as detailed below.
Packit Service 6f2e62
Packit Service 6f2e62
	For this discussion, we will break down the topologies into
Packit Service 6f2e62
two categories.  Depending upon the destination of most traffic, we
Packit Service 6f2e62
categorize them into either "gatewayed" or "local" configurations.
Packit Service 6f2e62
Packit Service 6f2e62
	In a gatewayed configuration, the "switch" is acting primarily
Packit Service 6f2e62
as a router, and the majority of traffic passes through this router to
Packit Service 6f2e62
other networks.  An example would be the following:
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
     +----------+                     +----------+
Packit Service 6f2e62
     |          |eth0            port1|          | to other networks
Packit Service 6f2e62
     | Host A   +---------------------+ router   +------------------->
Packit Service 6f2e62
     |          +---------------------+          | Hosts B and C are out
Packit Service 6f2e62
     |          |eth1            port2|          | here somewhere
Packit Service 6f2e62
     +----------+                     +----------+
Packit Service 6f2e62
Packit Service 6f2e62
	The router may be a dedicated router device, or another host
Packit Service 6f2e62
acting as a gateway.  For our discussion, the important point is that
Packit Service 6f2e62
the majority of traffic from Host A will pass through the router to
Packit Service 6f2e62
some other network before reaching its final destination.
Packit Service 6f2e62
Packit Service 6f2e62
	In a gatewayed network configuration, although Host A may
Packit Service 6f2e62
communicate with many other systems, all of its traffic will be sent
Packit Service 6f2e62
and received via one other peer on the local network, the router.
Packit Service 6f2e62
Packit Service 6f2e62
	Note that the case of two systems connected directly via
Packit Service 6f2e62
multiple physical links is, for purposes of configuring bonding, the
Packit Service 6f2e62
same as a gatewayed configuration.  In that case, it happens that all
Packit Service 6f2e62
traffic is destined for the "gateway" itself, not some other network
Packit Service 6f2e62
beyond the gateway.
Packit Service 6f2e62
Packit Service 6f2e62
	In a local configuration, the "switch" is acting primarily as
Packit Service 6f2e62
a switch, and the majority of traffic passes through this switch to
Packit Service 6f2e62
reach other stations on the same network.  An example would be the
Packit Service 6f2e62
following:
Packit Service 6f2e62
Packit Service 6f2e62
    +----------+            +----------+       +--------+
Packit Service 6f2e62
    |          |eth0   port1|          +-------+ Host B |
Packit Service 6f2e62
    |  Host A  +------------+  switch  |port3  +--------+
Packit Service 6f2e62
    |          +------------+          |                  +--------+
Packit Service 6f2e62
    |          |eth1   port2|          +------------------+ Host C |
Packit Service 6f2e62
    +----------+            +----------+port4             +--------+
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
	Again, the switch may be a dedicated switch device, or another
Packit Service 6f2e62
host acting as a gateway.  For our discussion, the important point is
Packit Service 6f2e62
that the majority of traffic from Host A is destined for other hosts
Packit Service 6f2e62
on the same local network (Hosts B and C in the above example).
Packit Service 6f2e62
Packit Service 6f2e62
	In summary, in a gatewayed configuration, traffic to and from
Packit Service 6f2e62
the bonded device will be to the same MAC level peer on the network
Packit Service 6f2e62
(the gateway itself, i.e., the router), regardless of its final
Packit Service 6f2e62
destination.  In a local configuration, traffic flows directly to and
Packit Service 6f2e62
from the final destinations, thus, each destination (Host B, Host C)
Packit Service 6f2e62
will be addressed directly by their individual MAC addresses.
Packit Service 6f2e62
Packit Service 6f2e62
	This distinction between a gatewayed and a local network
Packit Service 6f2e62
configuration is important because many of the load balancing modes
Packit Service 6f2e62
available use the MAC addresses of the local network source and
Packit Service 6f2e62
destination to make load balancing decisions.  The behavior of each
Packit Service 6f2e62
mode is described below.
Packit Service 6f2e62
Packit Service 6f2e62
Packit Service 6f2e62
12.1.1 MT Bonding Mode Selection for Single Switch Topology
Packit Service 6f2e62
-----------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	This configuration is the easiest to set up and to understand,
Packit Service 6f2e62
although you will have to decide which bonding mode best suits your
Packit Service 6f2e62
needs.  The trade offs for each mode are detailed below:
Packit Service 6f2e62
Packit Service 6f2e62
balance-rr: This mode is the only mode that will permit a single
Packit Service 6f2e62
	TCP/IP connection to stripe traffic across multiple
Packit Service 6f2e62
	interfaces. It is therefore the only mode that will allow a
Packit Service 6f2e62
	single TCP/IP stream to utilize more than one interface's
Packit Service 6f2e62
	worth of throughput.  This comes at a cost, however: the
Packit Service 6f2e62
	striping generally results in peer systems receiving packets out
Packit Service 6f2e62
	of order, causing TCP/IP's congestion control system to kick
Packit Service 6f2e62
	in, often by retransmitting segments.
Packit Service 6f2e62
Packit Service 6f2e62
	It is possible to adjust TCP/IP's congestion limits by
Packit Service 6f2e62
	altering the net.ipv4.tcp_reordering sysctl parameter.  The
Packit Service 6f2e62
	usual default value is 3, and the maximum useful value is 127.
Packit Service 6f2e62
	For a four interface balance-rr bond, expect that a single
Packit Service 6f2e62
	TCP/IP stream will utilize no more than approximately 2.3
Packit Service 6f2e62
	interface's worth of throughput, even after adjusting
Packit Service 6f2e62
	tcp_reordering.
Packit Service 6f2e62
Packit Service 6f2e62
	Note that the fraction of packets that will be delivered out of
Packit Service 6f2e62
	order is highly variable, and is unlikely to be zero.  The level
Packit Service 6f2e62
	of reordering depends upon a variety of factors, including the
Packit Service 6f2e62
	networking interfaces, the switch, and the topology of the
Packit Service 6f2e62
	configuration.  Speaking in general terms, higher speed network
Packit Service 6f2e62
	cards produce more reordering (due to factors such as packet
Packit Service 6f2e62
	coalescing), and a "many to many" topology will reorder at a
Packit Service 6f2e62
	higher rate than a "many slow to one fast" configuration.
Packit Service 6f2e62
Packit Service 6f2e62
	Many switches do not support any modes that stripe traffic
Packit Service 6f2e62
	(instead choosing a port based upon IP or MAC level addresses);
Packit Service 6f2e62
	for those devices, traffic for a particular connection flowing
Packit Service 6f2e62
	through the switch to a balance-rr bond will not utilize greater
Packit Service 6f2e62
	than one interface's worth of bandwidth.
Packit Service 6f2e62
Packit Service 6f2e62
	If you are utilizing protocols other than TCP/IP, UDP for
Packit Service 6f2e62
	example, and your application can tolerate out of order
Packit Service 6f2e62
	delivery, then this mode can allow for single stream datagram
Packit Service 6f2e62
	performance that scales near linearly as interfaces are added
Packit Service 6f2e62
	to the bond.
Packit Service 6f2e62
Packit Service 6f2e62
	This mode requires the switch to have the appropriate ports
Packit Service 6f2e62
	configured for "etherchannel" or "trunking."
Packit Service 6f2e62
Packit Service 6f2e62
active-backup: There is not much advantage in this network topology to
Packit Service 6f2e62
	the active-backup mode, as the inactive backup devices are all
Packit Service 6f2e62
	connected to the same peer as the primary.  In this case, a
Packit Service 6f2e62
	load balancing mode (with link monitoring) will provide the
Packit Service 6f2e62
	same level of network availability, but with increased
Packit Service 6f2e62
	available bandwidth.  On the plus side, active-backup mode
Packit Service 6f2e62
	does not require any configuration of the switch, so it may
Packit Service 6f2e62
	have value if the hardware available does not support any of
Packit Service 6f2e62
	the load balance modes.
Packit Service 6f2e62
Packit Service 6f2e62
balance-xor: This mode will limit traffic such that packets destined
Packit Service 6f2e62
	for specific peers will always be sent over the same
Packit Service 6f2e62
	interface.  Since the destination is determined by the MAC
Packit Service 6f2e62
	addresses involved, this mode works best in a "local" network
Packit Service 6f2e62
	configuration (as described above), with destinations all on
Packit Service 6f2e62
	the same local network.  This mode is likely to be suboptimal
Packit Service 6f2e62
	if all your traffic is passed through a single router (i.e., a
Packit Service 6f2e62
	"gatewayed" network configuration, as described above).
Packit Service 6f2e62
Packit Service 6f2e62
	As with balance-rr, the switch ports need to be configured for
Packit Service 6f2e62
	"etherchannel" or "trunking."
Packit Service 6f2e62
Packit Service 6f2e62
broadcast: Like active-backup, there is not much advantage to this
Packit Service 6f2e62
	mode in this type of network topology.
Packit Service 6f2e62
Packit Service 6f2e62
802.3ad: This mode can be a good choice for this type of network
Packit Service 6f2e62
	topology.  The 802.3ad mode is an IEEE standard, so all peers
Packit Service 6f2e62
	that implement 802.3ad should interoperate well.  The 802.3ad
Packit Service 6f2e62
	protocol includes automatic configuration of the aggregates,
Packit Service 6f2e62
	so minimal manual configuration of the switch is needed
Packit Service 6f2e62
	(typically only to designate that some set of devices is
Packit Service 6f2e62
	available for 802.3ad).  The 802.3ad standard also mandates
Packit Service 6f2e62
	that frames be delivered in order (within certain limits), so
Packit Service 6f2e62
	in general single connections will not see misordering of
Packit Service 6f2e62
	packets.  The 802.3ad mode does have some drawbacks: the
Packit Service 6f2e62
	standard mandates that all devices in the aggregate operate at
Packit Service 6f2e62
	the same speed and duplex.  Also, as with all bonding load
Packit Service 6f2e62
	balance modes other than balance-rr, no single connection will
Packit Service 6f2e62
	be able to utilize more than a single interface's worth of
Packit Service 6f2e62
	bandwidth.  
Packit Service 6f2e62
Packit Service 6f2e62
	Additionally, the linux bonding 802.3ad implementation
Packit Service 6f2e62
	distributes traffic by peer (using an XOR of MAC addresses),
Packit Service 6f2e62
	so in a "gatewayed" configuration, all outgoing traffic will
Packit Service 6f2e62
	generally use the same device.  Incoming traffic may also end
Packit Service 6f2e62
	up on a single device, but that is dependent upon the
Packit Service 6f2e62
	balancing policy of the peer's 8023.ad implementation.  In a
Packit Service 6f2e62
	"local" configuration, traffic will be distributed across the
Packit Service 6f2e62
	devices in the bond.
Packit Service 6f2e62
Packit Service 6f2e62
	Finally, the 802.3ad mode mandates the use of the MII monitor,
Packit Service 6f2e62
	therefore, the ARP monitor is not available in this mode.
Packit Service 6f2e62
Packit Service 6f2e62
balance-tlb: The balance-tlb mode balances outgoing traffic by peer.
Packit Service 6f2e62
	Since the balancing is done according to MAC address, in a
Packit Service 6f2e62
	"gatewayed" configuration (as described above), this mode will
Packit Service 6f2e62
	send all traffic across a single device.  However, in a
Packit Service 6f2e62
	"local" network configuration, this mode balances multiple
Packit Service 6f2e62
	local network peers across devices in a vaguely intelligent
Packit Service 6f2e62
	manner (not a simple XOR as in balance-xor or 802.3ad mode),
Packit Service 6f2e62
	so that mathematically unlucky MAC addresses (i.e., ones that
Packit Service 6f2e62
	XOR to the same value) will not all "bunch up" on a single
Packit Service 6f2e62
	interface.
Packit Service 6f2e62
Packit Service 6f2e62
	Unlike 802.3ad, interfaces may be of differing speeds, and no
Packit Service 6f2e62
	special switch configuration is required.  On the down side,
Packit Service 6f2e62
	in this mode all incoming traffic arrives over a single
Packit Service 6f2e62
	interface, this mode requires certain ethtool support in the
Packit Service 6f2e62
	network device driver of the slave interfaces, and the ARP
Packit Service 6f2e62
	monitor is not available.
Packit Service 6f2e62
Packit Service 6f2e62
balance-alb: This mode is everything that balance-tlb is, and more.
Packit Service 6f2e62
	It has all of the features (and restrictions) of balance-tlb,
Packit Service 6f2e62
	and will also balance incoming traffic from local network
Packit Service 6f2e62
	peers (as described in the Bonding Module Options section,
Packit Service 6f2e62
	above).
Packit Service 6f2e62
Packit Service 6f2e62
	The only additional down side to this mode is that the network
Packit Service 6f2e62
	device driver must support changing the hardware address while
Packit Service 6f2e62
	the device is open.
Packit Service 6f2e62
Packit Service 6f2e62
12.1.2 MT Link Monitoring for Single Switch Topology
Packit Service 6f2e62
----------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The choice of link monitoring may largely depend upon which
Packit Service 6f2e62
mode you choose to use.  The more advanced load balancing modes do not
Packit Service 6f2e62
support the use of the ARP monitor, and are thus restricted to using
Packit Service 6f2e62
the MII monitor (which does not provide as high a level of end to end
Packit Service 6f2e62
assurance as the ARP monitor).
Packit Service 6f2e62
Packit Service 6f2e62
12.2 Maximum Throughput in a Multiple Switch Topology
Packit Service 6f2e62
-----------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Multiple switches may be utilized to optimize for throughput
Packit Service 6f2e62
when they are configured in parallel as part of an isolated network
Packit Service 6f2e62
between two or more systems, for example:
Packit Service 6f2e62
Packit Service 6f2e62
                       +-----------+
Packit Service 6f2e62
                       |  Host A   | 
Packit Service 6f2e62
                       +-+---+---+-+
Packit Service 6f2e62
                         |   |   |
Packit Service 6f2e62
                +--------+   |   +---------+
Packit Service 6f2e62
                |            |             |
Packit Service 6f2e62
         +------+---+  +-----+----+  +-----+----+
Packit Service 6f2e62
         | Switch A |  | Switch B |  | Switch C |
Packit Service 6f2e62
         +------+---+  +-----+----+  +-----+----+
Packit Service 6f2e62
                |            |             |
Packit Service 6f2e62
                +--------+   |   +---------+
Packit Service 6f2e62
                         |   |   |
Packit Service 6f2e62
                       +-+---+---+-+
Packit Service 6f2e62
                       |  Host B   | 
Packit Service 6f2e62
                       +-----------+
Packit Service 6f2e62
Packit Service 6f2e62
	In this configuration, the switches are isolated from one
Packit Service 6f2e62
another.  One reason to employ a topology such as this is for an
Packit Service 6f2e62
isolated network with many hosts (a cluster configured for high
Packit Service 6f2e62
performance, for example), using multiple smaller switches can be more
Packit Service 6f2e62
cost effective than a single larger switch, e.g., on a network with 24
Packit Service 6f2e62
hosts, three 24 port switches can be significantly less expensive than
Packit Service 6f2e62
a single 72 port switch.
Packit Service 6f2e62
Packit Service 6f2e62
	If access beyond the network is required, an individual host
Packit Service 6f2e62
can be equipped with an additional network device connected to an
Packit Service 6f2e62
external network; this host then additionally acts as a gateway.
Packit Service 6f2e62
Packit Service 6f2e62
12.2.1 MT Bonding Mode Selection for Multiple Switch Topology
Packit Service 6f2e62
-------------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	In actual practice, the bonding mode typically employed in
Packit Service 6f2e62
configurations of this type is balance-rr.  Historically, in this
Packit Service 6f2e62
network configuration, the usual caveats about out of order packet
Packit Service 6f2e62
delivery are mitigated by the use of network adapters that do not do
Packit Service 6f2e62
any kind of packet coalescing (via the use of NAPI, or because the
Packit Service 6f2e62
device itself does not generate interrupts until some number of
Packit Service 6f2e62
packets has arrived).  When employed in this fashion, the balance-rr
Packit Service 6f2e62
mode allows individual connections between two hosts to effectively
Packit Service 6f2e62
utilize greater than one interface's bandwidth.
Packit Service 6f2e62
Packit Service 6f2e62
12.2.2 MT Link Monitoring for Multiple Switch Topology
Packit Service 6f2e62
------------------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Again, in actual practice, the MII monitor is most often used
Packit Service 6f2e62
in this configuration, as performance is given preference over
Packit Service 6f2e62
availability.  The ARP monitor will function in this topology, but its
Packit Service 6f2e62
advantages over the MII monitor are mitigated by the volume of probes
Packit Service 6f2e62
needed as the number of systems involved grows (remember that each
Packit Service 6f2e62
host in the network is configured with bonding).
Packit Service 6f2e62
Packit Service 6f2e62
13. Switch Behavior Issues
Packit Service 6f2e62
==========================
Packit Service 6f2e62
Packit Service 6f2e62
13.1 Link Establishment and Failover Delays
Packit Service 6f2e62
-------------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Some switches exhibit undesirable behavior with regard to the
Packit Service 6f2e62
timing of link up and down reporting by the switch.
Packit Service 6f2e62
Packit Service 6f2e62
	First, when a link comes up, some switches may indicate that
Packit Service 6f2e62
the link is up (carrier available), but not pass traffic over the
Packit Service 6f2e62
interface for some period of time.  This delay is typically due to
Packit Service 6f2e62
some type of autonegotiation or routing protocol, but may also occur
Packit Service 6f2e62
during switch initialization (e.g., during recovery after a switch
Packit Service 6f2e62
failure).  If you find this to be a problem, specify an appropriate
Packit Service 6f2e62
value to the updelay bonding module option to delay the use of the
Packit Service 6f2e62
relevant interface(s).
Packit Service 6f2e62
Packit Service 6f2e62
	Second, some switches may "bounce" the link state one or more
Packit Service 6f2e62
times while a link is changing state.  This occurs most commonly while
Packit Service 6f2e62
the switch is initializing.  Again, an appropriate updelay value may
Packit Service 6f2e62
help.
Packit Service 6f2e62
Packit Service 6f2e62
	Note that when a bonding interface has no active links, the
Packit Service 6f2e62
driver will immediately reuse the first link that goes up, even if the
Packit Service 6f2e62
updelay parameter has been specified (the updelay is ignored in this
Packit Service 6f2e62
case).  If there are slave interfaces waiting for the updelay timeout
Packit Service 6f2e62
to expire, the interface that first went into that state will be
Packit Service 6f2e62
immediately reused.  This reduces down time of the network if the
Packit Service 6f2e62
value of updelay has been overestimated, and since this occurs only in
Packit Service 6f2e62
cases with no connectivity, there is no additional penalty for
Packit Service 6f2e62
ignoring the updelay.
Packit Service 6f2e62
Packit Service 6f2e62
	In addition to the concerns about switch timings, if your
Packit Service 6f2e62
switches take a long time to go into backup mode, it may be desirable
Packit Service 6f2e62
to not activate a backup interface immediately after a link goes down.
Packit Service 6f2e62
Failover may be delayed via the downdelay bonding module option.
Packit Service 6f2e62
Packit Service 6f2e62
13.2 Duplicated Incoming Packets
Packit Service 6f2e62
--------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	NOTE: Starting with version 3.0.2, the bonding driver has logic to
Packit Service 6f2e62
suppress duplicate packets, which should largely eliminate this problem.
Packit Service 6f2e62
The following description is kept for reference.
Packit Service 6f2e62
Packit Service 6f2e62
	It is not uncommon to observe a short burst of duplicated
Packit Service 6f2e62
traffic when the bonding device is first used, or after it has been
Packit Service 6f2e62
idle for some period of time.  This is most easily observed by issuing
Packit Service 6f2e62
a "ping" to some other host on the network, and noticing that the
Packit Service 6f2e62
output from ping flags duplicates (typically one per slave).
Packit Service 6f2e62
Packit Service 6f2e62
	For example, on a bond in active-backup mode with five slaves
Packit Service 6f2e62
all connected to one switch, the output may appear as follows:
Packit Service 6f2e62
Packit Service 6f2e62
# ping -n 10.0.4.2
Packit Service 6f2e62
PING 10.0.4.2 (10.0.4.2) from 10.0.3.10 : 56(84) bytes of data.
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.7 ms
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=2 ttl=64 time=0.216 ms
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=3 ttl=64 time=0.267 ms
Packit Service 6f2e62
64 bytes from 10.0.4.2: icmp_seq=4 ttl=64 time=0.222 ms
Packit Service 6f2e62
Packit Service 6f2e62
	This is not due to an error in the bonding driver, rather, it
Packit Service 6f2e62
is a side effect of how many switches update their MAC forwarding
Packit Service 6f2e62
tables.  Initially, the switch does not associate the MAC address in
Packit Service 6f2e62
the packet with a particular switch port, and so it may send the
Packit Service 6f2e62
traffic to all ports until its MAC forwarding table is updated.  Since
Packit Service 6f2e62
the interfaces attached to the bond may occupy multiple ports on a
Packit Service 6f2e62
single switch, when the switch (temporarily) floods the traffic to all
Packit Service 6f2e62
ports, the bond device receives multiple copies of the same packet
Packit Service 6f2e62
(one per slave device).
Packit Service 6f2e62
Packit Service 6f2e62
	The duplicated packet behavior is switch dependent, some
Packit Service 6f2e62
switches exhibit this, and some do not.  On switches that display this
Packit Service 6f2e62
behavior, it can be induced by clearing the MAC forwarding table (on
Packit Service 6f2e62
most Cisco switches, the privileged command "clear mac address-table
Packit Service 6f2e62
dynamic" will accomplish this).
Packit Service 6f2e62
Packit Service 6f2e62
14. Hardware Specific Considerations
Packit Service 6f2e62
====================================
Packit Service 6f2e62
Packit Service 6f2e62
	This section contains additional information for configuring
Packit Service 6f2e62
bonding on specific hardware platforms, or for interfacing bonding
Packit Service 6f2e62
with particular switches or other devices.
Packit Service 6f2e62
Packit Service 6f2e62
14.1 IBM BladeCenter
Packit Service 6f2e62
--------------------
Packit Service 6f2e62
Packit Service 6f2e62
	This applies to the JS20 and similar systems.
Packit Service 6f2e62
Packit Service 6f2e62
	On the JS20 blades, the bonding driver supports only
Packit Service 6f2e62
balance-rr, active-backup, balance-tlb and balance-alb modes.  This is
Packit Service 6f2e62
largely due to the network topology inside the BladeCenter, detailed
Packit Service 6f2e62
below.
Packit Service 6f2e62
Packit Service 6f2e62
JS20 network adapter information
Packit Service 6f2e62
--------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	All JS20s come with two Broadcom Gigabit Ethernet ports
Packit Service 6f2e62
integrated on the planar (that's "motherboard" in IBM-speak).  In the
Packit Service 6f2e62
BladeCenter chassis, the eth0 port of all JS20 blades is hard wired to
Packit Service 6f2e62
I/O Module #1; similarly, all eth1 ports are wired to I/O Module #2.
Packit Service 6f2e62
An add-on Broadcom daughter card can be installed on a JS20 to provide
Packit Service 6f2e62
two more Gigabit Ethernet ports.  These ports, eth2 and eth3, are
Packit Service 6f2e62
wired to I/O Modules 3 and 4, respectively.
Packit Service 6f2e62
Packit Service 6f2e62
	Each I/O Module may contain either a switch or a passthrough
Packit Service 6f2e62
module (which allows ports to be directly connected to an external
Packit Service 6f2e62
switch).  Some bonding modes require a specific BladeCenter internal
Packit Service 6f2e62
network topology in order to function; these are detailed below.
Packit Service 6f2e62
Packit Service 6f2e62
	Additional BladeCenter-specific networking information can be
Packit Service 6f2e62
found in two IBM Redbooks (www.ibm.com/redbooks):
Packit Service 6f2e62
Packit Service 6f2e62
"IBM eServer BladeCenter Networking Options"
Packit Service 6f2e62
"IBM eServer BladeCenter Layer 2-7 Network Switching"
Packit Service 6f2e62
Packit Service 6f2e62
BladeCenter networking configuration
Packit Service 6f2e62
------------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	Because a BladeCenter can be configured in a very large number
Packit Service 6f2e62
of ways, this discussion will be confined to describing basic
Packit Service 6f2e62
configurations.
Packit Service 6f2e62
Packit Service 6f2e62
	Normally, Ethernet Switch Modules (ESMs) are used in I/O
Packit Service 6f2e62
modules 1 and 2.  In this configuration, the eth0 and eth1 ports of a
Packit Service 6f2e62
JS20 will be connected to different internal switches (in the
Packit Service 6f2e62
respective I/O modules).
Packit Service 6f2e62
Packit Service 6f2e62
	A passthrough module (OPM or CPM, optical or copper,
Packit Service 6f2e62
passthrough module) connects the I/O module directly to an external
Packit Service 6f2e62
switch.  By using PMs in I/O module #1 and #2, the eth0 and eth1
Packit Service 6f2e62
interfaces of a JS20 can be redirected to the outside world and
Packit Service 6f2e62
connected to a common external switch.
Packit Service 6f2e62
Packit Service 6f2e62
	Depending upon the mix of ESMs and PMs, the network will
Packit Service 6f2e62
appear to bonding as either a single switch topology (all PMs) or as a
Packit Service 6f2e62
multiple switch topology (one or more ESMs, zero or more PMs).  It is
Packit Service 6f2e62
also possible to connect ESMs together, resulting in a configuration
Packit Service 6f2e62
much like the example in "High Availability in a Multiple Switch
Packit Service 6f2e62
Topology," above.
Packit Service 6f2e62
Packit Service 6f2e62
Requirements for specific modes
Packit Service 6f2e62
-------------------------------
Packit Service 6f2e62
Packit Service 6f2e62
	The balance-rr mode requires the use of passthrough modules
Packit Service 6f2e62
for devices in the bond, all connected to an common external switch.
Packit Service 6f2e62
That switch must be configured for "etherchannel" or "trunking" on the
Packit Service 6f2e62
appropriate ports, as is usual for balance-rr.
Packit Service 6f2e62
Packit Service 6f2e62
	The balance-alb and balance-tlb modes will function with
Packit Service 6f2e62
either switch modules or passthrough modules (or a mix).  The only
Packit Service 6f2e62
specific requirement for these modes is that all network interfaces
Packit Service 6f2e62
must be able to reach all destinations for traffic sent over the
Packit Service 6f2e62
bonding device (i.e., the network must converge at some point outside
Packit Service 6f2e62
the BladeCenter).
Packit Service 6f2e62
Packit Service 6f2e62
	The active-backup mode has no additional requirements.
Packit Service 6f2e62
Packit Service 6f2e62
Link monitoring issues
Packit Service 6f2e62
----------------------
Packit Service 6f2e62
Packit Service 6f2e62
	When an Ethernet Switch Module is in place, only the ARP
Packit Service 6f2e62
monitor will reliably detect link loss to an external switch.  This is
Packit Service 6f2e62
nothing unusual, but examination of the BladeCenter cabinet would
Packit Service 6f2e62
suggest that the "external" network ports are the ethernet ports for
Packit Service 6f2e62
the system, when it fact there is a switch between these "external"
Packit Service 6f2e62
ports and the devices on the JS20 system itself.  The MII monitor is
Packit Service 6f2e62
only able to detect link failures between the ESM and the JS20 system.
Packit Service 6f2e62
Packit Service 6f2e62
	When a passthrough module is in place, the MII monitor does
Packit Service 6f2e62
detect failures to the "external" port, which is then directly
Packit Service 6f2e62
connected to the JS20 system.
Packit Service 6f2e62
Packit Service 6f2e62
Other concerns
Packit Service 6f2e62
--------------
Packit Service 6f2e62
Packit Service 6f2e62
	The Serial Over LAN (SoL) link is established over the primary
Packit Service 6f2e62
ethernet (eth0) only, therefore, any loss of link to eth0 will result
Packit Service 6f2e62
in losing your SoL connection.  It will not fail over with other
Packit Service 6f2e62
network traffic, as the SoL system is beyond the control of the
Packit Service 6f2e62
bonding driver.
Packit Service 6f2e62
Packit Service 6f2e62
	It may be desirable to disable spanning tree on the switch
Packit Service 6f2e62
(either the internal Ethernet Switch Module, or an external switch) to
Packit Service 6f2e62
avoid fail-over delay issues when using bonding.
Packit Service 6f2e62
Packit Service 6f2e62
	
Packit Service 6f2e62
15. Frequently Asked Questions
Packit Service 6f2e62
==============================
Packit Service 6f2e62
Packit Service 6f2e62
1.  Is it SMP safe?
Packit Service 6f2e62
Packit Service 6f2e62
	Yes. The old 2.0.xx channel bonding patch was not SMP safe.
Packit Service 6f2e62
The new driver was designed to be SMP safe from the start.
Packit Service 6f2e62
Packit Service 6f2e62
2.  What type of cards will work with it?
Packit Service 6f2e62
Packit Service 6f2e62
	Any Ethernet type cards (you can even mix cards - a Intel
Packit Service 6f2e62
EtherExpress PRO/100 and a 3com 3c905b, for example).  For most modes,
Packit Service 6f2e62
devices need not be of the same speed.
Packit Service 6f2e62
Packit Service 6f2e62
	Starting with version 3.2.1, bonding also supports Infiniband
Packit Service 6f2e62
slaves in active-backup mode.
Packit Service 6f2e62
Packit Service 6f2e62
3.  How many bonding devices can I have?
Packit Service 6f2e62
Packit Service 6f2e62
	There is no limit.
Packit Service 6f2e62
Packit Service 6f2e62
4.  How many slaves can a bonding device have?
Packit Service 6f2e62
Packit Service 6f2e62
	This is limited only by the number of network interfaces Linux
Packit Service 6f2e62
supports and/or the number of network cards you can place in your
Packit Service 6f2e62
system.
Packit Service 6f2e62
Packit Service 6f2e62
5.  What happens when a slave link dies?
Packit Service 6f2e62
Packit Service 6f2e62
	If link monitoring is enabled, then the failing device will be
Packit Service 6f2e62
disabled.  The active-backup mode will fail over to a backup link, and
Packit Service 6f2e62
other modes will ignore the failed link.  The link will continue to be
Packit Service 6f2e62
monitored, and should it recover, it will rejoin the bond (in whatever
Packit Service 6f2e62
manner is appropriate for the mode). See the sections on High
Packit Service 6f2e62
Availability and the documentation for each mode for additional
Packit Service 6f2e62
information.
Packit Service 6f2e62
	
Packit Service 6f2e62
	Link monitoring can be enabled via either the miimon or
Packit Service 6f2e62
arp_interval parameters (described in the module parameters section,
Packit Service 6f2e62
above).  In general, miimon monitors the carrier state as sensed by
Packit Service 6f2e62
the underlying network device, and the arp monitor (arp_interval)
Packit Service 6f2e62
monitors connectivity to another host on the local network.
Packit Service 6f2e62
Packit Service 6f2e62
	If no link monitoring is configured, the bonding driver will
Packit Service 6f2e62
be unable to detect link failures, and will assume that all links are
Packit Service 6f2e62
always available.  This will likely result in lost packets, and a
Packit Service 6f2e62
resulting degradation of performance.  The precise performance loss
Packit Service 6f2e62
depends upon the bonding mode and network configuration.
Packit Service 6f2e62
Packit Service 6f2e62
6.  Can bonding be used for High Availability?
Packit Service 6f2e62
Packit Service 6f2e62
	Yes.  See the section on High Availability for details.
Packit Service 6f2e62
Packit Service 6f2e62
7.  Which switches/systems does it work with?
Packit Service 6f2e62
Packit Service 6f2e62
	The full answer to this depends upon the desired mode.
Packit Service 6f2e62
Packit Service 6f2e62
	In the basic balance modes (balance-rr and balance-xor), it
Packit Service 6f2e62
works with any system that supports etherchannel (also called
Packit Service 6f2e62
trunking).  Most managed switches currently available have such
Packit Service 6f2e62
support, and many unmanaged switches as well.
Packit Service 6f2e62
Packit Service 6f2e62
	The advanced balance modes (balance-tlb and balance-alb) do
Packit Service 6f2e62
not have special switch requirements, but do need device drivers that
Packit Service 6f2e62
support specific features (described in the appropriate section under
Packit Service 6f2e62
module parameters, above).
Packit Service 6f2e62
Packit Service 6f2e62
	In 802.3ad mode, it works with systems that support IEEE
Packit Service 6f2e62
802.3ad Dynamic Link Aggregation.  Most managed and many unmanaged
Packit Service 6f2e62
switches currently available support 802.3ad.
Packit Service 6f2e62
Packit Service 6f2e62
        The active-backup mode should work with any Layer-II switch.
Packit Service 6f2e62
Packit Service 6f2e62
8.  Where does a bonding device get its MAC address from?
Packit Service 6f2e62
Packit Service 6f2e62
	When using slave devices that have fixed MAC addresses, or when
Packit Service 6f2e62
the fail_over_mac option is enabled, the bonding device's MAC address is
Packit Service 6f2e62
the MAC address of the active slave.
Packit Service 6f2e62
Packit Service 6f2e62
	For other configurations, if not explicitly configured (with
Packit Service 6f2e62
ifconfig or ip link), the MAC address of the bonding device is taken from
Packit Service 6f2e62
its first slave device.  This MAC address is then passed to all following
Packit Service 6f2e62
slaves and remains persistent (even if the first slave is removed) until
Packit Service 6f2e62
the bonding device is brought down or reconfigured.
Packit Service 6f2e62
Packit Service 6f2e62
	If you wish to change the MAC address, you can set it with
Packit Service 6f2e62
ifconfig or ip link:
Packit Service 6f2e62
Packit Service 6f2e62
# ifconfig bond0 hw ether 00:11:22:33:44:55
Packit Service 6f2e62
Packit Service 6f2e62
# ip link set bond0 address 66:77:88:99:aa:bb
Packit Service 6f2e62
Packit Service 6f2e62
	The MAC address can be also changed by bringing down/up the
Packit Service 6f2e62
device and then changing its slaves (or their order):
Packit Service 6f2e62
Packit Service 6f2e62
# ifconfig bond0 down ; modprobe -r bonding
Packit Service 6f2e62
# ifconfig bond0 .... up
Packit Service 6f2e62
# ifenslave bond0 eth...
Packit Service 6f2e62
Packit Service 6f2e62
	This method will automatically take the address from the next
Packit Service 6f2e62
slave that is added.
Packit Service 6f2e62
Packit Service 6f2e62
	To restore your slaves' MAC addresses, you need to detach them
Packit Service 6f2e62
from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
Packit Service 6f2e62
then restore the MAC addresses that the slaves had before they were
Packit Service 6f2e62
enslaved.
Packit Service 6f2e62
Packit Service 6f2e62
16. Resources and Links
Packit Service 6f2e62
=======================
Packit Service 6f2e62
Packit Service 6f2e62
	The latest version of the bonding driver can be found in the latest
Packit Service 6f2e62
version of the linux kernel, found on http://kernel.org
Packit Service 6f2e62
Packit Service 6f2e62
	The latest version of this document can be found in the latest kernel
Packit Service 6f2e62
source (named Documentation/networking/bonding.txt).
Packit Service 6f2e62
Packit Service 6f2e62
	Discussions regarding the usage of the bonding driver take place on the
Packit Service 6f2e62
bonding-devel mailing list, hosted at sourceforge.net. If you have questions or
Packit Service 6f2e62
problems, post them to the list.  The list address is:
Packit Service 6f2e62
Packit Service 6f2e62
bonding-devel@lists.sourceforge.net
Packit Service 6f2e62
Packit Service 6f2e62
	The administrative interface (to subscribe or unsubscribe) can
Packit Service 6f2e62
be found at:
Packit Service 6f2e62
Packit Service 6f2e62
https://lists.sourceforge.net/lists/listinfo/bonding-devel
Packit Service 6f2e62
Packit Service 6f2e62
	Discussions regarding the development of the bonding driver take place
Packit Service 6f2e62
on the main Linux network mailing list, hosted at vger.kernel.org. The list
Packit Service 6f2e62
address is:
Packit Service 6f2e62
Packit Service 6f2e62
netdev@vger.kernel.org
Packit Service 6f2e62
Packit Service 6f2e62
	The administrative interface (to subscribe or unsubscribe) can
Packit Service 6f2e62
be found at:
Packit Service 6f2e62
Packit Service 6f2e62
http://vger.kernel.org/vger-lists.html#netdev
Packit Service 6f2e62
Packit Service 6f2e62
Donald Becker's Ethernet Drivers and diag programs may be found at :
Packit Service 6f2e62
 - http://web.archive.org/web/*/http://www.scyld.com/network/ 
Packit Service 6f2e62
Packit Service 6f2e62
You will also find a lot of information regarding Ethernet, NWay, MII,
Packit Service 6f2e62
etc. at www.scyld.com.
Packit Service 6f2e62
Packit Service 6f2e62
-- END --