162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci===================================
462306a36Sopenharmony_ciLinux Ethernet Bonding Driver HOWTO
562306a36Sopenharmony_ci===================================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciLatest update: 27 April 2011
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciInitial release: Thomas Davis <tadavis at lbl.gov>
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ciCorrections, HA extensions: 2000/10/03-15:
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci  - Willy Tarreau <willy at meta-x.org>
1462306a36Sopenharmony_ci  - Constantine Gavrilov <const-g at xpert.com>
1562306a36Sopenharmony_ci  - Chad N. Tindel <ctindel at ieee dot org>
1662306a36Sopenharmony_ci  - Janice Girouard <girouard at us dot ibm dot com>
1762306a36Sopenharmony_ci  - Jay Vosburgh <fubar at us dot ibm dot com>
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciReorganized and updated Feb 2005 by Jay Vosburgh
2062306a36Sopenharmony_ciAdded Sysfs information: 2006/04/24
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci  - Mitch Williams <mitch.a.williams at intel.com>
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ciIntroduction
2562306a36Sopenharmony_ci============
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciThe Linux bonding driver provides a method for aggregating
2862306a36Sopenharmony_cimultiple network interfaces into a single logical "bonded" interface.
2962306a36Sopenharmony_ciThe behavior of the bonded interfaces depends upon the mode; generally
3062306a36Sopenharmony_cispeaking, modes provide either hot standby or load balancing services.
3162306a36Sopenharmony_ciAdditionally, link integrity monitoring may be performed.
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ciThe bonding driver originally came from Donald Becker's
3462306a36Sopenharmony_cibeowulf patches for kernel 2.0. It has changed quite a bit since, and
3562306a36Sopenharmony_cithe original tools from extreme-linux and beowulf sites will not work
3662306a36Sopenharmony_ciwith this version of the driver.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciFor new versions of the driver, updated userspace tools, and
3962306a36Sopenharmony_ciwho to ask for help, please follow the links at the end of this file.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci.. Table of Contents
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci   1. Bonding Driver Installation
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci   2. Bonding Driver Options
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci   3. Configuring Bonding Devices
4862306a36Sopenharmony_ci   3.1	Configuration with Sysconfig Support
4962306a36Sopenharmony_ci   3.1.1		Using DHCP with Sysconfig
5062306a36Sopenharmony_ci   3.1.2		Configuring Multiple Bonds with Sysconfig
5162306a36Sopenharmony_ci   3.2	Configuration with Initscripts Support
5262306a36Sopenharmony_ci   3.2.1		Using DHCP with Initscripts
5362306a36Sopenharmony_ci   3.2.2		Configuring Multiple Bonds with Initscripts
5462306a36Sopenharmony_ci   3.3	Configuring Bonding Manually with Ifenslave
5562306a36Sopenharmony_ci   3.3.1		Configuring Multiple Bonds Manually
5662306a36Sopenharmony_ci   3.4	Configuring Bonding Manually via Sysfs
5762306a36Sopenharmony_ci   3.5	Configuration with Interfaces Support
5862306a36Sopenharmony_ci   3.6	Overriding Configuration for Special Cases
5962306a36Sopenharmony_ci   3.7 Configuring LACP for 802.3ad mode in a more secure way
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci   4. Querying Bonding Configuration
6262306a36Sopenharmony_ci   4.1	Bonding Configuration
6362306a36Sopenharmony_ci   4.2	Network Configuration
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci   5. Switch Configuration
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci   6. 802.1q VLAN Support
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci   7. Link Monitoring
7062306a36Sopenharmony_ci   7.1	ARP Monitor Operation
7162306a36Sopenharmony_ci   7.2	Configuring Multiple ARP Targets
7262306a36Sopenharmony_ci   7.3	MII Monitor Operation
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci   8. Potential Trouble Sources
7562306a36Sopenharmony_ci   8.1	Adventures in Routing
7662306a36Sopenharmony_ci   8.2	Ethernet Device Renaming
7762306a36Sopenharmony_ci   8.3	Painfully Slow Or No Failed Link Detection By Miimon
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci   9. SNMP agents
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci   10. Promiscuous mode
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci   11. Configuring Bonding for High Availability
8462306a36Sopenharmony_ci   11.1	High Availability in a Single Switch Topology
8562306a36Sopenharmony_ci   11.2	High Availability in a Multiple Switch Topology
8662306a36Sopenharmony_ci   11.2.1		HA Bonding Mode Selection for Multiple Switch Topology
8762306a36Sopenharmony_ci   11.2.2		HA Link Monitoring for Multiple Switch Topology
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci   12. Configuring Bonding for Maximum Throughput
9062306a36Sopenharmony_ci   12.1	Maximum Throughput in a Single Switch Topology
9162306a36Sopenharmony_ci   12.1.1		MT Bonding Mode Selection for Single Switch Topology
9262306a36Sopenharmony_ci   12.1.2		MT Link Monitoring for Single Switch Topology
9362306a36Sopenharmony_ci   12.2	Maximum Throughput in a Multiple Switch Topology
9462306a36Sopenharmony_ci   12.2.1		MT Bonding Mode Selection for Multiple Switch Topology
9562306a36Sopenharmony_ci   12.2.2		MT Link Monitoring for Multiple Switch Topology
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci   13. Switch Behavior Issues
9862306a36Sopenharmony_ci   13.1	Link Establishment and Failover Delays
9962306a36Sopenharmony_ci   13.2	Duplicated Incoming Packets
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci   14. Hardware Specific Considerations
10262306a36Sopenharmony_ci   14.1	IBM BladeCenter
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci   15. Frequently Asked Questions
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci   16. Resources and Links
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci1. Bonding Driver Installation
11062306a36Sopenharmony_ci==============================
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciMost popular distro kernels ship with the bonding driver
11362306a36Sopenharmony_cialready available as a module. If your distro does not, or you
11462306a36Sopenharmony_cihave need to compile bonding from source (e.g., configuring and
11562306a36Sopenharmony_ciinstalling a mainline kernel from kernel.org), you'll need to perform
11662306a36Sopenharmony_cithe following steps:
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci1.1 Configure and build the kernel with bonding
11962306a36Sopenharmony_ci-----------------------------------------------
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciThe current version of the bonding driver is available in the
12262306a36Sopenharmony_cidrivers/net/bonding subdirectory of the most recent kernel source
12362306a36Sopenharmony_ci(which is available on http://kernel.org).  Most users "rolling their
12462306a36Sopenharmony_ciown" will want to use the most recent kernel from kernel.org.
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ciConfigure kernel with "make menuconfig" (or "make xconfig" or
12762306a36Sopenharmony_ci"make config"), then select "Bonding driver support" in the "Network
12862306a36Sopenharmony_cidevice support" section.  It is recommended that you configure the
12962306a36Sopenharmony_cidriver as module since it is currently the only way to pass parameters
13062306a36Sopenharmony_cito the driver or configure more than one bonding device.
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ciBuild and install the new kernel and modules.
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci1.2 Bonding Control Utility
13562306a36Sopenharmony_ci---------------------------
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ciIt is recommended to configure bonding via iproute2 (netlink)
13862306a36Sopenharmony_cior sysfs, the old ifenslave control utility is obsolete.
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci2. Bonding Driver Options
14162306a36Sopenharmony_ci=========================
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciOptions for the bonding driver are supplied as parameters to the
14462306a36Sopenharmony_cibonding module at load time, or are specified via sysfs.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ciModule options may be given as command line arguments to the
14762306a36Sopenharmony_ciinsmod or modprobe command, but are usually specified in either the
14862306a36Sopenharmony_ci``/etc/modprobe.d/*.conf`` configuration files, or in a distro-specific
14962306a36Sopenharmony_ciconfiguration file (some of which are detailed in the next section).
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ciDetails on bonding support for sysfs is provided in the
15262306a36Sopenharmony_ci"Configuring Bonding Manually via Sysfs" section, below.
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ciThe available bonding driver parameters are listed below. If a
15562306a36Sopenharmony_ciparameter is not specified the default value is used.  When initially
15662306a36Sopenharmony_ciconfiguring a bond, it is recommended "tail -f /var/log/messages" be
15762306a36Sopenharmony_cirun in a separate window to watch for bonding driver error messages.
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ciIt is critical that either the miimon or arp_interval and
16062306a36Sopenharmony_ciarp_ip_target parameters be specified, otherwise serious network
16162306a36Sopenharmony_cidegradation will occur during link failures.  Very few devices do not
16262306a36Sopenharmony_cisupport at least miimon, so there is really no reason not to use it.
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ciOptions with textual values will accept either the text name
16562306a36Sopenharmony_cior, for backwards compatibility, the option value.  E.g.,
16662306a36Sopenharmony_ci"mode=802.3ad" and "mode=4" set the same mode.
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ciThe parameters are as follows:
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ciactive_slave
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci	Specifies the new active slave for modes that support it
17362306a36Sopenharmony_ci	(active-backup, balance-alb and balance-tlb).  Possible values
17462306a36Sopenharmony_ci	are the name of any currently enslaved interface, or an empty
17562306a36Sopenharmony_ci	string.  If a name is given, the slave and its link must be up in order
17662306a36Sopenharmony_ci	to be selected as the new active slave.  If an empty string is
17762306a36Sopenharmony_ci	specified, the current active slave is cleared, and a new active
17862306a36Sopenharmony_ci	slave is selected automatically.
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	Note that this is only available through the sysfs interface. No module
18162306a36Sopenharmony_ci	parameter by this name exists.
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci	The normal value of this option is the name of the currently
18462306a36Sopenharmony_ci	active slave, or the empty string if there is no active slave or
18562306a36Sopenharmony_ci	the current mode does not use an active slave.
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ciad_actor_sys_prio
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci	In an AD system, this specifies the system priority. The allowed range
19062306a36Sopenharmony_ci	is 1 - 65535. If the value is not specified, it takes 65535 as the
19162306a36Sopenharmony_ci	default value.
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci	This parameter has effect only in 802.3ad mode and is available through
19462306a36Sopenharmony_ci	SysFs interface.
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ciad_actor_system
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci	In an AD system, this specifies the mac-address for the actor in
19962306a36Sopenharmony_ci	protocol packet exchanges (LACPDUs). The value cannot be a multicast
20062306a36Sopenharmony_ci	address. If the all-zeroes MAC is specified, bonding will internally
20162306a36Sopenharmony_ci	use the MAC of the bond itself. It is preferred to have the
20262306a36Sopenharmony_ci	local-admin bit set for this mac but driver does not enforce it. If
20362306a36Sopenharmony_ci	the value is not given then system defaults to using the masters'
20462306a36Sopenharmony_ci	mac address as actors' system address.
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci	This parameter has effect only in 802.3ad mode and is available through
20762306a36Sopenharmony_ci	SysFs interface.
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ciad_select
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci	Specifies the 802.3ad aggregation selection logic to use.  The
21262306a36Sopenharmony_ci	possible values and their effects are:
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	stable or 0
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci		The active aggregator is chosen by largest aggregate
21762306a36Sopenharmony_ci		bandwidth.
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci		Reselection of the active aggregator occurs only when all
22062306a36Sopenharmony_ci		slaves of the active aggregator are down or the active
22162306a36Sopenharmony_ci		aggregator has no slaves.
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ci		This is the default value.
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci	bandwidth or 1
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_ci		The active aggregator is chosen by largest aggregate
22862306a36Sopenharmony_ci		bandwidth.  Reselection occurs if:
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci		- A slave is added to or removed from the bond
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci		- Any slave's link state changes
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci		- Any slave's 802.3ad association state changes
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci		- The bond's administrative state changes to up
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_ci	count or 2
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci		The active aggregator is chosen by the largest number of
24162306a36Sopenharmony_ci		ports (slaves).  Reselection occurs as described under the
24262306a36Sopenharmony_ci		"bandwidth" setting, above.
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci	The bandwidth and count selection policies permit failover of
24562306a36Sopenharmony_ci	802.3ad aggregations when partial failure of the active aggregator
24662306a36Sopenharmony_ci	occurs.  This keeps the aggregator with the highest availability
24762306a36Sopenharmony_ci	(either in bandwidth or in number of ports) active at all times.
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci	This option was added in bonding version 3.4.0.
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ciad_user_port_key
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	In an AD system, the port-key has three parts as shown below -
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci	   =====  ============
25662306a36Sopenharmony_ci	   Bits   Use
25762306a36Sopenharmony_ci	   =====  ============
25862306a36Sopenharmony_ci	   00     Duplex
25962306a36Sopenharmony_ci	   01-05  Speed
26062306a36Sopenharmony_ci	   06-15  User-defined
26162306a36Sopenharmony_ci	   =====  ============
26262306a36Sopenharmony_ci
26362306a36Sopenharmony_ci	This defines the upper 10 bits of the port key. The values can be
26462306a36Sopenharmony_ci	from 0 - 1023. If not given, the system defaults to 0.
26562306a36Sopenharmony_ci
26662306a36Sopenharmony_ci	This parameter has effect only in 802.3ad mode and is available through
26762306a36Sopenharmony_ci	SysFs interface.
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ciall_slaves_active
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ci	Specifies that duplicate frames (received on inactive ports) should be
27262306a36Sopenharmony_ci	dropped (0) or delivered (1).
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci	Normally, bonding will drop duplicate frames (received on inactive
27562306a36Sopenharmony_ci	ports), which is desirable for most users. But there are some times
27662306a36Sopenharmony_ci	it is nice to allow duplicate frames to be delivered.
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci	The default value is 0 (drop duplicate frames received on inactive
27962306a36Sopenharmony_ci	ports).
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ciarp_interval
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci	Specifies the ARP link monitoring frequency in milliseconds.
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci	The ARP monitor works by periodically checking the slave
28662306a36Sopenharmony_ci	devices to determine whether they have sent or received
28762306a36Sopenharmony_ci	traffic recently (the precise criteria depends upon the
28862306a36Sopenharmony_ci	bonding mode, and the state of the slave).  Regular traffic is
28962306a36Sopenharmony_ci	generated via ARP probes issued for the addresses specified by
29062306a36Sopenharmony_ci	the arp_ip_target option.
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci	This behavior can be modified by the arp_validate option,
29362306a36Sopenharmony_ci	below.
29462306a36Sopenharmony_ci
29562306a36Sopenharmony_ci	If ARP monitoring is used in an etherchannel compatible mode
29662306a36Sopenharmony_ci	(modes 0 and 2), the switch should be configured in a mode
29762306a36Sopenharmony_ci	that evenly distributes packets across all links. If the
29862306a36Sopenharmony_ci	switch is configured to distribute the packets in an XOR
29962306a36Sopenharmony_ci	fashion, all replies from the ARP targets will be received on
30062306a36Sopenharmony_ci	the same link which could cause the other team members to
30162306a36Sopenharmony_ci	fail.  ARP monitoring should not be used in conjunction with
30262306a36Sopenharmony_ci	miimon.  A value of 0 disables ARP monitoring.  The default
30362306a36Sopenharmony_ci	value is 0.
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ciarp_ip_target
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci	Specifies the IP addresses to use as ARP monitoring peers when
30862306a36Sopenharmony_ci	arp_interval is > 0.  These are the targets of the ARP request
30962306a36Sopenharmony_ci	sent to determine the health of the link to the targets.
31062306a36Sopenharmony_ci	Specify these values in ddd.ddd.ddd.ddd format.  Multiple IP
31162306a36Sopenharmony_ci	addresses must be separated by a comma.  At least one IP
31262306a36Sopenharmony_ci	address must be given for ARP monitoring to function.  The
31362306a36Sopenharmony_ci	maximum number of targets that can be specified is 16.  The
31462306a36Sopenharmony_ci	default value is no IP addresses.
31562306a36Sopenharmony_ci
31662306a36Sopenharmony_cins_ip6_target
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci	Specifies the IPv6 addresses to use as IPv6 monitoring peers when
31962306a36Sopenharmony_ci	arp_interval is > 0.  These are the targets of the NS request
32062306a36Sopenharmony_ci	sent to determine the health of the link to the targets.
32162306a36Sopenharmony_ci	Specify these values in ffff:ffff::ffff:ffff format.  Multiple IPv6
32262306a36Sopenharmony_ci	addresses must be separated by a comma.  At least one IPv6
32362306a36Sopenharmony_ci	address must be given for NS/NA monitoring to function.  The
32462306a36Sopenharmony_ci	maximum number of targets that can be specified is 16.  The
32562306a36Sopenharmony_ci	default value is no IPv6 addresses.
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ciarp_validate
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci	Specifies whether or not ARP probes and replies should be
33062306a36Sopenharmony_ci	validated in any mode that supports arp monitoring, or whether
33162306a36Sopenharmony_ci	non-ARP traffic should be filtered (disregarded) for link
33262306a36Sopenharmony_ci	monitoring purposes.
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci	Possible values are:
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci	none or 0
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ci		No validation or filtering is performed.
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci	active or 1
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci		Validation is performed only for the active slave.
34362306a36Sopenharmony_ci
34462306a36Sopenharmony_ci	backup or 2
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci		Validation is performed only for backup slaves.
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci	all or 3
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci		Validation is performed for all slaves.
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci	filter or 4
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_ci		Filtering is applied to all slaves. No validation is
35562306a36Sopenharmony_ci		performed.
35662306a36Sopenharmony_ci
35762306a36Sopenharmony_ci	filter_active or 5
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci		Filtering is applied to all slaves, validation is performed
36062306a36Sopenharmony_ci		only for the active slave.
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ci	filter_backup or 6
36362306a36Sopenharmony_ci
36462306a36Sopenharmony_ci		Filtering is applied to all slaves, validation is performed
36562306a36Sopenharmony_ci		only for backup slaves.
36662306a36Sopenharmony_ci
36762306a36Sopenharmony_ci	Validation:
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci	Enabling validation causes the ARP monitor to examine the incoming
37062306a36Sopenharmony_ci	ARP requests and replies, and only consider a slave to be up if it
37162306a36Sopenharmony_ci	is receiving the appropriate ARP traffic.
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci	For an active slave, the validation checks ARP replies to confirm
37462306a36Sopenharmony_ci	that they were generated by an arp_ip_target.  Since backup slaves
37562306a36Sopenharmony_ci	do not typically receive these replies, the validation performed
37662306a36Sopenharmony_ci	for backup slaves is on the broadcast ARP request sent out via the
37762306a36Sopenharmony_ci	active slave.  It is possible that some switch or network
37862306a36Sopenharmony_ci	configurations may result in situations wherein the backup slaves
37962306a36Sopenharmony_ci	do not receive the ARP requests; in such a situation, validation
38062306a36Sopenharmony_ci	of backup slaves must be disabled.
38162306a36Sopenharmony_ci
38262306a36Sopenharmony_ci	The validation of ARP requests on backup slaves is mainly helping
38362306a36Sopenharmony_ci	bonding to decide which slaves are more likely to work in case of
38462306a36Sopenharmony_ci	the active slave failure, it doesn't really guarantee that the
38562306a36Sopenharmony_ci	backup slave will work if it's selected as the next active slave.
38662306a36Sopenharmony_ci
38762306a36Sopenharmony_ci	Validation is useful in network configurations in which multiple
38862306a36Sopenharmony_ci	bonding hosts are concurrently issuing ARPs to one or more targets
38962306a36Sopenharmony_ci	beyond a common switch.  Should the link between the switch and
39062306a36Sopenharmony_ci	target fail (but not the switch itself), the probe traffic
39162306a36Sopenharmony_ci	generated by the multiple bonding instances will fool the standard
39262306a36Sopenharmony_ci	ARP monitor into considering the links as still up.  Use of
39362306a36Sopenharmony_ci	validation can resolve this, as the ARP monitor will only consider
39462306a36Sopenharmony_ci	ARP requests and replies associated with its own instance of
39562306a36Sopenharmony_ci	bonding.
39662306a36Sopenharmony_ci
39762306a36Sopenharmony_ci	Filtering:
39862306a36Sopenharmony_ci
39962306a36Sopenharmony_ci	Enabling filtering causes the ARP monitor to only use incoming ARP
40062306a36Sopenharmony_ci	packets for link availability purposes.  Arriving packets that are
40162306a36Sopenharmony_ci	not ARPs are delivered normally, but do not count when determining
40262306a36Sopenharmony_ci	if a slave is available.
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ci	Filtering operates by only considering the reception of ARP
40562306a36Sopenharmony_ci	packets (any ARP packet, regardless of source or destination) when
40662306a36Sopenharmony_ci	determining if a slave has received traffic for link availability
40762306a36Sopenharmony_ci	purposes.
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci	Filtering is useful in network configurations in which significant
41062306a36Sopenharmony_ci	levels of third party broadcast traffic would fool the standard
41162306a36Sopenharmony_ci	ARP monitor into considering the links as still up.  Use of
41262306a36Sopenharmony_ci	filtering can resolve this, as only ARP traffic is considered for
41362306a36Sopenharmony_ci	link availability purposes.
41462306a36Sopenharmony_ci
41562306a36Sopenharmony_ci	This option was added in bonding version 3.1.0.
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ciarp_all_targets
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci	Specifies the quantity of arp_ip_targets that must be reachable
42062306a36Sopenharmony_ci	in order for the ARP monitor to consider a slave as being up.
42162306a36Sopenharmony_ci	This option affects only active-backup mode for slaves with
42262306a36Sopenharmony_ci	arp_validation enabled.
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci	Possible values are:
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ci	any or 0
42762306a36Sopenharmony_ci
42862306a36Sopenharmony_ci		consider the slave up only when any of the arp_ip_targets
42962306a36Sopenharmony_ci		is reachable
43062306a36Sopenharmony_ci
43162306a36Sopenharmony_ci	all or 1
43262306a36Sopenharmony_ci
43362306a36Sopenharmony_ci		consider the slave up only when all of the arp_ip_targets
43462306a36Sopenharmony_ci		are reachable
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ciarp_missed_max
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci	Specifies the number of arp_interval monitor checks that must
43962306a36Sopenharmony_ci	fail in order for an interface to be marked down by the ARP monitor.
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci	In order to provide orderly failover semantics, backup interfaces
44262306a36Sopenharmony_ci	are permitted an extra monitor check (i.e., they must fail
44362306a36Sopenharmony_ci	arp_missed_max + 1 times before being marked down).
44462306a36Sopenharmony_ci
44562306a36Sopenharmony_ci	The default value is 2, and the allowable range is 1 - 255.
44662306a36Sopenharmony_ci
44762306a36Sopenharmony_cidowndelay
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_ci	Specifies the time, in milliseconds, to wait before disabling
45062306a36Sopenharmony_ci	a slave after a link failure has been detected.  This option
45162306a36Sopenharmony_ci	is only valid for the miimon link monitor.  The downdelay
45262306a36Sopenharmony_ci	value should be a multiple of the miimon value; if not, it
45362306a36Sopenharmony_ci	will be rounded down to the nearest multiple.  The default
45462306a36Sopenharmony_ci	value is 0.
45562306a36Sopenharmony_ci
45662306a36Sopenharmony_cifail_over_mac
45762306a36Sopenharmony_ci
45862306a36Sopenharmony_ci	Specifies whether active-backup mode should set all slaves to
45962306a36Sopenharmony_ci	the same MAC address at enslavement (the traditional
46062306a36Sopenharmony_ci	behavior), or, when enabled, perform special handling of the
46162306a36Sopenharmony_ci	bond's MAC address in accordance with the selected policy.
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci	Possible values are:
46462306a36Sopenharmony_ci
46562306a36Sopenharmony_ci	none or 0
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci		This setting disables fail_over_mac, and causes
46862306a36Sopenharmony_ci		bonding to set all slaves of an active-backup bond to
46962306a36Sopenharmony_ci		the same MAC address at enslavement time.  This is the
47062306a36Sopenharmony_ci		default.
47162306a36Sopenharmony_ci
47262306a36Sopenharmony_ci	active or 1
47362306a36Sopenharmony_ci
47462306a36Sopenharmony_ci		The "active" fail_over_mac policy indicates that the
47562306a36Sopenharmony_ci		MAC address of the bond should always be the MAC
47662306a36Sopenharmony_ci		address of the currently active slave.  The MAC
47762306a36Sopenharmony_ci		address of the slaves is not changed; instead, the MAC
47862306a36Sopenharmony_ci		address of the bond changes during a failover.
47962306a36Sopenharmony_ci
48062306a36Sopenharmony_ci		This policy is useful for devices that cannot ever
48162306a36Sopenharmony_ci		alter their MAC address, or for devices that refuse
48262306a36Sopenharmony_ci		incoming broadcasts with their own source MAC (which
48362306a36Sopenharmony_ci		interferes with the ARP monitor).
48462306a36Sopenharmony_ci
48562306a36Sopenharmony_ci		The down side of this policy is that every device on
48662306a36Sopenharmony_ci		the network must be updated via gratuitous ARP,
48762306a36Sopenharmony_ci		vs. just updating a switch or set of switches (which
48862306a36Sopenharmony_ci		often takes place for any traffic, not just ARP
48962306a36Sopenharmony_ci		traffic, if the switch snoops incoming traffic to
49062306a36Sopenharmony_ci		update its tables) for the traditional method.  If the
49162306a36Sopenharmony_ci		gratuitous ARP is lost, communication may be
49262306a36Sopenharmony_ci		disrupted.
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci		When this policy is used in conjunction with the mii
49562306a36Sopenharmony_ci		monitor, devices which assert link up prior to being
49662306a36Sopenharmony_ci		able to actually transmit and receive are particularly
49762306a36Sopenharmony_ci		susceptible to loss of the gratuitous ARP, and an
49862306a36Sopenharmony_ci		appropriate updelay setting may be required.
49962306a36Sopenharmony_ci
50062306a36Sopenharmony_ci	follow or 2
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_ci		The "follow" fail_over_mac policy causes the MAC
50362306a36Sopenharmony_ci		address of the bond to be selected normally (normally
50462306a36Sopenharmony_ci		the MAC address of the first slave added to the bond).
50562306a36Sopenharmony_ci		However, the second and subsequent slaves are not set
50662306a36Sopenharmony_ci		to this MAC address while they are in a backup role; a
50762306a36Sopenharmony_ci		slave is programmed with the bond's MAC address at
50862306a36Sopenharmony_ci		failover time (and the formerly active slave receives
50962306a36Sopenharmony_ci		the newly active slave's MAC address).
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci		This policy is useful for multiport devices that
51262306a36Sopenharmony_ci		either become confused or incur a performance penalty
51362306a36Sopenharmony_ci		when multiple ports are programmed with the same MAC
51462306a36Sopenharmony_ci		address.
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ci	The default policy is none, unless the first slave cannot
51862306a36Sopenharmony_ci	change its MAC address, in which case the active policy is
51962306a36Sopenharmony_ci	selected by default.
52062306a36Sopenharmony_ci
52162306a36Sopenharmony_ci	This option may be modified via sysfs only when no slaves are
52262306a36Sopenharmony_ci	present in the bond.
52362306a36Sopenharmony_ci
52462306a36Sopenharmony_ci	This option was added in bonding version 3.2.0.  The "follow"
52562306a36Sopenharmony_ci	policy was added in bonding version 3.3.0.
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_cilacp_active
52862306a36Sopenharmony_ci	Option specifying whether to send LACPDU frames periodically.
52962306a36Sopenharmony_ci
53062306a36Sopenharmony_ci	off or 0
53162306a36Sopenharmony_ci		LACPDU frames acts as "speak when spoken to".
53262306a36Sopenharmony_ci
53362306a36Sopenharmony_ci	on or 1
53462306a36Sopenharmony_ci		LACPDU frames are sent along the configured links
53562306a36Sopenharmony_ci		periodically. See lacp_rate for more details.
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_ci	The default is on.
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_cilacp_rate
54062306a36Sopenharmony_ci
54162306a36Sopenharmony_ci	Option specifying the rate in which we'll ask our link partner
54262306a36Sopenharmony_ci	to transmit LACPDU packets in 802.3ad mode.  Possible values
54362306a36Sopenharmony_ci	are:
54462306a36Sopenharmony_ci
54562306a36Sopenharmony_ci	slow or 0
54662306a36Sopenharmony_ci		Request partner to transmit LACPDUs every 30 seconds
54762306a36Sopenharmony_ci
54862306a36Sopenharmony_ci	fast or 1
54962306a36Sopenharmony_ci		Request partner to transmit LACPDUs every 1 second
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_ci	The default is slow.
55262306a36Sopenharmony_ci
55362306a36Sopenharmony_cimax_bonds
55462306a36Sopenharmony_ci
55562306a36Sopenharmony_ci	Specifies the number of bonding devices to create for this
55662306a36Sopenharmony_ci	instance of the bonding driver.  E.g., if max_bonds is 3, and
55762306a36Sopenharmony_ci	the bonding driver is not already loaded, then bond0, bond1
55862306a36Sopenharmony_ci	and bond2 will be created.  The default value is 1.  Specifying
55962306a36Sopenharmony_ci	a value of 0 will load bonding, but will not create any devices.
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_cimiimon
56262306a36Sopenharmony_ci
56362306a36Sopenharmony_ci	Specifies the MII link monitoring frequency in milliseconds.
56462306a36Sopenharmony_ci	This determines how often the link state of each slave is
56562306a36Sopenharmony_ci	inspected for link failures.  A value of zero disables MII
56662306a36Sopenharmony_ci	link monitoring.  A value of 100 is a good starting point.
56762306a36Sopenharmony_ci	The use_carrier option, below, affects how the link state is
56862306a36Sopenharmony_ci	determined.  See the High Availability section for additional
56962306a36Sopenharmony_ci	information.  The default value is 100 if arp_interval is not
57062306a36Sopenharmony_ci	set.
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_cimin_links
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ci	Specifies the minimum number of links that must be active before
57562306a36Sopenharmony_ci	asserting carrier. It is similar to the Cisco EtherChannel min-links
57662306a36Sopenharmony_ci	feature. This allows setting the minimum number of member ports that
57762306a36Sopenharmony_ci	must be up (link-up state) before marking the bond device as up
57862306a36Sopenharmony_ci	(carrier on). This is useful for situations where higher level services
57962306a36Sopenharmony_ci	such as clustering want to ensure a minimum number of low bandwidth
58062306a36Sopenharmony_ci	links are active before switchover. This option only affect 802.3ad
58162306a36Sopenharmony_ci	mode.
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci	The default value is 0. This will cause carrier to be asserted (for
58462306a36Sopenharmony_ci	802.3ad mode) whenever there is an active aggregator, regardless of the
58562306a36Sopenharmony_ci	number of available links in that aggregator. Note that, because an
58662306a36Sopenharmony_ci	aggregator cannot be active without at least one available link,
58762306a36Sopenharmony_ci	setting this option to 0 or to 1 has the exact same effect.
58862306a36Sopenharmony_ci
58962306a36Sopenharmony_cimode
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci	Specifies one of the bonding policies. The default is
59262306a36Sopenharmony_ci	balance-rr (round robin).  Possible values are:
59362306a36Sopenharmony_ci
59462306a36Sopenharmony_ci	balance-rr or 0
59562306a36Sopenharmony_ci
59662306a36Sopenharmony_ci		Round-robin policy: Transmit packets in sequential
59762306a36Sopenharmony_ci		order from the first available slave through the
59862306a36Sopenharmony_ci		last.  This mode provides load balancing and fault
59962306a36Sopenharmony_ci		tolerance.
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci	active-backup or 1
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_ci		Active-backup policy: Only one slave in the bond is
60462306a36Sopenharmony_ci		active.  A different slave becomes active if, and only
60562306a36Sopenharmony_ci		if, the active slave fails.  The bond's MAC address is
60662306a36Sopenharmony_ci		externally visible on only one port (network adapter)
60762306a36Sopenharmony_ci		to avoid confusing the switch.
60862306a36Sopenharmony_ci
60962306a36Sopenharmony_ci		In bonding version 2.6.2 or later, when a failover
61062306a36Sopenharmony_ci		occurs in active-backup mode, bonding will issue one
61162306a36Sopenharmony_ci		or more gratuitous ARPs on the newly active slave.
61262306a36Sopenharmony_ci		One gratuitous ARP is issued for the bonding master
61362306a36Sopenharmony_ci		interface and each VLAN interfaces configured above
61462306a36Sopenharmony_ci		it, provided that the interface has at least one IP
61562306a36Sopenharmony_ci		address configured.  Gratuitous ARPs issued for VLAN
61662306a36Sopenharmony_ci		interfaces are tagged with the appropriate VLAN id.
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_ci		This mode provides fault tolerance.  The primary
61962306a36Sopenharmony_ci		option, documented below, affects the behavior of this
62062306a36Sopenharmony_ci		mode.
62162306a36Sopenharmony_ci
62262306a36Sopenharmony_ci	balance-xor or 2
62362306a36Sopenharmony_ci
62462306a36Sopenharmony_ci		XOR policy: Transmit based on the selected transmit
62562306a36Sopenharmony_ci		hash policy.  The default policy is a simple [(source
62662306a36Sopenharmony_ci		MAC address XOR'd with destination MAC address XOR
62762306a36Sopenharmony_ci		packet type ID) modulo slave count].  Alternate transmit
62862306a36Sopenharmony_ci		policies may be	selected via the xmit_hash_policy option,
62962306a36Sopenharmony_ci		described below.
63062306a36Sopenharmony_ci
63162306a36Sopenharmony_ci		This mode provides load balancing and fault tolerance.
63262306a36Sopenharmony_ci
63362306a36Sopenharmony_ci	broadcast or 3
63462306a36Sopenharmony_ci
63562306a36Sopenharmony_ci		Broadcast policy: transmits everything on all slave
63662306a36Sopenharmony_ci		interfaces.  This mode provides fault tolerance.
63762306a36Sopenharmony_ci
63862306a36Sopenharmony_ci	802.3ad or 4
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci		IEEE 802.3ad Dynamic link aggregation.  Creates
64162306a36Sopenharmony_ci		aggregation groups that share the same speed and
64262306a36Sopenharmony_ci		duplex settings.  Utilizes all slaves in the active
64362306a36Sopenharmony_ci		aggregator according to the 802.3ad specification.
64462306a36Sopenharmony_ci
64562306a36Sopenharmony_ci		Slave selection for outgoing traffic is done according
64662306a36Sopenharmony_ci		to the transmit hash policy, which may be changed from
64762306a36Sopenharmony_ci		the default simple XOR policy via the xmit_hash_policy
64862306a36Sopenharmony_ci		option, documented below.  Note that not all transmit
64962306a36Sopenharmony_ci		policies may be 802.3ad compliant, particularly in
65062306a36Sopenharmony_ci		regards to the packet mis-ordering requirements of
65162306a36Sopenharmony_ci		section 43.2.4 of the 802.3ad standard.  Differing
65262306a36Sopenharmony_ci		peer implementations will have varying tolerances for
65362306a36Sopenharmony_ci		noncompliance.
65462306a36Sopenharmony_ci
65562306a36Sopenharmony_ci		Prerequisites:
65662306a36Sopenharmony_ci
65762306a36Sopenharmony_ci		1. Ethtool support in the base drivers for retrieving
65862306a36Sopenharmony_ci		the speed and duplex of each slave.
65962306a36Sopenharmony_ci
66062306a36Sopenharmony_ci		2. A switch that supports IEEE 802.3ad Dynamic link
66162306a36Sopenharmony_ci		aggregation.
66262306a36Sopenharmony_ci
66362306a36Sopenharmony_ci		Most switches will require some type of configuration
66462306a36Sopenharmony_ci		to enable 802.3ad mode.
66562306a36Sopenharmony_ci
66662306a36Sopenharmony_ci	balance-tlb or 5
66762306a36Sopenharmony_ci
66862306a36Sopenharmony_ci		Adaptive transmit load balancing: channel bonding that
66962306a36Sopenharmony_ci		does not require any special switch support.
67062306a36Sopenharmony_ci
67162306a36Sopenharmony_ci		In tlb_dynamic_lb=1 mode; the outgoing traffic is
67262306a36Sopenharmony_ci		distributed according to the current load (computed
67362306a36Sopenharmony_ci		relative to the speed) on each slave.
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci		In tlb_dynamic_lb=0 mode; the load balancing based on
67662306a36Sopenharmony_ci		current load is disabled and the load is distributed
67762306a36Sopenharmony_ci		only using the hash distribution.
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_ci		Incoming traffic is received by the current slave.
68062306a36Sopenharmony_ci		If the receiving slave fails, another slave takes over
68162306a36Sopenharmony_ci		the MAC address of the failed receiving slave.
68262306a36Sopenharmony_ci
68362306a36Sopenharmony_ci		Prerequisite:
68462306a36Sopenharmony_ci
68562306a36Sopenharmony_ci		Ethtool support in the base drivers for retrieving the
68662306a36Sopenharmony_ci		speed of each slave.
68762306a36Sopenharmony_ci
68862306a36Sopenharmony_ci	balance-alb or 6
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci		Adaptive load balancing: includes balance-tlb plus
69162306a36Sopenharmony_ci		receive load balancing (rlb) for IPV4 traffic, and
69262306a36Sopenharmony_ci		does not require any special switch support.  The
69362306a36Sopenharmony_ci		receive load balancing is achieved by ARP negotiation.
69462306a36Sopenharmony_ci		The bonding driver intercepts the ARP Replies sent by
69562306a36Sopenharmony_ci		the local system on their way out and overwrites the
69662306a36Sopenharmony_ci		source hardware address with the unique hardware
69762306a36Sopenharmony_ci		address of one of the slaves in the bond such that
69862306a36Sopenharmony_ci		different peers use different hardware addresses for
69962306a36Sopenharmony_ci		the server.
70062306a36Sopenharmony_ci
70162306a36Sopenharmony_ci		Receive traffic from connections created by the server
70262306a36Sopenharmony_ci		is also balanced.  When the local system sends an ARP
70362306a36Sopenharmony_ci		Request the bonding driver copies and saves the peer's
70462306a36Sopenharmony_ci		IP information from the ARP packet.  When the ARP
70562306a36Sopenharmony_ci		Reply arrives from the peer, its hardware address is
70662306a36Sopenharmony_ci		retrieved and the bonding driver initiates an ARP
70762306a36Sopenharmony_ci		reply to this peer assigning it to one of the slaves
70862306a36Sopenharmony_ci		in the bond.  A problematic outcome of using ARP
70962306a36Sopenharmony_ci		negotiation for balancing is that each time that an
71062306a36Sopenharmony_ci		ARP request is broadcast it uses the hardware address
71162306a36Sopenharmony_ci		of the bond.  Hence, peers learn the hardware address
71262306a36Sopenharmony_ci		of the bond and the balancing of receive traffic
71362306a36Sopenharmony_ci		collapses to the current slave.  This is handled by
71462306a36Sopenharmony_ci		sending updates (ARP Replies) to all the peers with
71562306a36Sopenharmony_ci		their individually assigned hardware address such that
71662306a36Sopenharmony_ci		the traffic is redistributed.  Receive traffic is also
71762306a36Sopenharmony_ci		redistributed when a new slave is added to the bond
71862306a36Sopenharmony_ci		and when an inactive slave is re-activated.  The
71962306a36Sopenharmony_ci		receive load is distributed sequentially (round robin)
72062306a36Sopenharmony_ci		among the group of highest speed slaves in the bond.
72162306a36Sopenharmony_ci
72262306a36Sopenharmony_ci		When a link is reconnected or a new slave joins the
72362306a36Sopenharmony_ci		bond the receive traffic is redistributed among all
72462306a36Sopenharmony_ci		active slaves in the bond by initiating ARP Replies
72562306a36Sopenharmony_ci		with the selected MAC address to each of the
72662306a36Sopenharmony_ci		clients. The updelay parameter (detailed below) must
72762306a36Sopenharmony_ci		be set to a value equal or greater than the switch's
72862306a36Sopenharmony_ci		forwarding delay so that the ARP Replies sent to the
72962306a36Sopenharmony_ci		peers will not be blocked by the switch.
73062306a36Sopenharmony_ci
73162306a36Sopenharmony_ci		Prerequisites:
73262306a36Sopenharmony_ci
73362306a36Sopenharmony_ci		1. Ethtool support in the base drivers for retrieving
73462306a36Sopenharmony_ci		the speed of each slave.
73562306a36Sopenharmony_ci
73662306a36Sopenharmony_ci		2. Base driver support for setting the hardware
73762306a36Sopenharmony_ci		address of a device while it is open.  This is
73862306a36Sopenharmony_ci		required so that there will always be one slave in the
73962306a36Sopenharmony_ci		team using the bond hardware address (the
74062306a36Sopenharmony_ci		curr_active_slave) while having a unique hardware
74162306a36Sopenharmony_ci		address for each slave in the bond.  If the
74262306a36Sopenharmony_ci		curr_active_slave fails its hardware address is
74362306a36Sopenharmony_ci		swapped with the new curr_active_slave that was
74462306a36Sopenharmony_ci		chosen.
74562306a36Sopenharmony_ci
74662306a36Sopenharmony_cinum_grat_arp,
74762306a36Sopenharmony_cinum_unsol_na
74862306a36Sopenharmony_ci
74962306a36Sopenharmony_ci	Specify the number of peer notifications (gratuitous ARPs and
75062306a36Sopenharmony_ci	unsolicited IPv6 Neighbor Advertisements) to be issued after a
75162306a36Sopenharmony_ci	failover event.  As soon as the link is up on the new slave
75262306a36Sopenharmony_ci	(possibly immediately) a peer notification is sent on the
75362306a36Sopenharmony_ci	bonding device and each VLAN sub-device. This is repeated at
75462306a36Sopenharmony_ci	the rate specified by peer_notif_delay if the number is
75562306a36Sopenharmony_ci	greater than 1.
75662306a36Sopenharmony_ci
75762306a36Sopenharmony_ci	The valid range is 0 - 255; the default value is 1.  These options
75862306a36Sopenharmony_ci	affect only the active-backup mode.  These options were added for
75962306a36Sopenharmony_ci	bonding versions 3.3.0 and 3.4.0 respectively.
76062306a36Sopenharmony_ci
76162306a36Sopenharmony_ci	From Linux 3.0 and bonding version 3.7.1, these notifications
76262306a36Sopenharmony_ci	are generated by the ipv4 and ipv6 code and the numbers of
76362306a36Sopenharmony_ci	repetitions cannot be set independently.
76462306a36Sopenharmony_ci
76562306a36Sopenharmony_cipackets_per_slave
76662306a36Sopenharmony_ci
76762306a36Sopenharmony_ci	Specify the number of packets to transmit through a slave before
76862306a36Sopenharmony_ci	moving to the next one. When set to 0 then a slave is chosen at
76962306a36Sopenharmony_ci	random.
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_ci	The valid range is 0 - 65535; the default value is 1. This option
77262306a36Sopenharmony_ci	has effect only in balance-rr mode.
77362306a36Sopenharmony_ci
77462306a36Sopenharmony_cipeer_notif_delay
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci	Specify the delay, in milliseconds, between each peer
77762306a36Sopenharmony_ci	notification (gratuitous ARP and unsolicited IPv6 Neighbor
77862306a36Sopenharmony_ci	Advertisement) when they are issued after a failover event.
77962306a36Sopenharmony_ci	This delay should be a multiple of the MII link monitor interval
78062306a36Sopenharmony_ci	(miimon).
78162306a36Sopenharmony_ci
78262306a36Sopenharmony_ci	The valid range is 0 - 300000. The default value is 0, which means
78362306a36Sopenharmony_ci	to match the value of the MII link monitor interval.
78462306a36Sopenharmony_ci
78562306a36Sopenharmony_ciprio
78662306a36Sopenharmony_ci	Slave priority. A higher number means higher priority.
78762306a36Sopenharmony_ci	The primary slave has the highest priority. This option also
78862306a36Sopenharmony_ci	follows the primary_reselect rules.
78962306a36Sopenharmony_ci
79062306a36Sopenharmony_ci	This option could only be configured via netlink, and is only valid
79162306a36Sopenharmony_ci	for active-backup(1), balance-tlb (5) and balance-alb (6) mode.
79262306a36Sopenharmony_ci	The valid value range is a signed 32 bit integer.
79362306a36Sopenharmony_ci
79462306a36Sopenharmony_ci	The default value is 0.
79562306a36Sopenharmony_ci
79662306a36Sopenharmony_ciprimary
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci	A string (eth0, eth2, etc) specifying which slave is the
79962306a36Sopenharmony_ci	primary device.  The specified device will always be the
80062306a36Sopenharmony_ci	active slave while it is available.  Only when the primary is
80162306a36Sopenharmony_ci	off-line will alternate devices be used.  This is useful when
80262306a36Sopenharmony_ci	one slave is preferred over another, e.g., when one slave has
80362306a36Sopenharmony_ci	higher throughput than another.
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_ci	The primary option is only valid for active-backup(1),
80662306a36Sopenharmony_ci	balance-tlb (5) and balance-alb (6) mode.
80762306a36Sopenharmony_ci
80862306a36Sopenharmony_ciprimary_reselect
80962306a36Sopenharmony_ci
81062306a36Sopenharmony_ci	Specifies the reselection policy for the primary slave.  This
81162306a36Sopenharmony_ci	affects how the primary slave is chosen to become the active slave
81262306a36Sopenharmony_ci	when failure of the active slave or recovery of the primary slave
81362306a36Sopenharmony_ci	occurs.  This option is designed to prevent flip-flopping between
81462306a36Sopenharmony_ci	the primary slave and other slaves.  Possible values are:
81562306a36Sopenharmony_ci
81662306a36Sopenharmony_ci	always or 0 (default)
81762306a36Sopenharmony_ci
81862306a36Sopenharmony_ci		The primary slave becomes the active slave whenever it
81962306a36Sopenharmony_ci		comes back up.
82062306a36Sopenharmony_ci
82162306a36Sopenharmony_ci	better or 1
82262306a36Sopenharmony_ci
82362306a36Sopenharmony_ci		The primary slave becomes the active slave when it comes
82462306a36Sopenharmony_ci		back up, if the speed and duplex of the primary slave is
82562306a36Sopenharmony_ci		better than the speed and duplex of the current active
82662306a36Sopenharmony_ci		slave.
82762306a36Sopenharmony_ci
82862306a36Sopenharmony_ci	failure or 2
82962306a36Sopenharmony_ci
83062306a36Sopenharmony_ci		The primary slave becomes the active slave only if the
83162306a36Sopenharmony_ci		current active slave fails and the primary slave is up.
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci	The primary_reselect setting is ignored in two cases:
83462306a36Sopenharmony_ci
83562306a36Sopenharmony_ci		If no slaves are active, the first slave to recover is
83662306a36Sopenharmony_ci		made the active slave.
83762306a36Sopenharmony_ci
83862306a36Sopenharmony_ci		When initially enslaved, the primary slave is always made
83962306a36Sopenharmony_ci		the active slave.
84062306a36Sopenharmony_ci
84162306a36Sopenharmony_ci	Changing the primary_reselect policy via sysfs will cause an
84262306a36Sopenharmony_ci	immediate selection of the best active slave according to the new
84362306a36Sopenharmony_ci	policy.  This may or may not result in a change of the active
84462306a36Sopenharmony_ci	slave, depending upon the circumstances.
84562306a36Sopenharmony_ci
84662306a36Sopenharmony_ci	This option was added for bonding version 3.6.0.
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_citlb_dynamic_lb
84962306a36Sopenharmony_ci
85062306a36Sopenharmony_ci	Specifies if dynamic shuffling of flows is enabled in tlb
85162306a36Sopenharmony_ci	or alb mode. The value has no effect on any other modes.
85262306a36Sopenharmony_ci
85362306a36Sopenharmony_ci	The default behavior of tlb mode is to shuffle active flows across
85462306a36Sopenharmony_ci	slaves based on the load in that interval. This gives nice lb
85562306a36Sopenharmony_ci	characteristics but can cause packet reordering. If re-ordering is
85662306a36Sopenharmony_ci	a concern use this variable to disable flow shuffling and rely on
85762306a36Sopenharmony_ci	load balancing provided solely by the hash distribution.
85862306a36Sopenharmony_ci	xmit-hash-policy can be used to select the appropriate hashing for
85962306a36Sopenharmony_ci	the setup.
86062306a36Sopenharmony_ci
86162306a36Sopenharmony_ci	The sysfs entry can be used to change the setting per bond device
86262306a36Sopenharmony_ci	and the initial value is derived from the module parameter. The
86362306a36Sopenharmony_ci	sysfs entry is allowed to be changed only if the bond device is
86462306a36Sopenharmony_ci	down.
86562306a36Sopenharmony_ci
86662306a36Sopenharmony_ci	The default value is "1" that enables flow shuffling while value "0"
86762306a36Sopenharmony_ci	disables it. This option was added in bonding driver 3.7.1
86862306a36Sopenharmony_ci
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_ciupdelay
87162306a36Sopenharmony_ci
87262306a36Sopenharmony_ci	Specifies the time, in milliseconds, to wait before enabling a
87362306a36Sopenharmony_ci	slave after a link recovery has been detected.  This option is
87462306a36Sopenharmony_ci	only valid for the miimon link monitor.  The updelay value
87562306a36Sopenharmony_ci	should be a multiple of the miimon value; if not, it will be
87662306a36Sopenharmony_ci	rounded down to the nearest multiple.  The default value is 0.
87762306a36Sopenharmony_ci
87862306a36Sopenharmony_ciuse_carrier
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci	Specifies whether or not miimon should use MII or ETHTOOL
88162306a36Sopenharmony_ci	ioctls vs. netif_carrier_ok() to determine the link
88262306a36Sopenharmony_ci	status. The MII or ETHTOOL ioctls are less efficient and
88362306a36Sopenharmony_ci	utilize a deprecated calling sequence within the kernel.  The
88462306a36Sopenharmony_ci	netif_carrier_ok() relies on the device driver to maintain its
88562306a36Sopenharmony_ci	state with netif_carrier_on/off; at this writing, most, but
88662306a36Sopenharmony_ci	not all, device drivers support this facility.
88762306a36Sopenharmony_ci
88862306a36Sopenharmony_ci	If bonding insists that the link is up when it should not be,
88962306a36Sopenharmony_ci	it may be that your network device driver does not support
89062306a36Sopenharmony_ci	netif_carrier_on/off.  The default state for netif_carrier is
89162306a36Sopenharmony_ci	"carrier on," so if a driver does not support netif_carrier,
89262306a36Sopenharmony_ci	it will appear as if the link is always up.  In this case,
89362306a36Sopenharmony_ci	setting use_carrier to 0 will cause bonding to revert to the
89462306a36Sopenharmony_ci	MII / ETHTOOL ioctl method to determine the link state.
89562306a36Sopenharmony_ci
89662306a36Sopenharmony_ci	A value of 1 enables the use of netif_carrier_ok(), a value of
89762306a36Sopenharmony_ci	0 will use the deprecated MII / ETHTOOL ioctls.  The default
89862306a36Sopenharmony_ci	value is 1.
89962306a36Sopenharmony_ci
90062306a36Sopenharmony_cixmit_hash_policy
90162306a36Sopenharmony_ci
90262306a36Sopenharmony_ci	Selects the transmit hash policy to use for slave selection in
90362306a36Sopenharmony_ci	balance-xor, 802.3ad, and tlb modes.  Possible values are:
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci	layer2
90662306a36Sopenharmony_ci
90762306a36Sopenharmony_ci		Uses XOR of hardware MAC addresses and packet type ID
90862306a36Sopenharmony_ci		field to generate the hash. The formula is
90962306a36Sopenharmony_ci
91062306a36Sopenharmony_ci		hash = source MAC[5] XOR destination MAC[5] XOR packet type ID
91162306a36Sopenharmony_ci		slave number = hash modulo slave count
91262306a36Sopenharmony_ci
91362306a36Sopenharmony_ci		This algorithm will place all traffic to a particular
91462306a36Sopenharmony_ci		network peer on the same slave.
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci		This algorithm is 802.3ad compliant.
91762306a36Sopenharmony_ci
91862306a36Sopenharmony_ci	layer2+3
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_ci		This policy uses a combination of layer2 and layer3
92162306a36Sopenharmony_ci		protocol information to generate the hash.
92262306a36Sopenharmony_ci
92362306a36Sopenharmony_ci		Uses XOR of hardware MAC addresses and IP addresses to
92462306a36Sopenharmony_ci		generate the hash.  The formula is
92562306a36Sopenharmony_ci
92662306a36Sopenharmony_ci		hash = source MAC[5] XOR destination MAC[5] XOR packet type ID
92762306a36Sopenharmony_ci		hash = hash XOR source IP XOR destination IP
92862306a36Sopenharmony_ci		hash = hash XOR (hash RSHIFT 16)
92962306a36Sopenharmony_ci		hash = hash XOR (hash RSHIFT 8)
93062306a36Sopenharmony_ci		And then hash is reduced modulo slave count.
93162306a36Sopenharmony_ci
93262306a36Sopenharmony_ci		If the protocol is IPv6 then the source and destination
93362306a36Sopenharmony_ci		addresses are first hashed using ipv6_addr_hash.
93462306a36Sopenharmony_ci
93562306a36Sopenharmony_ci		This algorithm will place all traffic to a particular
93662306a36Sopenharmony_ci		network peer on the same slave.  For non-IP traffic,
93762306a36Sopenharmony_ci		the formula is the same as for the layer2 transmit
93862306a36Sopenharmony_ci		hash policy.
93962306a36Sopenharmony_ci
94062306a36Sopenharmony_ci		This policy is intended to provide a more balanced
94162306a36Sopenharmony_ci		distribution of traffic than layer2 alone, especially
94262306a36Sopenharmony_ci		in environments where a layer3 gateway device is
94362306a36Sopenharmony_ci		required to reach most destinations.
94462306a36Sopenharmony_ci
94562306a36Sopenharmony_ci		This algorithm is 802.3ad compliant.
94662306a36Sopenharmony_ci
94762306a36Sopenharmony_ci	layer3+4
94862306a36Sopenharmony_ci
94962306a36Sopenharmony_ci		This policy uses upper layer protocol information,
95062306a36Sopenharmony_ci		when available, to generate the hash.  This allows for
95162306a36Sopenharmony_ci		traffic to a particular network peer to span multiple
95262306a36Sopenharmony_ci		slaves, although a single connection will not span
95362306a36Sopenharmony_ci		multiple slaves.
95462306a36Sopenharmony_ci
95562306a36Sopenharmony_ci		The formula for unfragmented TCP and UDP packets is
95662306a36Sopenharmony_ci
95762306a36Sopenharmony_ci		hash = source port, destination port (as in the header)
95862306a36Sopenharmony_ci		hash = hash XOR source IP XOR destination IP
95962306a36Sopenharmony_ci		hash = hash XOR (hash RSHIFT 16)
96062306a36Sopenharmony_ci		hash = hash XOR (hash RSHIFT 8)
96162306a36Sopenharmony_ci		hash = hash RSHIFT 1
96262306a36Sopenharmony_ci		And then hash is reduced modulo slave count.
96362306a36Sopenharmony_ci
96462306a36Sopenharmony_ci		If the protocol is IPv6 then the source and destination
96562306a36Sopenharmony_ci		addresses are first hashed using ipv6_addr_hash.
96662306a36Sopenharmony_ci
96762306a36Sopenharmony_ci		For fragmented TCP or UDP packets and all other IPv4 and
96862306a36Sopenharmony_ci		IPv6 protocol traffic, the source and destination port
96962306a36Sopenharmony_ci		information is omitted.  For non-IP traffic, the
97062306a36Sopenharmony_ci		formula is the same as for the layer2 transmit hash
97162306a36Sopenharmony_ci		policy.
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci		This algorithm is not fully 802.3ad compliant.  A
97462306a36Sopenharmony_ci		single TCP or UDP conversation containing both
97562306a36Sopenharmony_ci		fragmented and unfragmented packets will see packets
97662306a36Sopenharmony_ci		striped across two interfaces.  This may result in out
97762306a36Sopenharmony_ci		of order delivery.  Most traffic types will not meet
97862306a36Sopenharmony_ci		this criteria, as TCP rarely fragments traffic, and
97962306a36Sopenharmony_ci		most UDP traffic is not involved in extended
98062306a36Sopenharmony_ci		conversations.  Other implementations of 802.3ad may
98162306a36Sopenharmony_ci		or may not tolerate this noncompliance.
98262306a36Sopenharmony_ci
98362306a36Sopenharmony_ci	encap2+3
98462306a36Sopenharmony_ci
98562306a36Sopenharmony_ci		This policy uses the same formula as layer2+3 but it
98662306a36Sopenharmony_ci		relies on skb_flow_dissect to obtain the header fields
98762306a36Sopenharmony_ci		which might result in the use of inner headers if an
98862306a36Sopenharmony_ci		encapsulation protocol is used. For example this will
98962306a36Sopenharmony_ci		improve the performance for tunnel users because the
99062306a36Sopenharmony_ci		packets will be distributed according to the encapsulated
99162306a36Sopenharmony_ci		flows.
99262306a36Sopenharmony_ci
99362306a36Sopenharmony_ci	encap3+4
99462306a36Sopenharmony_ci
99562306a36Sopenharmony_ci		This policy uses the same formula as layer3+4 but it
99662306a36Sopenharmony_ci		relies on skb_flow_dissect to obtain the header fields
99762306a36Sopenharmony_ci		which might result in the use of inner headers if an
99862306a36Sopenharmony_ci		encapsulation protocol is used. For example this will
99962306a36Sopenharmony_ci		improve the performance for tunnel users because the
100062306a36Sopenharmony_ci		packets will be distributed according to the encapsulated
100162306a36Sopenharmony_ci		flows.
100262306a36Sopenharmony_ci
100362306a36Sopenharmony_ci	vlan+srcmac
100462306a36Sopenharmony_ci
100562306a36Sopenharmony_ci		This policy uses a very rudimentary vlan ID and source mac
100662306a36Sopenharmony_ci		hash to load-balance traffic per-vlan, with failover
100762306a36Sopenharmony_ci		should one leg fail. The intended use case is for a bond
100862306a36Sopenharmony_ci		shared by multiple virtual machines, all configured to
100962306a36Sopenharmony_ci		use their own vlan, to give lacp-like functionality
101062306a36Sopenharmony_ci		without requiring lacp-capable switching hardware.
101162306a36Sopenharmony_ci
101262306a36Sopenharmony_ci		The formula for the hash is simply
101362306a36Sopenharmony_ci
101462306a36Sopenharmony_ci		hash = (vlan ID) XOR (source MAC vendor) XOR (source MAC dev)
101562306a36Sopenharmony_ci
101662306a36Sopenharmony_ci	The default value is layer2.  This option was added in bonding
101762306a36Sopenharmony_ci	version 2.6.3.  In earlier versions of bonding, this parameter
101862306a36Sopenharmony_ci	does not exist, and the layer2 policy is the only policy.  The
101962306a36Sopenharmony_ci	layer2+3 value was added for bonding version 3.2.2.
102062306a36Sopenharmony_ci
102162306a36Sopenharmony_ciresend_igmp
102262306a36Sopenharmony_ci
102362306a36Sopenharmony_ci	Specifies the number of IGMP membership reports to be issued after
102462306a36Sopenharmony_ci	a failover event. One membership report is issued immediately after
102562306a36Sopenharmony_ci	the failover, subsequent packets are sent in each 200ms interval.
102662306a36Sopenharmony_ci
102762306a36Sopenharmony_ci	The valid range is 0 - 255; the default value is 1. A value of 0
102862306a36Sopenharmony_ci	prevents the IGMP membership report from being issued in response
102962306a36Sopenharmony_ci	to the failover event.
103062306a36Sopenharmony_ci
103162306a36Sopenharmony_ci	This option is useful for bonding modes balance-rr (0), active-backup
103262306a36Sopenharmony_ci	(1), balance-tlb (5) and balance-alb (6), in which a failover can
103362306a36Sopenharmony_ci	switch the IGMP traffic from one slave to another.  Therefore a fresh
103462306a36Sopenharmony_ci	IGMP report must be issued to cause the switch to forward the incoming
103562306a36Sopenharmony_ci	IGMP traffic over the newly selected slave.
103662306a36Sopenharmony_ci
103762306a36Sopenharmony_ci	This option was added for bonding version 3.7.0.
103862306a36Sopenharmony_ci
103962306a36Sopenharmony_cilp_interval
104062306a36Sopenharmony_ci
104162306a36Sopenharmony_ci	Specifies the number of seconds between instances where the bonding
104262306a36Sopenharmony_ci	driver sends learning packets to each slaves peer switch.
104362306a36Sopenharmony_ci
104462306a36Sopenharmony_ci	The valid range is 1 - 0x7fffffff; the default value is 1. This Option
104562306a36Sopenharmony_ci	has effect only in balance-tlb and balance-alb modes.
104662306a36Sopenharmony_ci
104762306a36Sopenharmony_ci3. Configuring Bonding Devices
104862306a36Sopenharmony_ci==============================
104962306a36Sopenharmony_ci
105062306a36Sopenharmony_ciYou can configure bonding using either your distro's network
105162306a36Sopenharmony_ciinitialization scripts, or manually using either iproute2 or the
105262306a36Sopenharmony_cisysfs interface.  Distros generally use one of three packages for the
105362306a36Sopenharmony_cinetwork initialization scripts: initscripts, sysconfig or interfaces.
105462306a36Sopenharmony_ciRecent versions of these packages have support for bonding, while older
105562306a36Sopenharmony_civersions do not.
105662306a36Sopenharmony_ci
105762306a36Sopenharmony_ciWe will first describe the options for configuring bonding for
105862306a36Sopenharmony_cidistros using versions of initscripts, sysconfig and interfaces with full
105962306a36Sopenharmony_cior partial support for bonding, then provide information on enabling
106062306a36Sopenharmony_cibonding without support from the network initialization scripts (i.e.,
106162306a36Sopenharmony_ciolder versions of initscripts or sysconfig).
106262306a36Sopenharmony_ci
106362306a36Sopenharmony_ciIf you're unsure whether your distro uses sysconfig,
106462306a36Sopenharmony_ciinitscripts or interfaces, or don't know if it's new enough, have no fear.
106562306a36Sopenharmony_ciDetermining this is fairly straightforward.
106662306a36Sopenharmony_ci
106762306a36Sopenharmony_ciFirst, look for a file called interfaces in /etc/network directory.
106862306a36Sopenharmony_ciIf this file is present in your system, then your system use interfaces. See
106962306a36Sopenharmony_ciConfiguration with Interfaces Support.
107062306a36Sopenharmony_ci
107162306a36Sopenharmony_ciElse, issue the command::
107262306a36Sopenharmony_ci
107362306a36Sopenharmony_ci	$ rpm -qf /sbin/ifup
107462306a36Sopenharmony_ci
107562306a36Sopenharmony_ciIt will respond with a line of text starting with either
107662306a36Sopenharmony_ci"initscripts" or "sysconfig," followed by some numbers.  This is the
107762306a36Sopenharmony_cipackage that provides your network initialization scripts.
107862306a36Sopenharmony_ci
107962306a36Sopenharmony_ciNext, to determine if your installation supports bonding,
108062306a36Sopenharmony_ciissue the command::
108162306a36Sopenharmony_ci
108262306a36Sopenharmony_ci    $ grep ifenslave /sbin/ifup
108362306a36Sopenharmony_ci
108462306a36Sopenharmony_ciIf this returns any matches, then your initscripts or
108562306a36Sopenharmony_cisysconfig has support for bonding.
108662306a36Sopenharmony_ci
108762306a36Sopenharmony_ci3.1 Configuration with Sysconfig Support
108862306a36Sopenharmony_ci----------------------------------------
108962306a36Sopenharmony_ci
109062306a36Sopenharmony_ciThis section applies to distros using a version of sysconfig
109162306a36Sopenharmony_ciwith bonding support, for example, SuSE Linux Enterprise Server 9.
109262306a36Sopenharmony_ci
109362306a36Sopenharmony_ciSuSE SLES 9's networking configuration system does support
109462306a36Sopenharmony_cibonding, however, at this writing, the YaST system configuration
109562306a36Sopenharmony_cifront end does not provide any means to work with bonding devices.
109662306a36Sopenharmony_ciBonding devices can be managed by hand, however, as follows.
109762306a36Sopenharmony_ci
109862306a36Sopenharmony_ciFirst, if they have not already been configured, configure the
109962306a36Sopenharmony_cislave devices.  On SLES 9, this is most easily done by running the
110062306a36Sopenharmony_ciyast2 sysconfig configuration utility.  The goal is for to create an
110162306a36Sopenharmony_ciifcfg-id file for each slave device.  The simplest way to accomplish
110262306a36Sopenharmony_cithis is to configure the devices for DHCP (this is only to get the
110362306a36Sopenharmony_cifile ifcfg-id file created; see below for some issues with DHCP).  The
110462306a36Sopenharmony_ciname of the configuration file for each device will be of the form::
110562306a36Sopenharmony_ci
110662306a36Sopenharmony_ci    ifcfg-id-xx:xx:xx:xx:xx:xx
110762306a36Sopenharmony_ci
110862306a36Sopenharmony_ciWhere the "xx" portion will be replaced with the digits from
110962306a36Sopenharmony_cithe device's permanent MAC address.
111062306a36Sopenharmony_ci
111162306a36Sopenharmony_ciOnce the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
111262306a36Sopenharmony_cicreated, it is necessary to edit the configuration files for the slave
111362306a36Sopenharmony_cidevices (the MAC addresses correspond to those of the slave devices).
111462306a36Sopenharmony_ciBefore editing, the file will contain multiple lines, and will look
111562306a36Sopenharmony_cisomething like this::
111662306a36Sopenharmony_ci
111762306a36Sopenharmony_ci	BOOTPROTO='dhcp'
111862306a36Sopenharmony_ci	STARTMODE='on'
111962306a36Sopenharmony_ci	USERCTL='no'
112062306a36Sopenharmony_ci	UNIQUE='XNzu.WeZGOGF+4wE'
112162306a36Sopenharmony_ci	_nm_name='bus-pci-0001:61:01.0'
112262306a36Sopenharmony_ci
112362306a36Sopenharmony_ciChange the BOOTPROTO and STARTMODE lines to the following::
112462306a36Sopenharmony_ci
112562306a36Sopenharmony_ci	BOOTPROTO='none'
112662306a36Sopenharmony_ci	STARTMODE='off'
112762306a36Sopenharmony_ci
112862306a36Sopenharmony_ciDo not alter the UNIQUE or _nm_name lines.  Remove any other
112962306a36Sopenharmony_cilines (USERCTL, etc).
113062306a36Sopenharmony_ci
113162306a36Sopenharmony_ciOnce the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified,
113262306a36Sopenharmony_ciit's time to create the configuration file for the bonding device
113362306a36Sopenharmony_ciitself.  This file is named ifcfg-bondX, where X is the number of the
113462306a36Sopenharmony_cibonding device to create, starting at 0.  The first such file is
113562306a36Sopenharmony_ciifcfg-bond0, the second is ifcfg-bond1, and so on.  The sysconfig
113662306a36Sopenharmony_cinetwork configuration system will correctly start multiple instances
113762306a36Sopenharmony_ciof bonding.
113862306a36Sopenharmony_ci
113962306a36Sopenharmony_ciThe contents of the ifcfg-bondX file is as follows::
114062306a36Sopenharmony_ci
114162306a36Sopenharmony_ci	BOOTPROTO="static"
114262306a36Sopenharmony_ci	BROADCAST="10.0.2.255"
114362306a36Sopenharmony_ci	IPADDR="10.0.2.10"
114462306a36Sopenharmony_ci	NETMASK="255.255.0.0"
114562306a36Sopenharmony_ci	NETWORK="10.0.2.0"
114662306a36Sopenharmony_ci	REMOTE_IPADDR=""
114762306a36Sopenharmony_ci	STARTMODE="onboot"
114862306a36Sopenharmony_ci	BONDING_MASTER="yes"
114962306a36Sopenharmony_ci	BONDING_MODULE_OPTS="mode=active-backup miimon=100"
115062306a36Sopenharmony_ci	BONDING_SLAVE0="eth0"
115162306a36Sopenharmony_ci	BONDING_SLAVE1="bus-pci-0000:06:08.1"
115262306a36Sopenharmony_ci
115362306a36Sopenharmony_ciReplace the sample BROADCAST, IPADDR, NETMASK and NETWORK
115462306a36Sopenharmony_civalues with the appropriate values for your network.
115562306a36Sopenharmony_ci
115662306a36Sopenharmony_ciThe STARTMODE specifies when the device is brought online.
115762306a36Sopenharmony_ciThe possible values are:
115862306a36Sopenharmony_ci
115962306a36Sopenharmony_ci	======== ======================================================
116062306a36Sopenharmony_ci	onboot	 The device is started at boot time.  If you're not
116162306a36Sopenharmony_ci		 sure, this is probably what you want.
116262306a36Sopenharmony_ci
116362306a36Sopenharmony_ci	manual	 The device is started only when ifup is called
116462306a36Sopenharmony_ci		 manually.  Bonding devices may be configured this
116562306a36Sopenharmony_ci		 way if you do not wish them to start automatically
116662306a36Sopenharmony_ci		 at boot for some reason.
116762306a36Sopenharmony_ci
116862306a36Sopenharmony_ci	hotplug  The device is started by a hotplug event.  This is not
116962306a36Sopenharmony_ci		 a valid choice for a bonding device.
117062306a36Sopenharmony_ci
117162306a36Sopenharmony_ci	off or   The device configuration is ignored.
117262306a36Sopenharmony_ci	ignore
117362306a36Sopenharmony_ci	======== ======================================================
117462306a36Sopenharmony_ci
117562306a36Sopenharmony_ciThe line BONDING_MASTER='yes' indicates that the device is a
117662306a36Sopenharmony_cibonding master device.  The only useful value is "yes."
117762306a36Sopenharmony_ci
117862306a36Sopenharmony_ciThe contents of BONDING_MODULE_OPTS are supplied to the
117962306a36Sopenharmony_ciinstance of the bonding module for this device.  Specify the options
118062306a36Sopenharmony_cifor the bonding mode, link monitoring, and so on here.  Do not include
118162306a36Sopenharmony_cithe max_bonds bonding parameter; this will confuse the configuration
118262306a36Sopenharmony_cisystem if you have multiple bonding devices.
118362306a36Sopenharmony_ci
118462306a36Sopenharmony_ciFinally, supply one BONDING_SLAVEn="slave device" for each
118562306a36Sopenharmony_cislave.  where "n" is an increasing value, one for each slave.  The
118662306a36Sopenharmony_ci"slave device" is either an interface name, e.g., "eth0", or a device
118762306a36Sopenharmony_cispecifier for the network device.  The interface name is easier to
118862306a36Sopenharmony_cifind, but the ethN names are subject to change at boot time if, e.g.,
118962306a36Sopenharmony_cia device early in the sequence has failed.  The device specifiers
119062306a36Sopenharmony_ci(bus-pci-0000:06:08.1 in the example above) specify the physical
119162306a36Sopenharmony_cinetwork device, and will not change unless the device's bus location
119262306a36Sopenharmony_cichanges (for example, it is moved from one PCI slot to another).  The
119362306a36Sopenharmony_ciexample above uses one of each type for demonstration purposes; most
119462306a36Sopenharmony_ciconfigurations will choose one or the other for all slave devices.
119562306a36Sopenharmony_ci
119662306a36Sopenharmony_ciWhen all configuration files have been modified or created,
119762306a36Sopenharmony_cinetworking must be restarted for the configuration changes to take
119862306a36Sopenharmony_cieffect.  This can be accomplished via the following::
119962306a36Sopenharmony_ci
120062306a36Sopenharmony_ci	# /etc/init.d/network restart
120162306a36Sopenharmony_ci
120262306a36Sopenharmony_ciNote that the network control script (/sbin/ifdown) will
120362306a36Sopenharmony_ciremove the bonding module as part of the network shutdown processing,
120462306a36Sopenharmony_ciso it is not necessary to remove the module by hand if, e.g., the
120562306a36Sopenharmony_cimodule parameters have changed.
120662306a36Sopenharmony_ci
120762306a36Sopenharmony_ciAlso, at this writing, YaST/YaST2 will not manage bonding
120862306a36Sopenharmony_cidevices (they do not show bonding interfaces on its list of network
120962306a36Sopenharmony_cidevices).  It is necessary to edit the configuration file by hand to
121062306a36Sopenharmony_cichange the bonding configuration.
121162306a36Sopenharmony_ci
121262306a36Sopenharmony_ciAdditional general options and details of the ifcfg file
121362306a36Sopenharmony_ciformat can be found in an example ifcfg template file::
121462306a36Sopenharmony_ci
121562306a36Sopenharmony_ci	/etc/sysconfig/network/ifcfg.template
121662306a36Sopenharmony_ci
121762306a36Sopenharmony_ciNote that the template does not document the various ``BONDING_*``
121862306a36Sopenharmony_cisettings described above, but does describe many of the other options.
121962306a36Sopenharmony_ci
122062306a36Sopenharmony_ci3.1.1 Using DHCP with Sysconfig
122162306a36Sopenharmony_ci-------------------------------
122262306a36Sopenharmony_ci
122362306a36Sopenharmony_ciUnder sysconfig, configuring a device with BOOTPROTO='dhcp'
122462306a36Sopenharmony_ciwill cause it to query DHCP for its IP address information.  At this
122562306a36Sopenharmony_ciwriting, this does not function for bonding devices; the scripts
122662306a36Sopenharmony_ciattempt to obtain the device address from DHCP prior to adding any of
122762306a36Sopenharmony_cithe slave devices.  Without active slaves, the DHCP requests are not
122862306a36Sopenharmony_cisent to the network.
122962306a36Sopenharmony_ci
123062306a36Sopenharmony_ci3.1.2 Configuring Multiple Bonds with Sysconfig
123162306a36Sopenharmony_ci-----------------------------------------------
123262306a36Sopenharmony_ci
123362306a36Sopenharmony_ciThe sysconfig network initialization system is capable of
123462306a36Sopenharmony_cihandling multiple bonding devices.  All that is necessary is for each
123562306a36Sopenharmony_cibonding instance to have an appropriately configured ifcfg-bondX file
123662306a36Sopenharmony_ci(as described above).  Do not specify the "max_bonds" parameter to any
123762306a36Sopenharmony_ciinstance of bonding, as this will confuse sysconfig.  If you require
123862306a36Sopenharmony_cimultiple bonding devices with identical parameters, create multiple
123962306a36Sopenharmony_ciifcfg-bondX files.
124062306a36Sopenharmony_ci
124162306a36Sopenharmony_ciBecause the sysconfig scripts supply the bonding module
124262306a36Sopenharmony_cioptions in the ifcfg-bondX file, it is not necessary to add them to
124362306a36Sopenharmony_cithe system ``/etc/modules.d/*.conf`` configuration files.
124462306a36Sopenharmony_ci
124562306a36Sopenharmony_ci3.2 Configuration with Initscripts Support
124662306a36Sopenharmony_ci------------------------------------------
124762306a36Sopenharmony_ci
124862306a36Sopenharmony_ciThis section applies to distros using a recent version of
124962306a36Sopenharmony_ciinitscripts with bonding support, for example, Red Hat Enterprise Linux
125062306a36Sopenharmony_civersion 3 or later, Fedora, etc.  On these systems, the network
125162306a36Sopenharmony_ciinitialization scripts have knowledge of bonding, and can be configured to
125262306a36Sopenharmony_cicontrol bonding devices.  Note that older versions of the initscripts
125362306a36Sopenharmony_cipackage have lower levels of support for bonding; this will be noted where
125462306a36Sopenharmony_ciapplicable.
125562306a36Sopenharmony_ci
125662306a36Sopenharmony_ciThese distros will not automatically load the network adapter
125762306a36Sopenharmony_cidriver unless the ethX device is configured with an IP address.
125862306a36Sopenharmony_ciBecause of this constraint, users must manually configure a
125962306a36Sopenharmony_cinetwork-script file for all physical adapters that will be members of
126062306a36Sopenharmony_cia bondX link.  Network script files are located in the directory:
126162306a36Sopenharmony_ci
126262306a36Sopenharmony_ci/etc/sysconfig/network-scripts
126362306a36Sopenharmony_ci
126462306a36Sopenharmony_ciThe file name must be prefixed with "ifcfg-eth" and suffixed
126562306a36Sopenharmony_ciwith the adapter's physical adapter number.  For example, the script
126662306a36Sopenharmony_cifor eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.
126762306a36Sopenharmony_ciPlace the following text in the file::
126862306a36Sopenharmony_ci
126962306a36Sopenharmony_ci	DEVICE=eth0
127062306a36Sopenharmony_ci	USERCTL=no
127162306a36Sopenharmony_ci	ONBOOT=yes
127262306a36Sopenharmony_ci	MASTER=bond0
127362306a36Sopenharmony_ci	SLAVE=yes
127462306a36Sopenharmony_ci	BOOTPROTO=none
127562306a36Sopenharmony_ci
127662306a36Sopenharmony_ciThe DEVICE= line will be different for every ethX device and
127762306a36Sopenharmony_cimust correspond with the name of the file, i.e., ifcfg-eth1 must have
127862306a36Sopenharmony_cia device line of DEVICE=eth1.  The setting of the MASTER= line will
127962306a36Sopenharmony_cialso depend on the final bonding interface name chosen for your bond.
128062306a36Sopenharmony_ciAs with other network devices, these typically start at 0, and go up
128162306a36Sopenharmony_cione for each device, i.e., the first bonding instance is bond0, the
128262306a36Sopenharmony_cisecond is bond1, and so on.
128362306a36Sopenharmony_ci
128462306a36Sopenharmony_ciNext, create a bond network script.  The file name for this
128562306a36Sopenharmony_ciscript will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is
128662306a36Sopenharmony_cithe number of the bond.  For bond0 the file is named "ifcfg-bond0",
128762306a36Sopenharmony_cifor bond1 it is named "ifcfg-bond1", and so on.  Within that file,
128862306a36Sopenharmony_ciplace the following text::
128962306a36Sopenharmony_ci
129062306a36Sopenharmony_ci	DEVICE=bond0
129162306a36Sopenharmony_ci	IPADDR=192.168.1.1
129262306a36Sopenharmony_ci	NETMASK=255.255.255.0
129362306a36Sopenharmony_ci	NETWORK=192.168.1.0
129462306a36Sopenharmony_ci	BROADCAST=192.168.1.255
129562306a36Sopenharmony_ci	ONBOOT=yes
129662306a36Sopenharmony_ci	BOOTPROTO=none
129762306a36Sopenharmony_ci	USERCTL=no
129862306a36Sopenharmony_ci
129962306a36Sopenharmony_ciBe sure to change the networking specific lines (IPADDR,
130062306a36Sopenharmony_ciNETMASK, NETWORK and BROADCAST) to match your network configuration.
130162306a36Sopenharmony_ci
130262306a36Sopenharmony_ciFor later versions of initscripts, such as that found with Fedora
130362306a36Sopenharmony_ci7 (or later) and Red Hat Enterprise Linux version 5 (or later), it is possible,
130462306a36Sopenharmony_ciand, indeed, preferable, to specify the bonding options in the ifcfg-bond0
130562306a36Sopenharmony_cifile, e.g. a line of the format::
130662306a36Sopenharmony_ci
130762306a36Sopenharmony_ci  BONDING_OPTS="mode=active-backup arp_interval=60 arp_ip_target=192.168.1.254"
130862306a36Sopenharmony_ci
130962306a36Sopenharmony_ciwill configure the bond with the specified options.  The options
131062306a36Sopenharmony_cispecified in BONDING_OPTS are identical to the bonding module parameters
131162306a36Sopenharmony_ciexcept for the arp_ip_target field when using versions of initscripts older
131262306a36Sopenharmony_cithan and 8.57 (Fedora 8) and 8.45.19 (Red Hat Enterprise Linux 5.2).  When
131362306a36Sopenharmony_ciusing older versions each target should be included as a separate option and
131462306a36Sopenharmony_cishould be preceded by a '+' to indicate it should be added to the list of
131562306a36Sopenharmony_ciqueried targets, e.g.,::
131662306a36Sopenharmony_ci
131762306a36Sopenharmony_ci    arp_ip_target=+192.168.1.1 arp_ip_target=+192.168.1.2
131862306a36Sopenharmony_ci
131962306a36Sopenharmony_ciis the proper syntax to specify multiple targets.  When specifying
132062306a36Sopenharmony_cioptions via BONDING_OPTS, it is not necessary to edit
132162306a36Sopenharmony_ci``/etc/modprobe.d/*.conf``.
132262306a36Sopenharmony_ci
132362306a36Sopenharmony_ciFor even older versions of initscripts that do not support
132462306a36Sopenharmony_ciBONDING_OPTS, it is necessary to edit /etc/modprobe.d/*.conf, depending upon
132562306a36Sopenharmony_ciyour distro) to load the bonding module with your desired options when the
132662306a36Sopenharmony_cibond0 interface is brought up.  The following lines in /etc/modprobe.d/*.conf
132762306a36Sopenharmony_ciwill load the bonding module, and select its options:
132862306a36Sopenharmony_ci
132962306a36Sopenharmony_ci	alias bond0 bonding
133062306a36Sopenharmony_ci	options bond0 mode=balance-alb miimon=100
133162306a36Sopenharmony_ci
133262306a36Sopenharmony_ciReplace the sample parameters with the appropriate set of
133362306a36Sopenharmony_cioptions for your configuration.
133462306a36Sopenharmony_ci
133562306a36Sopenharmony_ciFinally run "/etc/rc.d/init.d/network restart" as root.  This
133662306a36Sopenharmony_ciwill restart the networking subsystem and your bond link should be now
133762306a36Sopenharmony_ciup and running.
133862306a36Sopenharmony_ci
133962306a36Sopenharmony_ci3.2.1 Using DHCP with Initscripts
134062306a36Sopenharmony_ci---------------------------------
134162306a36Sopenharmony_ci
134262306a36Sopenharmony_ciRecent versions of initscripts (the versions supplied with Fedora
134362306a36Sopenharmony_ciCore 3 and Red Hat Enterprise Linux 4, or later versions, are reported to
134462306a36Sopenharmony_ciwork) have support for assigning IP information to bonding devices via
134562306a36Sopenharmony_ciDHCP.
134662306a36Sopenharmony_ci
134762306a36Sopenharmony_ciTo configure bonding for DHCP, configure it as described
134862306a36Sopenharmony_ciabove, except replace the line "BOOTPROTO=none" with "BOOTPROTO=dhcp"
134962306a36Sopenharmony_ciand add a line consisting of "TYPE=Bonding".  Note that the TYPE value
135062306a36Sopenharmony_ciis case sensitive.
135162306a36Sopenharmony_ci
135262306a36Sopenharmony_ci3.2.2 Configuring Multiple Bonds with Initscripts
135362306a36Sopenharmony_ci-------------------------------------------------
135462306a36Sopenharmony_ci
135562306a36Sopenharmony_ciInitscripts packages that are included with Fedora 7 and Red Hat
135662306a36Sopenharmony_ciEnterprise Linux 5 support multiple bonding interfaces by simply
135762306a36Sopenharmony_cispecifying the appropriate BONDING_OPTS= in ifcfg-bondX where X is the
135862306a36Sopenharmony_cinumber of the bond.  This support requires sysfs support in the kernel,
135962306a36Sopenharmony_ciand a bonding driver of version 3.0.0 or later.  Other configurations may
136062306a36Sopenharmony_cinot support this method for specifying multiple bonding interfaces; for
136162306a36Sopenharmony_cithose instances, see the "Configuring Multiple Bonds Manually" section,
136262306a36Sopenharmony_cibelow.
136362306a36Sopenharmony_ci
136462306a36Sopenharmony_ci3.3 Configuring Bonding Manually with iproute2
136562306a36Sopenharmony_ci-----------------------------------------------
136662306a36Sopenharmony_ci
136762306a36Sopenharmony_ciThis section applies to distros whose network initialization
136862306a36Sopenharmony_ciscripts (the sysconfig or initscripts package) do not have specific
136962306a36Sopenharmony_ciknowledge of bonding.  One such distro is SuSE Linux Enterprise Server
137062306a36Sopenharmony_civersion 8.
137162306a36Sopenharmony_ci
137262306a36Sopenharmony_ciThe general method for these systems is to place the bonding
137362306a36Sopenharmony_cimodule parameters into a config file in /etc/modprobe.d/ (as
137462306a36Sopenharmony_ciappropriate for the installed distro), then add modprobe and/or
137562306a36Sopenharmony_ci`ip link` commands to the system's global init script.  The name of
137662306a36Sopenharmony_cithe global init script differs; for sysconfig, it is
137762306a36Sopenharmony_ci/etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
137862306a36Sopenharmony_ci
137962306a36Sopenharmony_ciFor example, if you wanted to make a simple bond of two e100
138062306a36Sopenharmony_cidevices (presumed to be eth0 and eth1), and have it persist across
138162306a36Sopenharmony_cireboots, edit the appropriate file (/etc/init.d/boot.local or
138262306a36Sopenharmony_ci/etc/rc.d/rc.local), and add the following::
138362306a36Sopenharmony_ci
138462306a36Sopenharmony_ci	modprobe bonding mode=balance-alb miimon=100
138562306a36Sopenharmony_ci	modprobe e100
138662306a36Sopenharmony_ci	ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
138762306a36Sopenharmony_ci	ip link set eth0 master bond0
138862306a36Sopenharmony_ci	ip link set eth1 master bond0
138962306a36Sopenharmony_ci
139062306a36Sopenharmony_ciReplace the example bonding module parameters and bond0
139162306a36Sopenharmony_cinetwork configuration (IP address, netmask, etc) with the appropriate
139262306a36Sopenharmony_civalues for your configuration.
139362306a36Sopenharmony_ci
139462306a36Sopenharmony_ciUnfortunately, this method will not provide support for the
139562306a36Sopenharmony_ciifup and ifdown scripts on the bond devices.  To reload the bonding
139662306a36Sopenharmony_ciconfiguration, it is necessary to run the initialization script, e.g.,::
139762306a36Sopenharmony_ci
139862306a36Sopenharmony_ci	# /etc/init.d/boot.local
139962306a36Sopenharmony_ci
140062306a36Sopenharmony_cior::
140162306a36Sopenharmony_ci
140262306a36Sopenharmony_ci	# /etc/rc.d/rc.local
140362306a36Sopenharmony_ci
140462306a36Sopenharmony_ciIt may be desirable in such a case to create a separate script
140562306a36Sopenharmony_ciwhich only initializes the bonding configuration, then call that
140662306a36Sopenharmony_ciseparate script from within boot.local.  This allows for bonding to be
140762306a36Sopenharmony_cienabled without re-running the entire global init script.
140862306a36Sopenharmony_ci
140962306a36Sopenharmony_ciTo shut down the bonding devices, it is necessary to first
141062306a36Sopenharmony_cimark the bonding device itself as being down, then remove the
141162306a36Sopenharmony_ciappropriate device driver modules.  For our example above, you can do
141262306a36Sopenharmony_cithe following::
141362306a36Sopenharmony_ci
141462306a36Sopenharmony_ci	# ifconfig bond0 down
141562306a36Sopenharmony_ci	# rmmod bonding
141662306a36Sopenharmony_ci	# rmmod e100
141762306a36Sopenharmony_ci
141862306a36Sopenharmony_ciAgain, for convenience, it may be desirable to create a script
141962306a36Sopenharmony_ciwith these commands.
142062306a36Sopenharmony_ci
142162306a36Sopenharmony_ci
142262306a36Sopenharmony_ci3.3.1 Configuring Multiple Bonds Manually
142362306a36Sopenharmony_ci-----------------------------------------
142462306a36Sopenharmony_ci
142562306a36Sopenharmony_ciThis section contains information on configuring multiple
142662306a36Sopenharmony_cibonding devices with differing options for those systems whose network
142762306a36Sopenharmony_ciinitialization scripts lack support for configuring multiple bonds.
142862306a36Sopenharmony_ci
142962306a36Sopenharmony_ciIf you require multiple bonding devices, but all with the same
143062306a36Sopenharmony_cioptions, you may wish to use the "max_bonds" module parameter,
143162306a36Sopenharmony_cidocumented above.
143262306a36Sopenharmony_ci
143362306a36Sopenharmony_ciTo create multiple bonding devices with differing options, it is
143462306a36Sopenharmony_cipreferable to use bonding parameters exported by sysfs, documented in the
143562306a36Sopenharmony_cisection below.
143662306a36Sopenharmony_ci
143762306a36Sopenharmony_ciFor versions of bonding without sysfs support, the only means to
143862306a36Sopenharmony_ciprovide multiple instances of bonding with differing options is to load
143962306a36Sopenharmony_cithe bonding driver multiple times.  Note that current versions of the
144062306a36Sopenharmony_cisysconfig network initialization scripts handle this automatically; if
144162306a36Sopenharmony_ciyour distro uses these scripts, no special action is needed.  See the
144262306a36Sopenharmony_cisection Configuring Bonding Devices, above, if you're not sure about your
144362306a36Sopenharmony_cinetwork initialization scripts.
144462306a36Sopenharmony_ci
144562306a36Sopenharmony_ciTo load multiple instances of the module, it is necessary to
144662306a36Sopenharmony_cispecify a different name for each instance (the module loading system
144762306a36Sopenharmony_cirequires that every loaded module, even multiple instances of the same
144862306a36Sopenharmony_cimodule, have a unique name).  This is accomplished by supplying multiple
144962306a36Sopenharmony_cisets of bonding options in ``/etc/modprobe.d/*.conf``, for example::
145062306a36Sopenharmony_ci
145162306a36Sopenharmony_ci	alias bond0 bonding
145262306a36Sopenharmony_ci	options bond0 -o bond0 mode=balance-rr miimon=100
145362306a36Sopenharmony_ci
145462306a36Sopenharmony_ci	alias bond1 bonding
145562306a36Sopenharmony_ci	options bond1 -o bond1 mode=balance-alb miimon=50
145662306a36Sopenharmony_ci
145762306a36Sopenharmony_ciwill load the bonding module two times.  The first instance is
145862306a36Sopenharmony_cinamed "bond0" and creates the bond0 device in balance-rr mode with an
145962306a36Sopenharmony_cimiimon of 100.  The second instance is named "bond1" and creates the
146062306a36Sopenharmony_cibond1 device in balance-alb mode with an miimon of 50.
146162306a36Sopenharmony_ci
146262306a36Sopenharmony_ciIn some circumstances (typically with older distributions),
146362306a36Sopenharmony_cithe above does not work, and the second bonding instance never sees
146462306a36Sopenharmony_ciits options.  In that case, the second options line can be substituted
146562306a36Sopenharmony_cias follows::
146662306a36Sopenharmony_ci
146762306a36Sopenharmony_ci	install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
146862306a36Sopenharmony_ci				     mode=balance-alb miimon=50
146962306a36Sopenharmony_ci
147062306a36Sopenharmony_ciThis may be repeated any number of times, specifying a new and
147162306a36Sopenharmony_ciunique name in place of bond1 for each subsequent instance.
147262306a36Sopenharmony_ci
147362306a36Sopenharmony_ciIt has been observed that some Red Hat supplied kernels are unable
147462306a36Sopenharmony_cito rename modules at load time (the "-o bond1" part).  Attempts to pass
147562306a36Sopenharmony_cithat option to modprobe will produce an "Operation not permitted" error.
147662306a36Sopenharmony_ciThis has been reported on some Fedora Core kernels, and has been seen on
147762306a36Sopenharmony_ciRHEL 4 as well.  On kernels exhibiting this problem, it will be impossible
147862306a36Sopenharmony_cito configure multiple bonds with differing parameters (as they are older
147962306a36Sopenharmony_cikernels, and also lack sysfs support).
148062306a36Sopenharmony_ci
148162306a36Sopenharmony_ci3.4 Configuring Bonding Manually via Sysfs
148262306a36Sopenharmony_ci------------------------------------------
148362306a36Sopenharmony_ci
148462306a36Sopenharmony_ciStarting with version 3.0.0, Channel Bonding may be configured
148562306a36Sopenharmony_civia the sysfs interface.  This interface allows dynamic configuration
148662306a36Sopenharmony_ciof all bonds in the system without unloading the module.  It also
148762306a36Sopenharmony_ciallows for adding and removing bonds at runtime.  Ifenslave is no
148862306a36Sopenharmony_cilonger required, though it is still supported.
148962306a36Sopenharmony_ci
149062306a36Sopenharmony_ciUse of the sysfs interface allows you to use multiple bonds
149162306a36Sopenharmony_ciwith different configurations without having to reload the module.
149262306a36Sopenharmony_ciIt also allows you to use multiple, differently configured bonds when
149362306a36Sopenharmony_cibonding is compiled into the kernel.
149462306a36Sopenharmony_ci
149562306a36Sopenharmony_ciYou must have the sysfs filesystem mounted to configure
149662306a36Sopenharmony_cibonding this way.  The examples in this document assume that you
149762306a36Sopenharmony_ciare using the standard mount point for sysfs, e.g. /sys.  If your
149862306a36Sopenharmony_cisysfs filesystem is mounted elsewhere, you will need to adjust the
149962306a36Sopenharmony_ciexample paths accordingly.
150062306a36Sopenharmony_ci
150162306a36Sopenharmony_ciCreating and Destroying Bonds
150262306a36Sopenharmony_ci-----------------------------
150362306a36Sopenharmony_ciTo add a new bond foo::
150462306a36Sopenharmony_ci
150562306a36Sopenharmony_ci	# echo +foo > /sys/class/net/bonding_masters
150662306a36Sopenharmony_ci
150762306a36Sopenharmony_ciTo remove an existing bond bar::
150862306a36Sopenharmony_ci
150962306a36Sopenharmony_ci	# echo -bar > /sys/class/net/bonding_masters
151062306a36Sopenharmony_ci
151162306a36Sopenharmony_ciTo show all existing bonds::
151262306a36Sopenharmony_ci
151362306a36Sopenharmony_ci	# cat /sys/class/net/bonding_masters
151462306a36Sopenharmony_ci
151562306a36Sopenharmony_ci.. note::
151662306a36Sopenharmony_ci
151762306a36Sopenharmony_ci   due to 4K size limitation of sysfs files, this list may be
151862306a36Sopenharmony_ci   truncated if you have more than a few hundred bonds.  This is unlikely
151962306a36Sopenharmony_ci   to occur under normal operating conditions.
152062306a36Sopenharmony_ci
152162306a36Sopenharmony_ciAdding and Removing Slaves
152262306a36Sopenharmony_ci--------------------------
152362306a36Sopenharmony_ciInterfaces may be enslaved to a bond using the file
152462306a36Sopenharmony_ci/sys/class/net/<bond>/bonding/slaves.  The semantics for this file
152562306a36Sopenharmony_ciare the same as for the bonding_masters file.
152662306a36Sopenharmony_ci
152762306a36Sopenharmony_ciTo enslave interface eth0 to bond bond0::
152862306a36Sopenharmony_ci
152962306a36Sopenharmony_ci	# ifconfig bond0 up
153062306a36Sopenharmony_ci	# echo +eth0 > /sys/class/net/bond0/bonding/slaves
153162306a36Sopenharmony_ci
153262306a36Sopenharmony_ciTo free slave eth0 from bond bond0::
153362306a36Sopenharmony_ci
153462306a36Sopenharmony_ci	# echo -eth0 > /sys/class/net/bond0/bonding/slaves
153562306a36Sopenharmony_ci
153662306a36Sopenharmony_ciWhen an interface is enslaved to a bond, symlinks between the
153762306a36Sopenharmony_citwo are created in the sysfs filesystem.  In this case, you would get
153862306a36Sopenharmony_ci/sys/class/net/bond0/slave_eth0 pointing to /sys/class/net/eth0, and
153962306a36Sopenharmony_ci/sys/class/net/eth0/master pointing to /sys/class/net/bond0.
154062306a36Sopenharmony_ci
154162306a36Sopenharmony_ciThis means that you can tell quickly whether or not an
154262306a36Sopenharmony_ciinterface is enslaved by looking for the master symlink.  Thus:
154362306a36Sopenharmony_ci# echo -eth0 > /sys/class/net/eth0/master/bonding/slaves
154462306a36Sopenharmony_ciwill free eth0 from whatever bond it is enslaved to, regardless of
154562306a36Sopenharmony_cithe name of the bond interface.
154662306a36Sopenharmony_ci
154762306a36Sopenharmony_ciChanging a Bond's Configuration
154862306a36Sopenharmony_ci-------------------------------
154962306a36Sopenharmony_ciEach bond may be configured individually by manipulating the
155062306a36Sopenharmony_cifiles located in /sys/class/net/<bond name>/bonding
155162306a36Sopenharmony_ci
155262306a36Sopenharmony_ciThe names of these files correspond directly with the command-
155362306a36Sopenharmony_ciline parameters described elsewhere in this file, and, with the
155462306a36Sopenharmony_ciexception of arp_ip_target, they accept the same values.  To see the
155562306a36Sopenharmony_cicurrent setting, simply cat the appropriate file.
155662306a36Sopenharmony_ci
155762306a36Sopenharmony_ciA few examples will be given here; for specific usage
155862306a36Sopenharmony_ciguidelines for each parameter, see the appropriate section in this
155962306a36Sopenharmony_cidocument.
156062306a36Sopenharmony_ci
156162306a36Sopenharmony_ciTo configure bond0 for balance-alb mode::
156262306a36Sopenharmony_ci
156362306a36Sopenharmony_ci	# ifconfig bond0 down
156462306a36Sopenharmony_ci	# echo 6 > /sys/class/net/bond0/bonding/mode
156562306a36Sopenharmony_ci	- or -
156662306a36Sopenharmony_ci	# echo balance-alb > /sys/class/net/bond0/bonding/mode
156762306a36Sopenharmony_ci
156862306a36Sopenharmony_ci.. note::
156962306a36Sopenharmony_ci
157062306a36Sopenharmony_ci   The bond interface must be down before the mode can be changed.
157162306a36Sopenharmony_ci
157262306a36Sopenharmony_ciTo enable MII monitoring on bond0 with a 1 second interval::
157362306a36Sopenharmony_ci
157462306a36Sopenharmony_ci	# echo 1000 > /sys/class/net/bond0/bonding/miimon
157562306a36Sopenharmony_ci
157662306a36Sopenharmony_ci.. note::
157762306a36Sopenharmony_ci
157862306a36Sopenharmony_ci   If ARP monitoring is enabled, it will disabled when MII
157962306a36Sopenharmony_ci   monitoring is enabled, and vice-versa.
158062306a36Sopenharmony_ci
158162306a36Sopenharmony_ciTo add ARP targets::
158262306a36Sopenharmony_ci
158362306a36Sopenharmony_ci	# echo +192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
158462306a36Sopenharmony_ci	# echo +192.168.0.101 > /sys/class/net/bond0/bonding/arp_ip_target
158562306a36Sopenharmony_ci
158662306a36Sopenharmony_ci.. note::
158762306a36Sopenharmony_ci
158862306a36Sopenharmony_ci   up to 16 target addresses may be specified.
158962306a36Sopenharmony_ci
159062306a36Sopenharmony_ciTo remove an ARP target::
159162306a36Sopenharmony_ci
159262306a36Sopenharmony_ci	# echo -192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
159362306a36Sopenharmony_ci
159462306a36Sopenharmony_ciTo configure the interval between learning packet transmits::
159562306a36Sopenharmony_ci
159662306a36Sopenharmony_ci	# echo 12 > /sys/class/net/bond0/bonding/lp_interval
159762306a36Sopenharmony_ci
159862306a36Sopenharmony_ci.. note::
159962306a36Sopenharmony_ci
160062306a36Sopenharmony_ci   the lp_interval is the number of seconds between instances where
160162306a36Sopenharmony_ci   the bonding driver sends learning packets to each slaves peer switch.  The
160262306a36Sopenharmony_ci   default interval is 1 second.
160362306a36Sopenharmony_ci
160462306a36Sopenharmony_ciExample Configuration
160562306a36Sopenharmony_ci---------------------
160662306a36Sopenharmony_ciWe begin with the same example that is shown in section 3.3,
160762306a36Sopenharmony_ciexecuted with sysfs, and without using ifenslave.
160862306a36Sopenharmony_ci
160962306a36Sopenharmony_ciTo make a simple bond of two e100 devices (presumed to be eth0
161062306a36Sopenharmony_ciand eth1), and have it persist across reboots, edit the appropriate
161162306a36Sopenharmony_cifile (/etc/init.d/boot.local or /etc/rc.d/rc.local), and add the
161262306a36Sopenharmony_cifollowing::
161362306a36Sopenharmony_ci
161462306a36Sopenharmony_ci	modprobe bonding
161562306a36Sopenharmony_ci	modprobe e100
161662306a36Sopenharmony_ci	echo balance-alb > /sys/class/net/bond0/bonding/mode
161762306a36Sopenharmony_ci	ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
161862306a36Sopenharmony_ci	echo 100 > /sys/class/net/bond0/bonding/miimon
161962306a36Sopenharmony_ci	echo +eth0 > /sys/class/net/bond0/bonding/slaves
162062306a36Sopenharmony_ci	echo +eth1 > /sys/class/net/bond0/bonding/slaves
162162306a36Sopenharmony_ci
162262306a36Sopenharmony_ciTo add a second bond, with two e1000 interfaces in
162362306a36Sopenharmony_ciactive-backup mode, using ARP monitoring, add the following lines to
162462306a36Sopenharmony_ciyour init script::
162562306a36Sopenharmony_ci
162662306a36Sopenharmony_ci	modprobe e1000
162762306a36Sopenharmony_ci	echo +bond1 > /sys/class/net/bonding_masters
162862306a36Sopenharmony_ci	echo active-backup > /sys/class/net/bond1/bonding/mode
162962306a36Sopenharmony_ci	ifconfig bond1 192.168.2.1 netmask 255.255.255.0 up
163062306a36Sopenharmony_ci	echo +192.168.2.100 /sys/class/net/bond1/bonding/arp_ip_target
163162306a36Sopenharmony_ci	echo 2000 > /sys/class/net/bond1/bonding/arp_interval
163262306a36Sopenharmony_ci	echo +eth2 > /sys/class/net/bond1/bonding/slaves
163362306a36Sopenharmony_ci	echo +eth3 > /sys/class/net/bond1/bonding/slaves
163462306a36Sopenharmony_ci
163562306a36Sopenharmony_ci3.5 Configuration with Interfaces Support
163662306a36Sopenharmony_ci-----------------------------------------
163762306a36Sopenharmony_ci
163862306a36Sopenharmony_ciThis section applies to distros which use /etc/network/interfaces file
163962306a36Sopenharmony_cito describe network interface configuration, most notably Debian and its
164062306a36Sopenharmony_ciderivatives.
164162306a36Sopenharmony_ci
164262306a36Sopenharmony_ciThe ifup and ifdown commands on Debian don't support bonding out of
164362306a36Sopenharmony_cithe box. The ifenslave-2.6 package should be installed to provide bonding
164462306a36Sopenharmony_cisupport.  Once installed, this package will provide ``bond-*`` options
164562306a36Sopenharmony_cito be used into /etc/network/interfaces.
164662306a36Sopenharmony_ci
164762306a36Sopenharmony_ciNote that ifenslave-2.6 package will load the bonding module and use
164862306a36Sopenharmony_cithe ifenslave command when appropriate.
164962306a36Sopenharmony_ci
165062306a36Sopenharmony_ciExample Configurations
165162306a36Sopenharmony_ci----------------------
165262306a36Sopenharmony_ci
165362306a36Sopenharmony_ciIn /etc/network/interfaces, the following stanza will configure bond0, in
165462306a36Sopenharmony_ciactive-backup mode, with eth0 and eth1 as slaves::
165562306a36Sopenharmony_ci
165662306a36Sopenharmony_ci	auto bond0
165762306a36Sopenharmony_ci	iface bond0 inet dhcp
165862306a36Sopenharmony_ci		bond-slaves eth0 eth1
165962306a36Sopenharmony_ci		bond-mode active-backup
166062306a36Sopenharmony_ci		bond-miimon 100
166162306a36Sopenharmony_ci		bond-primary eth0 eth1
166262306a36Sopenharmony_ci
166362306a36Sopenharmony_ciIf the above configuration doesn't work, you might have a system using
166462306a36Sopenharmony_ciupstart for system startup. This is most notably true for recent
166562306a36Sopenharmony_ciUbuntu versions. The following stanza in /etc/network/interfaces will
166662306a36Sopenharmony_ciproduce the same result on those systems::
166762306a36Sopenharmony_ci
166862306a36Sopenharmony_ci	auto bond0
166962306a36Sopenharmony_ci	iface bond0 inet dhcp
167062306a36Sopenharmony_ci		bond-slaves none
167162306a36Sopenharmony_ci		bond-mode active-backup
167262306a36Sopenharmony_ci		bond-miimon 100
167362306a36Sopenharmony_ci
167462306a36Sopenharmony_ci	auto eth0
167562306a36Sopenharmony_ci	iface eth0 inet manual
167662306a36Sopenharmony_ci		bond-master bond0
167762306a36Sopenharmony_ci		bond-primary eth0 eth1
167862306a36Sopenharmony_ci
167962306a36Sopenharmony_ci	auto eth1
168062306a36Sopenharmony_ci	iface eth1 inet manual
168162306a36Sopenharmony_ci		bond-master bond0
168262306a36Sopenharmony_ci		bond-primary eth0 eth1
168362306a36Sopenharmony_ci
168462306a36Sopenharmony_ciFor a full list of ``bond-*`` supported options in /etc/network/interfaces and
168562306a36Sopenharmony_cisome more advanced examples tailored to you particular distros, see the files in
168662306a36Sopenharmony_ci/usr/share/doc/ifenslave-2.6.
168762306a36Sopenharmony_ci
168862306a36Sopenharmony_ci3.6 Overriding Configuration for Special Cases
168962306a36Sopenharmony_ci----------------------------------------------
169062306a36Sopenharmony_ci
169162306a36Sopenharmony_ciWhen using the bonding driver, the physical port which transmits a frame is
169262306a36Sopenharmony_citypically selected by the bonding driver, and is not relevant to the user or
169362306a36Sopenharmony_cisystem administrator.  The output port is simply selected using the policies of
169462306a36Sopenharmony_cithe selected bonding mode.  On occasion however, it is helpful to direct certain
169562306a36Sopenharmony_ciclasses of traffic to certain physical interfaces on output to implement
169662306a36Sopenharmony_cislightly more complex policies.  For example, to reach a web server over a
169762306a36Sopenharmony_cibonded interface in which eth0 connects to a private network, while eth1
169862306a36Sopenharmony_ciconnects via a public network, it may be desirous to bias the bond to send said
169962306a36Sopenharmony_citraffic over eth0 first, using eth1 only as a fall back, while all other traffic
170062306a36Sopenharmony_cican safely be sent over either interface.  Such configurations may be achieved
170162306a36Sopenharmony_ciusing the traffic control utilities inherent in linux.
170262306a36Sopenharmony_ci
170362306a36Sopenharmony_ciBy default the bonding driver is multiqueue aware and 16 queues are created
170462306a36Sopenharmony_ciwhen the driver initializes (see Documentation/networking/multiqueue.rst
170562306a36Sopenharmony_cifor details).  If more or less queues are desired the module parameter
170662306a36Sopenharmony_citx_queues can be used to change this value.  There is no sysfs parameter
170762306a36Sopenharmony_ciavailable as the allocation is done at module init time.
170862306a36Sopenharmony_ci
170962306a36Sopenharmony_ciThe output of the file /proc/net/bonding/bondX has changed so the output Queue
171062306a36Sopenharmony_ciID is now printed for each slave::
171162306a36Sopenharmony_ci
171262306a36Sopenharmony_ci	Bonding Mode: fault-tolerance (active-backup)
171362306a36Sopenharmony_ci	Primary Slave: None
171462306a36Sopenharmony_ci	Currently Active Slave: eth0
171562306a36Sopenharmony_ci	MII Status: up
171662306a36Sopenharmony_ci	MII Polling Interval (ms): 0
171762306a36Sopenharmony_ci	Up Delay (ms): 0
171862306a36Sopenharmony_ci	Down Delay (ms): 0
171962306a36Sopenharmony_ci
172062306a36Sopenharmony_ci	Slave Interface: eth0
172162306a36Sopenharmony_ci	MII Status: up
172262306a36Sopenharmony_ci	Link Failure Count: 0
172362306a36Sopenharmony_ci	Permanent HW addr: 00:1a:a0:12:8f:cb
172462306a36Sopenharmony_ci	Slave queue ID: 0
172562306a36Sopenharmony_ci
172662306a36Sopenharmony_ci	Slave Interface: eth1
172762306a36Sopenharmony_ci	MII Status: up
172862306a36Sopenharmony_ci	Link Failure Count: 0
172962306a36Sopenharmony_ci	Permanent HW addr: 00:1a:a0:12:8f:cc
173062306a36Sopenharmony_ci	Slave queue ID: 2
173162306a36Sopenharmony_ci
173262306a36Sopenharmony_ciThe queue_id for a slave can be set using the command::
173362306a36Sopenharmony_ci
173462306a36Sopenharmony_ci	# echo "eth1:2" > /sys/class/net/bond0/bonding/queue_id
173562306a36Sopenharmony_ci
173662306a36Sopenharmony_ciAny interface that needs a queue_id set should set it with multiple calls
173762306a36Sopenharmony_cilike the one above until proper priorities are set for all interfaces.  On
173862306a36Sopenharmony_cidistributions that allow configuration via initscripts, multiple 'queue_id'
173962306a36Sopenharmony_ciarguments can be added to BONDING_OPTS to set all needed slave queues.
174062306a36Sopenharmony_ci
174162306a36Sopenharmony_ciThese queue id's can be used in conjunction with the tc utility to configure
174262306a36Sopenharmony_cia multiqueue qdisc and filters to bias certain traffic to transmit on certain
174362306a36Sopenharmony_cislave devices.  For instance, say we wanted, in the above configuration to
174462306a36Sopenharmony_ciforce all traffic bound to 192.168.1.100 to use eth1 in the bond as its output
174562306a36Sopenharmony_cidevice. The following commands would accomplish this::
174662306a36Sopenharmony_ci
174762306a36Sopenharmony_ci	# tc qdisc add dev bond0 handle 1 root multiq
174862306a36Sopenharmony_ci
174962306a36Sopenharmony_ci	# tc filter add dev bond0 protocol ip parent 1: prio 1 u32 match ip \
175062306a36Sopenharmony_ci		dst 192.168.1.100 action skbedit queue_mapping 2
175162306a36Sopenharmony_ci
175262306a36Sopenharmony_ciThese commands tell the kernel to attach a multiqueue queue discipline to the
175362306a36Sopenharmony_cibond0 interface and filter traffic enqueued to it, such that packets with a dst
175462306a36Sopenharmony_ciip of 192.168.1.100 have their output queue mapping value overwritten to 2.
175562306a36Sopenharmony_ciThis value is then passed into the driver, causing the normal output path
175662306a36Sopenharmony_ciselection policy to be overridden, selecting instead qid 2, which maps to eth1.
175762306a36Sopenharmony_ci
175862306a36Sopenharmony_ciNote that qid values begin at 1.  Qid 0 is reserved to initiate to the driver
175962306a36Sopenharmony_cithat normal output policy selection should take place.  One benefit to simply
176062306a36Sopenharmony_cileaving the qid for a slave to 0 is the multiqueue awareness in the bonding
176162306a36Sopenharmony_cidriver that is now present.  This awareness allows tc filters to be placed on
176262306a36Sopenharmony_cislave devices as well as bond devices and the bonding driver will simply act as
176362306a36Sopenharmony_cia pass-through for selecting output queues on the slave device rather than
176462306a36Sopenharmony_cioutput port selection.
176562306a36Sopenharmony_ci
176662306a36Sopenharmony_ciThis feature first appeared in bonding driver version 3.7.0 and support for
176762306a36Sopenharmony_cioutput slave selection was limited to round-robin and active-backup modes.
176862306a36Sopenharmony_ci
176962306a36Sopenharmony_ci3.7 Configuring LACP for 802.3ad mode in a more secure way
177062306a36Sopenharmony_ci----------------------------------------------------------
177162306a36Sopenharmony_ci
177262306a36Sopenharmony_ciWhen using 802.3ad bonding mode, the Actor (host) and Partner (switch)
177362306a36Sopenharmony_ciexchange LACPDUs.  These LACPDUs cannot be sniffed, because they are
177462306a36Sopenharmony_cidestined to link local mac addresses (which switches/bridges are not
177562306a36Sopenharmony_cisupposed to forward).  However, most of the values are easily predictable
177662306a36Sopenharmony_cior are simply the machine's MAC address (which is trivially known to all
177762306a36Sopenharmony_ciother hosts in the same L2).  This implies that other machines in the L2
177862306a36Sopenharmony_cidomain can spoof LACPDU packets from other hosts to the switch and potentially
177962306a36Sopenharmony_cicause mayhem by joining (from the point of view of the switch) another
178062306a36Sopenharmony_cimachine's aggregate, thus receiving a portion of that hosts incoming
178162306a36Sopenharmony_citraffic and / or spoofing traffic from that machine themselves (potentially
178262306a36Sopenharmony_cieven successfully terminating some portion of flows). Though this is not
178362306a36Sopenharmony_cia likely scenario, one could avoid this possibility by simply configuring
178462306a36Sopenharmony_cifew bonding parameters:
178562306a36Sopenharmony_ci
178662306a36Sopenharmony_ci   (a) ad_actor_system : You can set a random mac-address that can be used for
178762306a36Sopenharmony_ci       these LACPDU exchanges. The value can not be either NULL or Multicast.
178862306a36Sopenharmony_ci       Also it's preferable to set the local-admin bit. Following shell code
178962306a36Sopenharmony_ci       generates a random mac-address as described above::
179062306a36Sopenharmony_ci
179162306a36Sopenharmony_ci	      # sys_mac_addr=$(printf '%02x:%02x:%02x:%02x:%02x:%02x' \
179262306a36Sopenharmony_ci				       $(( (RANDOM & 0xFE) | 0x02 )) \
179362306a36Sopenharmony_ci				       $(( RANDOM & 0xFF )) \
179462306a36Sopenharmony_ci				       $(( RANDOM & 0xFF )) \
179562306a36Sopenharmony_ci				       $(( RANDOM & 0xFF )) \
179662306a36Sopenharmony_ci				       $(( RANDOM & 0xFF )) \
179762306a36Sopenharmony_ci				       $(( RANDOM & 0xFF )))
179862306a36Sopenharmony_ci	      # echo $sys_mac_addr > /sys/class/net/bond0/bonding/ad_actor_system
179962306a36Sopenharmony_ci
180062306a36Sopenharmony_ci   (b) ad_actor_sys_prio : Randomize the system priority. The default value
180162306a36Sopenharmony_ci       is 65535, but system can take the value from 1 - 65535. Following shell
180262306a36Sopenharmony_ci       code generates random priority and sets it::
180362306a36Sopenharmony_ci
180462306a36Sopenharmony_ci	    # sys_prio=$(( 1 + RANDOM + RANDOM ))
180562306a36Sopenharmony_ci	    # echo $sys_prio > /sys/class/net/bond0/bonding/ad_actor_sys_prio
180662306a36Sopenharmony_ci
180762306a36Sopenharmony_ci   (c) ad_user_port_key : Use the user portion of the port-key. The default
180862306a36Sopenharmony_ci       keeps this empty. These are the upper 10 bits of the port-key and value
180962306a36Sopenharmony_ci       ranges from 0 - 1023. Following shell code generates these 10 bits and
181062306a36Sopenharmony_ci       sets it::
181162306a36Sopenharmony_ci
181262306a36Sopenharmony_ci	    # usr_port_key=$(( RANDOM & 0x3FF ))
181362306a36Sopenharmony_ci	    # echo $usr_port_key > /sys/class/net/bond0/bonding/ad_user_port_key
181462306a36Sopenharmony_ci
181562306a36Sopenharmony_ci
181662306a36Sopenharmony_ci4 Querying Bonding Configuration
181762306a36Sopenharmony_ci=================================
181862306a36Sopenharmony_ci
181962306a36Sopenharmony_ci4.1 Bonding Configuration
182062306a36Sopenharmony_ci-------------------------
182162306a36Sopenharmony_ci
182262306a36Sopenharmony_ciEach bonding device has a read-only file residing in the
182362306a36Sopenharmony_ci/proc/net/bonding directory.  The file contents include information
182462306a36Sopenharmony_ciabout the bonding configuration, options and state of each slave.
182562306a36Sopenharmony_ci
182662306a36Sopenharmony_ciFor example, the contents of /proc/net/bonding/bond0 after the
182762306a36Sopenharmony_cidriver is loaded with parameters of mode=0 and miimon=1000 is
182862306a36Sopenharmony_cigenerally as follows::
182962306a36Sopenharmony_ci
183062306a36Sopenharmony_ci	Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
183162306a36Sopenharmony_ci	Bonding Mode: load balancing (round-robin)
183262306a36Sopenharmony_ci	Currently Active Slave: eth0
183362306a36Sopenharmony_ci	MII Status: up
183462306a36Sopenharmony_ci	MII Polling Interval (ms): 1000
183562306a36Sopenharmony_ci	Up Delay (ms): 0
183662306a36Sopenharmony_ci	Down Delay (ms): 0
183762306a36Sopenharmony_ci
183862306a36Sopenharmony_ci	Slave Interface: eth1
183962306a36Sopenharmony_ci	MII Status: up
184062306a36Sopenharmony_ci	Link Failure Count: 1
184162306a36Sopenharmony_ci
184262306a36Sopenharmony_ci	Slave Interface: eth0
184362306a36Sopenharmony_ci	MII Status: up
184462306a36Sopenharmony_ci	Link Failure Count: 1
184562306a36Sopenharmony_ci
184662306a36Sopenharmony_ciThe precise format and contents will change depending upon the
184762306a36Sopenharmony_cibonding configuration, state, and version of the bonding driver.
184862306a36Sopenharmony_ci
184962306a36Sopenharmony_ci4.2 Network configuration
185062306a36Sopenharmony_ci-------------------------
185162306a36Sopenharmony_ci
185262306a36Sopenharmony_ciThe network configuration can be inspected using the ifconfig
185362306a36Sopenharmony_cicommand.  Bonding devices will have the MASTER flag set; Bonding slave
185462306a36Sopenharmony_cidevices will have the SLAVE flag set.  The ifconfig output does not
185562306a36Sopenharmony_cicontain information on which slaves are associated with which masters.
185662306a36Sopenharmony_ci
185762306a36Sopenharmony_ciIn the example below, the bond0 interface is the master
185862306a36Sopenharmony_ci(MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of
185962306a36Sopenharmony_cibond0 have the same MAC address (HWaddr) as bond0 for all modes except
186062306a36Sopenharmony_ciTLB and ALB that require a unique MAC address for each slave::
186162306a36Sopenharmony_ci
186262306a36Sopenharmony_ci  # /sbin/ifconfig
186362306a36Sopenharmony_ci  bond0     Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
186462306a36Sopenharmony_ci	    inet addr:XXX.XXX.XXX.YYY  Bcast:XXX.XXX.XXX.255  Mask:255.255.252.0
186562306a36Sopenharmony_ci	    UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
186662306a36Sopenharmony_ci	    RX packets:7224794 errors:0 dropped:0 overruns:0 frame:0
186762306a36Sopenharmony_ci	    TX packets:3286647 errors:1 dropped:0 overruns:1 carrier:0
186862306a36Sopenharmony_ci	    collisions:0 txqueuelen:0
186962306a36Sopenharmony_ci
187062306a36Sopenharmony_ci  eth0      Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
187162306a36Sopenharmony_ci	    UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
187262306a36Sopenharmony_ci	    RX packets:3573025 errors:0 dropped:0 overruns:0 frame:0
187362306a36Sopenharmony_ci	    TX packets:1643167 errors:1 dropped:0 overruns:1 carrier:0
187462306a36Sopenharmony_ci	    collisions:0 txqueuelen:100
187562306a36Sopenharmony_ci	    Interrupt:10 Base address:0x1080
187662306a36Sopenharmony_ci
187762306a36Sopenharmony_ci  eth1      Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
187862306a36Sopenharmony_ci	    UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1
187962306a36Sopenharmony_ci	    RX packets:3651769 errors:0 dropped:0 overruns:0 frame:0
188062306a36Sopenharmony_ci	    TX packets:1643480 errors:0 dropped:0 overruns:0 carrier:0
188162306a36Sopenharmony_ci	    collisions:0 txqueuelen:100
188262306a36Sopenharmony_ci	    Interrupt:9 Base address:0x1400
188362306a36Sopenharmony_ci
188462306a36Sopenharmony_ci5. Switch Configuration
188562306a36Sopenharmony_ci=======================
188662306a36Sopenharmony_ci
188762306a36Sopenharmony_ciFor this section, "switch" refers to whatever system the
188862306a36Sopenharmony_cibonded devices are directly connected to (i.e., where the other end of
188962306a36Sopenharmony_cithe cable plugs into).  This may be an actual dedicated switch device,
189062306a36Sopenharmony_cior it may be another regular system (e.g., another computer running
189162306a36Sopenharmony_ciLinux),
189262306a36Sopenharmony_ci
189362306a36Sopenharmony_ciThe active-backup, balance-tlb and balance-alb modes do not
189462306a36Sopenharmony_cirequire any specific configuration of the switch.
189562306a36Sopenharmony_ci
189662306a36Sopenharmony_ciThe 802.3ad mode requires that the switch have the appropriate
189762306a36Sopenharmony_ciports configured as an 802.3ad aggregation.  The precise method used
189862306a36Sopenharmony_cito configure this varies from switch to switch, but, for example, a
189962306a36Sopenharmony_ciCisco 3550 series switch requires that the appropriate ports first be
190062306a36Sopenharmony_cigrouped together in a single etherchannel instance, then that
190162306a36Sopenharmony_cietherchannel is set to mode "lacp" to enable 802.3ad (instead of
190262306a36Sopenharmony_cistandard EtherChannel).
190362306a36Sopenharmony_ci
190462306a36Sopenharmony_ciThe balance-rr, balance-xor and broadcast modes generally
190562306a36Sopenharmony_cirequire that the switch have the appropriate ports grouped together.
190662306a36Sopenharmony_ciThe nomenclature for such a group differs between switches, it may be
190762306a36Sopenharmony_cicalled an "etherchannel" (as in the Cisco example, above), a "trunk
190862306a36Sopenharmony_cigroup" or some other similar variation.  For these modes, each switch
190962306a36Sopenharmony_ciwill also have its own configuration options for the switch's transmit
191062306a36Sopenharmony_cipolicy to the bond.  Typical choices include XOR of either the MAC or
191162306a36Sopenharmony_ciIP addresses.  The transmit policy of the two peers does not need to
191262306a36Sopenharmony_cimatch.  For these three modes, the bonding mode really selects a
191362306a36Sopenharmony_citransmit policy for an EtherChannel group; all three will interoperate
191462306a36Sopenharmony_ciwith another EtherChannel group.
191562306a36Sopenharmony_ci
191662306a36Sopenharmony_ci
191762306a36Sopenharmony_ci6. 802.1q VLAN Support
191862306a36Sopenharmony_ci======================
191962306a36Sopenharmony_ci
192062306a36Sopenharmony_ciIt is possible to configure VLAN devices over a bond interface
192162306a36Sopenharmony_ciusing the 8021q driver.  However, only packets coming from the 8021q
192262306a36Sopenharmony_cidriver and passing through bonding will be tagged by default.  Self
192362306a36Sopenharmony_cigenerated packets, for example, bonding's learning packets or ARP
192462306a36Sopenharmony_cipackets generated by either ALB mode or the ARP monitor mechanism, are
192562306a36Sopenharmony_citagged internally by bonding itself.  As a result, bonding must
192662306a36Sopenharmony_ci"learn" the VLAN IDs configured above it, and use those IDs to tag
192762306a36Sopenharmony_ciself generated packets.
192862306a36Sopenharmony_ci
192962306a36Sopenharmony_ciFor reasons of simplicity, and to support the use of adapters
193062306a36Sopenharmony_cithat can do VLAN hardware acceleration offloading, the bonding
193162306a36Sopenharmony_ciinterface declares itself as fully hardware offloading capable, it gets
193262306a36Sopenharmony_cithe add_vid/kill_vid notifications to gather the necessary
193362306a36Sopenharmony_ciinformation, and it propagates those actions to the slaves.  In case
193462306a36Sopenharmony_ciof mixed adapter types, hardware accelerated tagged packets that
193562306a36Sopenharmony_cishould go through an adapter that is not offloading capable are
193662306a36Sopenharmony_ci"un-accelerated" by the bonding driver so the VLAN tag sits in the
193762306a36Sopenharmony_ciregular location.
193862306a36Sopenharmony_ci
193962306a36Sopenharmony_ciVLAN interfaces *must* be added on top of a bonding interface
194062306a36Sopenharmony_cionly after enslaving at least one slave.  The bonding interface has a
194162306a36Sopenharmony_cihardware address of 00:00:00:00:00:00 until the first slave is added.
194262306a36Sopenharmony_ciIf the VLAN interface is created prior to the first enslavement, it
194362306a36Sopenharmony_ciwould pick up the all-zeroes hardware address.  Once the first slave
194462306a36Sopenharmony_ciis attached to the bond, the bond device itself will pick up the
194562306a36Sopenharmony_cislave's hardware address, which is then available for the VLAN device.
194662306a36Sopenharmony_ci
194762306a36Sopenharmony_ciAlso, be aware that a similar problem can occur if all slaves
194862306a36Sopenharmony_ciare released from a bond that still has one or more VLAN interfaces on
194962306a36Sopenharmony_citop of it.  When a new slave is added, the bonding interface will
195062306a36Sopenharmony_ciobtain its hardware address from the first slave, which might not
195162306a36Sopenharmony_cimatch the hardware address of the VLAN interfaces (which was
195262306a36Sopenharmony_ciultimately copied from an earlier slave).
195362306a36Sopenharmony_ci
195462306a36Sopenharmony_ciThere are two methods to insure that the VLAN device operates
195562306a36Sopenharmony_ciwith the correct hardware address if all slaves are removed from a
195662306a36Sopenharmony_cibond interface:
195762306a36Sopenharmony_ci
195862306a36Sopenharmony_ci1. Remove all VLAN interfaces then recreate them
195962306a36Sopenharmony_ci
196062306a36Sopenharmony_ci2. Set the bonding interface's hardware address so that it
196162306a36Sopenharmony_cimatches the hardware address of the VLAN interfaces.
196262306a36Sopenharmony_ci
196362306a36Sopenharmony_ciNote that changing a VLAN interface's HW address would set the
196462306a36Sopenharmony_ciunderlying device -- i.e. the bonding interface -- to promiscuous
196562306a36Sopenharmony_cimode, which might not be what you want.
196662306a36Sopenharmony_ci
196762306a36Sopenharmony_ci
196862306a36Sopenharmony_ci7. Link Monitoring
196962306a36Sopenharmony_ci==================
197062306a36Sopenharmony_ci
197162306a36Sopenharmony_ciThe bonding driver at present supports two schemes for
197262306a36Sopenharmony_cimonitoring a slave device's link state: the ARP monitor and the MII
197362306a36Sopenharmony_cimonitor.
197462306a36Sopenharmony_ci
197562306a36Sopenharmony_ciAt the present time, due to implementation restrictions in the
197662306a36Sopenharmony_cibonding driver itself, it is not possible to enable both ARP and MII
197762306a36Sopenharmony_cimonitoring simultaneously.
197862306a36Sopenharmony_ci
197962306a36Sopenharmony_ci7.1 ARP Monitor Operation
198062306a36Sopenharmony_ci-------------------------
198162306a36Sopenharmony_ci
198262306a36Sopenharmony_ciThe ARP monitor operates as its name suggests: it sends ARP
198362306a36Sopenharmony_ciqueries to one or more designated peer systems on the network, and
198462306a36Sopenharmony_ciuses the response as an indication that the link is operating.  This
198562306a36Sopenharmony_cigives some assurance that traffic is actually flowing to and from one
198662306a36Sopenharmony_cior more peers on the local network.
198762306a36Sopenharmony_ci
198862306a36Sopenharmony_ci7.2 Configuring Multiple ARP Targets
198962306a36Sopenharmony_ci------------------------------------
199062306a36Sopenharmony_ci
199162306a36Sopenharmony_ciWhile ARP monitoring can be done with just one target, it can
199262306a36Sopenharmony_cibe useful in a High Availability setup to have several targets to
199362306a36Sopenharmony_cimonitor.  In the case of just one target, the target itself may go
199462306a36Sopenharmony_cidown or have a problem making it unresponsive to ARP requests.  Having
199562306a36Sopenharmony_cian additional target (or several) increases the reliability of the ARP
199662306a36Sopenharmony_cimonitoring.
199762306a36Sopenharmony_ci
199862306a36Sopenharmony_ciMultiple ARP targets must be separated by commas as follows::
199962306a36Sopenharmony_ci
200062306a36Sopenharmony_ci # example options for ARP monitoring with three targets
200162306a36Sopenharmony_ci alias bond0 bonding
200262306a36Sopenharmony_ci options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
200362306a36Sopenharmony_ci
200462306a36Sopenharmony_ciFor just a single target the options would resemble::
200562306a36Sopenharmony_ci
200662306a36Sopenharmony_ci    # example options for ARP monitoring with one target
200762306a36Sopenharmony_ci    alias bond0 bonding
200862306a36Sopenharmony_ci    options bond0 arp_interval=60 arp_ip_target=192.168.0.100
200962306a36Sopenharmony_ci
201062306a36Sopenharmony_ci
201162306a36Sopenharmony_ci7.3 MII Monitor Operation
201262306a36Sopenharmony_ci-------------------------
201362306a36Sopenharmony_ci
201462306a36Sopenharmony_ciThe MII monitor monitors only the carrier state of the local
201562306a36Sopenharmony_cinetwork interface.  It accomplishes this in one of three ways: by
201662306a36Sopenharmony_cidepending upon the device driver to maintain its carrier state, by
201762306a36Sopenharmony_ciquerying the device's MII registers, or by making an ethtool query to
201862306a36Sopenharmony_cithe device.
201962306a36Sopenharmony_ci
202062306a36Sopenharmony_ciIf the use_carrier module parameter is 1 (the default value),
202162306a36Sopenharmony_cithen the MII monitor will rely on the driver for carrier state
202262306a36Sopenharmony_ciinformation (via the netif_carrier subsystem).  As explained in the
202362306a36Sopenharmony_ciuse_carrier parameter information, above, if the MII monitor fails to
202462306a36Sopenharmony_cidetect carrier loss on the device (e.g., when the cable is physically
202562306a36Sopenharmony_cidisconnected), it may be that the driver does not support
202662306a36Sopenharmony_cinetif_carrier.
202762306a36Sopenharmony_ci
202862306a36Sopenharmony_ciIf use_carrier is 0, then the MII monitor will first query the
202962306a36Sopenharmony_cidevice's (via ioctl) MII registers and check the link state.  If that
203062306a36Sopenharmony_cirequest fails (not just that it returns carrier down), then the MII
203162306a36Sopenharmony_cimonitor will make an ethtool ETHTOOL_GLINK request to attempt to obtain
203262306a36Sopenharmony_cithe same information.  If both methods fail (i.e., the driver either
203362306a36Sopenharmony_cidoes not support or had some error in processing both the MII register
203462306a36Sopenharmony_ciand ethtool requests), then the MII monitor will assume the link is
203562306a36Sopenharmony_ciup.
203662306a36Sopenharmony_ci
203762306a36Sopenharmony_ci8. Potential Sources of Trouble
203862306a36Sopenharmony_ci===============================
203962306a36Sopenharmony_ci
204062306a36Sopenharmony_ci8.1 Adventures in Routing
204162306a36Sopenharmony_ci-------------------------
204262306a36Sopenharmony_ci
204362306a36Sopenharmony_ciWhen bonding is configured, it is important that the slave
204462306a36Sopenharmony_cidevices not have routes that supersede routes of the master (or,
204562306a36Sopenharmony_cigenerally, not have routes at all).  For example, suppose the bonding
204662306a36Sopenharmony_cidevice bond0 has two slaves, eth0 and eth1, and the routing table is
204762306a36Sopenharmony_cias follows::
204862306a36Sopenharmony_ci
204962306a36Sopenharmony_ci  Kernel IP routing table
205062306a36Sopenharmony_ci  Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
205162306a36Sopenharmony_ci  10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth0
205262306a36Sopenharmony_ci  10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth1
205362306a36Sopenharmony_ci  10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 bond0
205462306a36Sopenharmony_ci  127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
205562306a36Sopenharmony_ci
205662306a36Sopenharmony_ciThis routing configuration will likely still update the
205762306a36Sopenharmony_cireceive/transmit times in the driver (needed by the ARP monitor), but
205862306a36Sopenharmony_cimay bypass the bonding driver (because outgoing traffic to, in this
205962306a36Sopenharmony_cicase, another host on network 10 would use eth0 or eth1 before bond0).
206062306a36Sopenharmony_ci
206162306a36Sopenharmony_ciThe ARP monitor (and ARP itself) may become confused by this
206262306a36Sopenharmony_ciconfiguration, because ARP requests (generated by the ARP monitor)
206362306a36Sopenharmony_ciwill be sent on one interface (bond0), but the corresponding reply
206462306a36Sopenharmony_ciwill arrive on a different interface (eth0).  This reply looks to ARP
206562306a36Sopenharmony_cias an unsolicited ARP reply (because ARP matches replies on an
206662306a36Sopenharmony_ciinterface basis), and is discarded.  The MII monitor is not affected
206762306a36Sopenharmony_ciby the state of the routing table.
206862306a36Sopenharmony_ci
206962306a36Sopenharmony_ciThe solution here is simply to insure that slaves do not have
207062306a36Sopenharmony_ciroutes of their own, and if for some reason they must, those routes do
207162306a36Sopenharmony_cinot supersede routes of their master.  This should generally be the
207262306a36Sopenharmony_cicase, but unusual configurations or errant manual or automatic static
207362306a36Sopenharmony_ciroute additions may cause trouble.
207462306a36Sopenharmony_ci
207562306a36Sopenharmony_ci8.2 Ethernet Device Renaming
207662306a36Sopenharmony_ci----------------------------
207762306a36Sopenharmony_ci
207862306a36Sopenharmony_ciOn systems with network configuration scripts that do not
207962306a36Sopenharmony_ciassociate physical devices directly with network interface names (so
208062306a36Sopenharmony_cithat the same physical device always has the same "ethX" name), it may
208162306a36Sopenharmony_cibe necessary to add some special logic to config files in
208262306a36Sopenharmony_ci/etc/modprobe.d/.
208362306a36Sopenharmony_ci
208462306a36Sopenharmony_ciFor example, given a modules.conf containing the following::
208562306a36Sopenharmony_ci
208662306a36Sopenharmony_ci	alias bond0 bonding
208762306a36Sopenharmony_ci	options bond0 mode=some-mode miimon=50
208862306a36Sopenharmony_ci	alias eth0 tg3
208962306a36Sopenharmony_ci	alias eth1 tg3
209062306a36Sopenharmony_ci	alias eth2 e1000
209162306a36Sopenharmony_ci	alias eth3 e1000
209262306a36Sopenharmony_ci
209362306a36Sopenharmony_ciIf neither eth0 and eth1 are slaves to bond0, then when the
209462306a36Sopenharmony_cibond0 interface comes up, the devices may end up reordered.  This
209562306a36Sopenharmony_cihappens because bonding is loaded first, then its slave device's
209662306a36Sopenharmony_cidrivers are loaded next.  Since no other drivers have been loaded,
209762306a36Sopenharmony_ciwhen the e1000 driver loads, it will receive eth0 and eth1 for its
209862306a36Sopenharmony_cidevices, but the bonding configuration tries to enslave eth2 and eth3
209962306a36Sopenharmony_ci(which may later be assigned to the tg3 devices).
210062306a36Sopenharmony_ci
210162306a36Sopenharmony_ciAdding the following::
210262306a36Sopenharmony_ci
210362306a36Sopenharmony_ci	add above bonding e1000 tg3
210462306a36Sopenharmony_ci
210562306a36Sopenharmony_cicauses modprobe to load e1000 then tg3, in that order, when
210662306a36Sopenharmony_cibonding is loaded.  This command is fully documented in the
210762306a36Sopenharmony_cimodules.conf manual page.
210862306a36Sopenharmony_ci
210962306a36Sopenharmony_ciOn systems utilizing modprobe an equivalent problem can occur.
211062306a36Sopenharmony_ciIn this case, the following can be added to config files in
211162306a36Sopenharmony_ci/etc/modprobe.d/ as::
211262306a36Sopenharmony_ci
211362306a36Sopenharmony_ci	softdep bonding pre: tg3 e1000
211462306a36Sopenharmony_ci
211562306a36Sopenharmony_ciThis will load tg3 and e1000 modules before loading the bonding one.
211662306a36Sopenharmony_ciFull documentation on this can be found in the modprobe.d and modprobe
211762306a36Sopenharmony_cimanual pages.
211862306a36Sopenharmony_ci
211962306a36Sopenharmony_ci8.3. Painfully Slow Or No Failed Link Detection By Miimon
212062306a36Sopenharmony_ci---------------------------------------------------------
212162306a36Sopenharmony_ci
212262306a36Sopenharmony_ciBy default, bonding enables the use_carrier option, which
212362306a36Sopenharmony_ciinstructs bonding to trust the driver to maintain carrier state.
212462306a36Sopenharmony_ci
212562306a36Sopenharmony_ciAs discussed in the options section, above, some drivers do
212662306a36Sopenharmony_cinot support the netif_carrier_on/_off link state tracking system.
212762306a36Sopenharmony_ciWith use_carrier enabled, bonding will always see these links as up,
212862306a36Sopenharmony_ciregardless of their actual state.
212962306a36Sopenharmony_ci
213062306a36Sopenharmony_ciAdditionally, other drivers do support netif_carrier, but do
213162306a36Sopenharmony_cinot maintain it in real time, e.g., only polling the link state at
213262306a36Sopenharmony_cisome fixed interval.  In this case, miimon will detect failures, but
213362306a36Sopenharmony_cionly after some long period of time has expired.  If it appears that
213462306a36Sopenharmony_cimiimon is very slow in detecting link failures, try specifying
213562306a36Sopenharmony_ciuse_carrier=0 to see if that improves the failure detection time.  If
213662306a36Sopenharmony_ciit does, then it may be that the driver checks the carrier state at a
213762306a36Sopenharmony_cifixed interval, but does not cache the MII register values (so the
213862306a36Sopenharmony_ciuse_carrier=0 method of querying the registers directly works).  If
213962306a36Sopenharmony_ciuse_carrier=0 does not improve the failover, then the driver may cache
214062306a36Sopenharmony_cithe registers, or the problem may be elsewhere.
214162306a36Sopenharmony_ci
214262306a36Sopenharmony_ciAlso, remember that miimon only checks for the device's
214362306a36Sopenharmony_cicarrier state.  It has no way to determine the state of devices on or
214462306a36Sopenharmony_cibeyond other ports of a switch, or if a switch is refusing to pass
214562306a36Sopenharmony_citraffic while still maintaining carrier on.
214662306a36Sopenharmony_ci
214762306a36Sopenharmony_ci9. SNMP agents
214862306a36Sopenharmony_ci===============
214962306a36Sopenharmony_ci
215062306a36Sopenharmony_ciIf running SNMP agents, the bonding driver should be loaded
215162306a36Sopenharmony_cibefore any network drivers participating in a bond.  This requirement
215262306a36Sopenharmony_ciis due to the interface index (ipAdEntIfIndex) being associated to
215362306a36Sopenharmony_cithe first interface found with a given IP address.  That is, there is
215462306a36Sopenharmony_cionly one ipAdEntIfIndex for each IP address.  For example, if eth0 and
215562306a36Sopenharmony_cieth1 are slaves of bond0 and the driver for eth0 is loaded before the
215662306a36Sopenharmony_cibonding driver, the interface for the IP address will be associated
215762306a36Sopenharmony_ciwith the eth0 interface.  This configuration is shown below, the IP
215862306a36Sopenharmony_ciaddress 192.168.1.1 has an interface index of 2 which indexes to eth0
215962306a36Sopenharmony_ciin the ifDescr table (ifDescr.2).
216062306a36Sopenharmony_ci
216162306a36Sopenharmony_ci::
216262306a36Sopenharmony_ci
216362306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.1 = lo
216462306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.2 = eth0
216562306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.3 = eth1
216662306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.4 = eth2
216762306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.5 = eth3
216862306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.6 = bond0
216962306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
217062306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
217162306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
217262306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
217362306a36Sopenharmony_ci
217462306a36Sopenharmony_ciThis problem is avoided by loading the bonding driver before
217562306a36Sopenharmony_ciany network drivers participating in a bond.  Below is an example of
217662306a36Sopenharmony_ciloading the bonding driver first, the IP address 192.168.1.1 is
217762306a36Sopenharmony_cicorrectly associated with ifDescr.2.
217862306a36Sopenharmony_ci
217962306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.1 = lo
218062306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.2 = bond0
218162306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.3 = eth0
218262306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.4 = eth1
218362306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.5 = eth2
218462306a36Sopenharmony_ci     interfaces.ifTable.ifEntry.ifDescr.6 = eth3
218562306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
218662306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
218762306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
218862306a36Sopenharmony_ci     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
218962306a36Sopenharmony_ci
219062306a36Sopenharmony_ciWhile some distributions may not report the interface name in
219162306a36Sopenharmony_ciifDescr, the association between the IP address and IfIndex remains
219262306a36Sopenharmony_ciand SNMP functions such as Interface_Scan_Next will report that
219362306a36Sopenharmony_ciassociation.
219462306a36Sopenharmony_ci
219562306a36Sopenharmony_ci10. Promiscuous mode
219662306a36Sopenharmony_ci====================
219762306a36Sopenharmony_ci
219862306a36Sopenharmony_ciWhen running network monitoring tools, e.g., tcpdump, it is
219962306a36Sopenharmony_cicommon to enable promiscuous mode on the device, so that all traffic
220062306a36Sopenharmony_ciis seen (instead of seeing only traffic destined for the local host).
220162306a36Sopenharmony_ciThe bonding driver handles promiscuous mode changes to the bonding
220262306a36Sopenharmony_cimaster device (e.g., bond0), and propagates the setting to the slave
220362306a36Sopenharmony_cidevices.
220462306a36Sopenharmony_ci
220562306a36Sopenharmony_ciFor the balance-rr, balance-xor, broadcast, and 802.3ad modes,
220662306a36Sopenharmony_cithe promiscuous mode setting is propagated to all slaves.
220762306a36Sopenharmony_ci
220862306a36Sopenharmony_ciFor the active-backup, balance-tlb and balance-alb modes, the
220962306a36Sopenharmony_cipromiscuous mode setting is propagated only to the active slave.
221062306a36Sopenharmony_ci
221162306a36Sopenharmony_ciFor balance-tlb mode, the active slave is the slave currently
221262306a36Sopenharmony_cireceiving inbound traffic.
221362306a36Sopenharmony_ci
221462306a36Sopenharmony_ciFor balance-alb mode, the active slave is the slave used as a
221562306a36Sopenharmony_ci"primary."  This slave is used for mode-specific control traffic, for
221662306a36Sopenharmony_cisending to peers that are unassigned or if the load is unbalanced.
221762306a36Sopenharmony_ci
221862306a36Sopenharmony_ciFor the active-backup, balance-tlb and balance-alb modes, when
221962306a36Sopenharmony_cithe active slave changes (e.g., due to a link failure), the
222062306a36Sopenharmony_cipromiscuous setting will be propagated to the new active slave.
222162306a36Sopenharmony_ci
222262306a36Sopenharmony_ci11. Configuring Bonding for High Availability
222362306a36Sopenharmony_ci=============================================
222462306a36Sopenharmony_ci
222562306a36Sopenharmony_ciHigh Availability refers to configurations that provide
222662306a36Sopenharmony_cimaximum network availability by having redundant or backup devices,
222762306a36Sopenharmony_cilinks or switches between the host and the rest of the world.  The
222862306a36Sopenharmony_cigoal is to provide the maximum availability of network connectivity
222962306a36Sopenharmony_ci(i.e., the network always works), even though other configurations
223062306a36Sopenharmony_cicould provide higher throughput.
223162306a36Sopenharmony_ci
223262306a36Sopenharmony_ci11.1 High Availability in a Single Switch Topology
223362306a36Sopenharmony_ci--------------------------------------------------
223462306a36Sopenharmony_ci
223562306a36Sopenharmony_ciIf two hosts (or a host and a single switch) are directly
223662306a36Sopenharmony_ciconnected via multiple physical links, then there is no availability
223762306a36Sopenharmony_cipenalty to optimizing for maximum bandwidth.  In this case, there is
223862306a36Sopenharmony_cionly one switch (or peer), so if it fails, there is no alternative
223962306a36Sopenharmony_ciaccess to fail over to.  Additionally, the bonding load balance modes
224062306a36Sopenharmony_cisupport link monitoring of their members, so if individual links fail,
224162306a36Sopenharmony_cithe load will be rebalanced across the remaining devices.
224262306a36Sopenharmony_ci
224362306a36Sopenharmony_ciSee Section 12, "Configuring Bonding for Maximum Throughput"
224462306a36Sopenharmony_cifor information on configuring bonding with one peer device.
224562306a36Sopenharmony_ci
224662306a36Sopenharmony_ci11.2 High Availability in a Multiple Switch Topology
224762306a36Sopenharmony_ci----------------------------------------------------
224862306a36Sopenharmony_ci
224962306a36Sopenharmony_ciWith multiple switches, the configuration of bonding and the
225062306a36Sopenharmony_cinetwork changes dramatically.  In multiple switch topologies, there is
225162306a36Sopenharmony_cia trade off between network availability and usable bandwidth.
225262306a36Sopenharmony_ci
225362306a36Sopenharmony_ciBelow is a sample network, configured to maximize the
225462306a36Sopenharmony_ciavailability of the network::
225562306a36Sopenharmony_ci
225662306a36Sopenharmony_ci		|                                     |
225762306a36Sopenharmony_ci		|port3                           port3|
225862306a36Sopenharmony_ci	  +-----+----+                          +-----+----+
225962306a36Sopenharmony_ci	  |          |port2       ISL      port2|          |
226062306a36Sopenharmony_ci	  | switch A +--------------------------+ switch B |
226162306a36Sopenharmony_ci	  |          |                          |          |
226262306a36Sopenharmony_ci	  +-----+----+                          +-----++---+
226362306a36Sopenharmony_ci		|port1                           port1|
226462306a36Sopenharmony_ci		|             +-------+               |
226562306a36Sopenharmony_ci		+-------------+ host1 +---------------+
226662306a36Sopenharmony_ci			 eth0 +-------+ eth1
226762306a36Sopenharmony_ci
226862306a36Sopenharmony_ciIn this configuration, there is a link between the two
226962306a36Sopenharmony_ciswitches (ISL, or inter switch link), and multiple ports connecting to
227062306a36Sopenharmony_cithe outside world ("port3" on each switch).  There is no technical
227162306a36Sopenharmony_cireason that this could not be extended to a third switch.
227262306a36Sopenharmony_ci
227362306a36Sopenharmony_ci11.2.1 HA Bonding Mode Selection for Multiple Switch Topology
227462306a36Sopenharmony_ci-------------------------------------------------------------
227562306a36Sopenharmony_ci
227662306a36Sopenharmony_ciIn a topology such as the example above, the active-backup and
227762306a36Sopenharmony_cibroadcast modes are the only useful bonding modes when optimizing for
227862306a36Sopenharmony_ciavailability; the other modes require all links to terminate on the
227962306a36Sopenharmony_cisame peer for them to behave rationally.
228062306a36Sopenharmony_ci
228162306a36Sopenharmony_ciactive-backup:
228262306a36Sopenharmony_ci	This is generally the preferred mode, particularly if
228362306a36Sopenharmony_ci	the switches have an ISL and play together well.  If the
228462306a36Sopenharmony_ci	network configuration is such that one switch is specifically
228562306a36Sopenharmony_ci	a backup switch (e.g., has lower capacity, higher cost, etc),
228662306a36Sopenharmony_ci	then the primary option can be used to insure that the
228762306a36Sopenharmony_ci	preferred link is always used when it is available.
228862306a36Sopenharmony_ci
228962306a36Sopenharmony_cibroadcast:
229062306a36Sopenharmony_ci	This mode is really a special purpose mode, and is suitable
229162306a36Sopenharmony_ci	only for very specific needs.  For example, if the two
229262306a36Sopenharmony_ci	switches are not connected (no ISL), and the networks beyond
229362306a36Sopenharmony_ci	them are totally independent.  In this case, if it is
229462306a36Sopenharmony_ci	necessary for some specific one-way traffic to reach both
229562306a36Sopenharmony_ci	independent networks, then the broadcast mode may be suitable.
229662306a36Sopenharmony_ci
229762306a36Sopenharmony_ci11.2.2 HA Link Monitoring Selection for Multiple Switch Topology
229862306a36Sopenharmony_ci----------------------------------------------------------------
229962306a36Sopenharmony_ci
230062306a36Sopenharmony_ciThe choice of link monitoring ultimately depends upon your
230162306a36Sopenharmony_ciswitch.  If the switch can reliably fail ports in response to other
230262306a36Sopenharmony_cifailures, then either the MII or ARP monitors should work.  For
230362306a36Sopenharmony_ciexample, in the above example, if the "port3" link fails at the remote
230462306a36Sopenharmony_ciend, the MII monitor has no direct means to detect this.  The ARP
230562306a36Sopenharmony_cimonitor could be configured with a target at the remote end of port3,
230662306a36Sopenharmony_cithus detecting that failure without switch support.
230762306a36Sopenharmony_ci
230862306a36Sopenharmony_ciIn general, however, in a multiple switch topology, the ARP
230962306a36Sopenharmony_cimonitor can provide a higher level of reliability in detecting end to
231062306a36Sopenharmony_ciend connectivity failures (which may be caused by the failure of any
231162306a36Sopenharmony_ciindividual component to pass traffic for any reason).  Additionally,
231262306a36Sopenharmony_cithe ARP monitor should be configured with multiple targets (at least
231362306a36Sopenharmony_cione for each switch in the network).  This will insure that,
231462306a36Sopenharmony_ciregardless of which switch is active, the ARP monitor has a suitable
231562306a36Sopenharmony_citarget to query.
231662306a36Sopenharmony_ci
231762306a36Sopenharmony_ciNote, also, that of late many switches now support a functionality
231862306a36Sopenharmony_cigenerally referred to as "trunk failover."  This is a feature of the
231962306a36Sopenharmony_ciswitch that causes the link state of a particular switch port to be set
232062306a36Sopenharmony_cidown (or up) when the state of another switch port goes down (or up).
232162306a36Sopenharmony_ciIts purpose is to propagate link failures from logically "exterior" ports
232262306a36Sopenharmony_cito the logically "interior" ports that bonding is able to monitor via
232362306a36Sopenharmony_cimiimon.  Availability and configuration for trunk failover varies by
232462306a36Sopenharmony_ciswitch, but this can be a viable alternative to the ARP monitor when using
232562306a36Sopenharmony_cisuitable switches.
232662306a36Sopenharmony_ci
232762306a36Sopenharmony_ci12. Configuring Bonding for Maximum Throughput
232862306a36Sopenharmony_ci==============================================
232962306a36Sopenharmony_ci
233062306a36Sopenharmony_ci12.1 Maximizing Throughput in a Single Switch Topology
233162306a36Sopenharmony_ci------------------------------------------------------
233262306a36Sopenharmony_ci
233362306a36Sopenharmony_ciIn a single switch configuration, the best method to maximize
233462306a36Sopenharmony_cithroughput depends upon the application and network environment.  The
233562306a36Sopenharmony_civarious load balancing modes each have strengths and weaknesses in
233662306a36Sopenharmony_cidifferent environments, as detailed below.
233762306a36Sopenharmony_ci
233862306a36Sopenharmony_ciFor this discussion, we will break down the topologies into
233962306a36Sopenharmony_citwo categories.  Depending upon the destination of most traffic, we
234062306a36Sopenharmony_cicategorize them into either "gatewayed" or "local" configurations.
234162306a36Sopenharmony_ci
234262306a36Sopenharmony_ciIn a gatewayed configuration, the "switch" is acting primarily
234362306a36Sopenharmony_cias a router, and the majority of traffic passes through this router to
234462306a36Sopenharmony_ciother networks.  An example would be the following::
234562306a36Sopenharmony_ci
234662306a36Sopenharmony_ci
234762306a36Sopenharmony_ci     +----------+                     +----------+
234862306a36Sopenharmony_ci     |          |eth0            port1|          | to other networks
234962306a36Sopenharmony_ci     | Host A   +---------------------+ router   +------------------->
235062306a36Sopenharmony_ci     |          +---------------------+          | Hosts B and C are out
235162306a36Sopenharmony_ci     |          |eth1            port2|          | here somewhere
235262306a36Sopenharmony_ci     +----------+                     +----------+
235362306a36Sopenharmony_ci
235462306a36Sopenharmony_ciThe router may be a dedicated router device, or another host
235562306a36Sopenharmony_ciacting as a gateway.  For our discussion, the important point is that
235662306a36Sopenharmony_cithe majority of traffic from Host A will pass through the router to
235762306a36Sopenharmony_cisome other network before reaching its final destination.
235862306a36Sopenharmony_ci
235962306a36Sopenharmony_ciIn a gatewayed network configuration, although Host A may
236062306a36Sopenharmony_cicommunicate with many other systems, all of its traffic will be sent
236162306a36Sopenharmony_ciand received via one other peer on the local network, the router.
236262306a36Sopenharmony_ci
236362306a36Sopenharmony_ciNote that the case of two systems connected directly via
236462306a36Sopenharmony_cimultiple physical links is, for purposes of configuring bonding, the
236562306a36Sopenharmony_cisame as a gatewayed configuration.  In that case, it happens that all
236662306a36Sopenharmony_citraffic is destined for the "gateway" itself, not some other network
236762306a36Sopenharmony_cibeyond the gateway.
236862306a36Sopenharmony_ci
236962306a36Sopenharmony_ciIn a local configuration, the "switch" is acting primarily as
237062306a36Sopenharmony_cia switch, and the majority of traffic passes through this switch to
237162306a36Sopenharmony_cireach other stations on the same network.  An example would be the
237262306a36Sopenharmony_cifollowing::
237362306a36Sopenharmony_ci
237462306a36Sopenharmony_ci    +----------+            +----------+       +--------+
237562306a36Sopenharmony_ci    |          |eth0   port1|          +-------+ Host B |
237662306a36Sopenharmony_ci    |  Host A  +------------+  switch  |port3  +--------+
237762306a36Sopenharmony_ci    |          +------------+          |                  +--------+
237862306a36Sopenharmony_ci    |          |eth1   port2|          +------------------+ Host C |
237962306a36Sopenharmony_ci    +----------+            +----------+port4             +--------+
238062306a36Sopenharmony_ci
238162306a36Sopenharmony_ci
238262306a36Sopenharmony_ciAgain, the switch may be a dedicated switch device, or another
238362306a36Sopenharmony_cihost acting as a gateway.  For our discussion, the important point is
238462306a36Sopenharmony_cithat the majority of traffic from Host A is destined for other hosts
238562306a36Sopenharmony_cion the same local network (Hosts B and C in the above example).
238662306a36Sopenharmony_ci
238762306a36Sopenharmony_ciIn summary, in a gatewayed configuration, traffic to and from
238862306a36Sopenharmony_cithe bonded device will be to the same MAC level peer on the network
238962306a36Sopenharmony_ci(the gateway itself, i.e., the router), regardless of its final
239062306a36Sopenharmony_cidestination.  In a local configuration, traffic flows directly to and
239162306a36Sopenharmony_cifrom the final destinations, thus, each destination (Host B, Host C)
239262306a36Sopenharmony_ciwill be addressed directly by their individual MAC addresses.
239362306a36Sopenharmony_ci
239462306a36Sopenharmony_ciThis distinction between a gatewayed and a local network
239562306a36Sopenharmony_ciconfiguration is important because many of the load balancing modes
239662306a36Sopenharmony_ciavailable use the MAC addresses of the local network source and
239762306a36Sopenharmony_cidestination to make load balancing decisions.  The behavior of each
239862306a36Sopenharmony_cimode is described below.
239962306a36Sopenharmony_ci
240062306a36Sopenharmony_ci
240162306a36Sopenharmony_ci12.1.1 MT Bonding Mode Selection for Single Switch Topology
240262306a36Sopenharmony_ci-----------------------------------------------------------
240362306a36Sopenharmony_ci
240462306a36Sopenharmony_ciThis configuration is the easiest to set up and to understand,
240562306a36Sopenharmony_cialthough you will have to decide which bonding mode best suits your
240662306a36Sopenharmony_cineeds.  The trade offs for each mode are detailed below:
240762306a36Sopenharmony_ci
240862306a36Sopenharmony_cibalance-rr:
240962306a36Sopenharmony_ci	This mode is the only mode that will permit a single
241062306a36Sopenharmony_ci	TCP/IP connection to stripe traffic across multiple
241162306a36Sopenharmony_ci	interfaces. It is therefore the only mode that will allow a
241262306a36Sopenharmony_ci	single TCP/IP stream to utilize more than one interface's
241362306a36Sopenharmony_ci	worth of throughput.  This comes at a cost, however: the
241462306a36Sopenharmony_ci	striping generally results in peer systems receiving packets out
241562306a36Sopenharmony_ci	of order, causing TCP/IP's congestion control system to kick
241662306a36Sopenharmony_ci	in, often by retransmitting segments.
241762306a36Sopenharmony_ci
241862306a36Sopenharmony_ci	It is possible to adjust TCP/IP's congestion limits by
241962306a36Sopenharmony_ci	altering the net.ipv4.tcp_reordering sysctl parameter.  The
242062306a36Sopenharmony_ci	usual default value is 3. But keep in mind TCP stack is able
242162306a36Sopenharmony_ci	to automatically increase this when it detects reorders.
242262306a36Sopenharmony_ci
242362306a36Sopenharmony_ci	Note that the fraction of packets that will be delivered out of
242462306a36Sopenharmony_ci	order is highly variable, and is unlikely to be zero.  The level
242562306a36Sopenharmony_ci	of reordering depends upon a variety of factors, including the
242662306a36Sopenharmony_ci	networking interfaces, the switch, and the topology of the
242762306a36Sopenharmony_ci	configuration.  Speaking in general terms, higher speed network
242862306a36Sopenharmony_ci	cards produce more reordering (due to factors such as packet
242962306a36Sopenharmony_ci	coalescing), and a "many to many" topology will reorder at a
243062306a36Sopenharmony_ci	higher rate than a "many slow to one fast" configuration.
243162306a36Sopenharmony_ci
243262306a36Sopenharmony_ci	Many switches do not support any modes that stripe traffic
243362306a36Sopenharmony_ci	(instead choosing a port based upon IP or MAC level addresses);
243462306a36Sopenharmony_ci	for those devices, traffic for a particular connection flowing
243562306a36Sopenharmony_ci	through the switch to a balance-rr bond will not utilize greater
243662306a36Sopenharmony_ci	than one interface's worth of bandwidth.
243762306a36Sopenharmony_ci
243862306a36Sopenharmony_ci	If you are utilizing protocols other than TCP/IP, UDP for
243962306a36Sopenharmony_ci	example, and your application can tolerate out of order
244062306a36Sopenharmony_ci	delivery, then this mode can allow for single stream datagram
244162306a36Sopenharmony_ci	performance that scales near linearly as interfaces are added
244262306a36Sopenharmony_ci	to the bond.
244362306a36Sopenharmony_ci
244462306a36Sopenharmony_ci	This mode requires the switch to have the appropriate ports
244562306a36Sopenharmony_ci	configured for "etherchannel" or "trunking."
244662306a36Sopenharmony_ci
244762306a36Sopenharmony_ciactive-backup:
244862306a36Sopenharmony_ci	There is not much advantage in this network topology to
244962306a36Sopenharmony_ci	the active-backup mode, as the inactive backup devices are all
245062306a36Sopenharmony_ci	connected to the same peer as the primary.  In this case, a
245162306a36Sopenharmony_ci	load balancing mode (with link monitoring) will provide the
245262306a36Sopenharmony_ci	same level of network availability, but with increased
245362306a36Sopenharmony_ci	available bandwidth.  On the plus side, active-backup mode
245462306a36Sopenharmony_ci	does not require any configuration of the switch, so it may
245562306a36Sopenharmony_ci	have value if the hardware available does not support any of
245662306a36Sopenharmony_ci	the load balance modes.
245762306a36Sopenharmony_ci
245862306a36Sopenharmony_cibalance-xor:
245962306a36Sopenharmony_ci	This mode will limit traffic such that packets destined
246062306a36Sopenharmony_ci	for specific peers will always be sent over the same
246162306a36Sopenharmony_ci	interface.  Since the destination is determined by the MAC
246262306a36Sopenharmony_ci	addresses involved, this mode works best in a "local" network
246362306a36Sopenharmony_ci	configuration (as described above), with destinations all on
246462306a36Sopenharmony_ci	the same local network.  This mode is likely to be suboptimal
246562306a36Sopenharmony_ci	if all your traffic is passed through a single router (i.e., a
246662306a36Sopenharmony_ci	"gatewayed" network configuration, as described above).
246762306a36Sopenharmony_ci
246862306a36Sopenharmony_ci	As with balance-rr, the switch ports need to be configured for
246962306a36Sopenharmony_ci	"etherchannel" or "trunking."
247062306a36Sopenharmony_ci
247162306a36Sopenharmony_cibroadcast:
247262306a36Sopenharmony_ci	Like active-backup, there is not much advantage to this
247362306a36Sopenharmony_ci	mode in this type of network topology.
247462306a36Sopenharmony_ci
247562306a36Sopenharmony_ci802.3ad:
247662306a36Sopenharmony_ci	This mode can be a good choice for this type of network
247762306a36Sopenharmony_ci	topology.  The 802.3ad mode is an IEEE standard, so all peers
247862306a36Sopenharmony_ci	that implement 802.3ad should interoperate well.  The 802.3ad
247962306a36Sopenharmony_ci	protocol includes automatic configuration of the aggregates,
248062306a36Sopenharmony_ci	so minimal manual configuration of the switch is needed
248162306a36Sopenharmony_ci	(typically only to designate that some set of devices is
248262306a36Sopenharmony_ci	available for 802.3ad).  The 802.3ad standard also mandates
248362306a36Sopenharmony_ci	that frames be delivered in order (within certain limits), so
248462306a36Sopenharmony_ci	in general single connections will not see misordering of
248562306a36Sopenharmony_ci	packets.  The 802.3ad mode does have some drawbacks: the
248662306a36Sopenharmony_ci	standard mandates that all devices in the aggregate operate at
248762306a36Sopenharmony_ci	the same speed and duplex.  Also, as with all bonding load
248862306a36Sopenharmony_ci	balance modes other than balance-rr, no single connection will
248962306a36Sopenharmony_ci	be able to utilize more than a single interface's worth of
249062306a36Sopenharmony_ci	bandwidth.
249162306a36Sopenharmony_ci
249262306a36Sopenharmony_ci	Additionally, the linux bonding 802.3ad implementation
249362306a36Sopenharmony_ci	distributes traffic by peer (using an XOR of MAC addresses
249462306a36Sopenharmony_ci	and packet type ID), so in a "gatewayed" configuration, all
249562306a36Sopenharmony_ci	outgoing traffic will generally use the same device.  Incoming
249662306a36Sopenharmony_ci	traffic may also end up on a single device, but that is
249762306a36Sopenharmony_ci	dependent upon the balancing policy of the peer's 802.3ad
249862306a36Sopenharmony_ci	implementation.  In a "local" configuration, traffic will be
249962306a36Sopenharmony_ci	distributed across the devices in the bond.
250062306a36Sopenharmony_ci
250162306a36Sopenharmony_ci	Finally, the 802.3ad mode mandates the use of the MII monitor,
250262306a36Sopenharmony_ci	therefore, the ARP monitor is not available in this mode.
250362306a36Sopenharmony_ci
250462306a36Sopenharmony_cibalance-tlb:
250562306a36Sopenharmony_ci	The balance-tlb mode balances outgoing traffic by peer.
250662306a36Sopenharmony_ci	Since the balancing is done according to MAC address, in a
250762306a36Sopenharmony_ci	"gatewayed" configuration (as described above), this mode will
250862306a36Sopenharmony_ci	send all traffic across a single device.  However, in a
250962306a36Sopenharmony_ci	"local" network configuration, this mode balances multiple
251062306a36Sopenharmony_ci	local network peers across devices in a vaguely intelligent
251162306a36Sopenharmony_ci	manner (not a simple XOR as in balance-xor or 802.3ad mode),
251262306a36Sopenharmony_ci	so that mathematically unlucky MAC addresses (i.e., ones that
251362306a36Sopenharmony_ci	XOR to the same value) will not all "bunch up" on a single
251462306a36Sopenharmony_ci	interface.
251562306a36Sopenharmony_ci
251662306a36Sopenharmony_ci	Unlike 802.3ad, interfaces may be of differing speeds, and no
251762306a36Sopenharmony_ci	special switch configuration is required.  On the down side,
251862306a36Sopenharmony_ci	in this mode all incoming traffic arrives over a single
251962306a36Sopenharmony_ci	interface, this mode requires certain ethtool support in the
252062306a36Sopenharmony_ci	network device driver of the slave interfaces, and the ARP
252162306a36Sopenharmony_ci	monitor is not available.
252262306a36Sopenharmony_ci
252362306a36Sopenharmony_cibalance-alb:
252462306a36Sopenharmony_ci	This mode is everything that balance-tlb is, and more.
252562306a36Sopenharmony_ci	It has all of the features (and restrictions) of balance-tlb,
252662306a36Sopenharmony_ci	and will also balance incoming traffic from local network
252762306a36Sopenharmony_ci	peers (as described in the Bonding Module Options section,
252862306a36Sopenharmony_ci	above).
252962306a36Sopenharmony_ci
253062306a36Sopenharmony_ci	The only additional down side to this mode is that the network
253162306a36Sopenharmony_ci	device driver must support changing the hardware address while
253262306a36Sopenharmony_ci	the device is open.
253362306a36Sopenharmony_ci
253462306a36Sopenharmony_ci12.1.2 MT Link Monitoring for Single Switch Topology
253562306a36Sopenharmony_ci----------------------------------------------------
253662306a36Sopenharmony_ci
253762306a36Sopenharmony_ciThe choice of link monitoring may largely depend upon which
253862306a36Sopenharmony_cimode you choose to use.  The more advanced load balancing modes do not
253962306a36Sopenharmony_cisupport the use of the ARP monitor, and are thus restricted to using
254062306a36Sopenharmony_cithe MII monitor (which does not provide as high a level of end to end
254162306a36Sopenharmony_ciassurance as the ARP monitor).
254262306a36Sopenharmony_ci
254362306a36Sopenharmony_ci12.2 Maximum Throughput in a Multiple Switch Topology
254462306a36Sopenharmony_ci-----------------------------------------------------
254562306a36Sopenharmony_ci
254662306a36Sopenharmony_ciMultiple switches may be utilized to optimize for throughput
254762306a36Sopenharmony_ciwhen they are configured in parallel as part of an isolated network
254862306a36Sopenharmony_cibetween two or more systems, for example::
254962306a36Sopenharmony_ci
255062306a36Sopenharmony_ci		       +-----------+
255162306a36Sopenharmony_ci		       |  Host A   |
255262306a36Sopenharmony_ci		       +-+---+---+-+
255362306a36Sopenharmony_ci			 |   |   |
255462306a36Sopenharmony_ci		+--------+   |   +---------+
255562306a36Sopenharmony_ci		|            |             |
255662306a36Sopenharmony_ci	 +------+---+  +-----+----+  +-----+----+
255762306a36Sopenharmony_ci	 | Switch A |  | Switch B |  | Switch C |
255862306a36Sopenharmony_ci	 +------+---+  +-----+----+  +-----+----+
255962306a36Sopenharmony_ci		|            |             |
256062306a36Sopenharmony_ci		+--------+   |   +---------+
256162306a36Sopenharmony_ci			 |   |   |
256262306a36Sopenharmony_ci		       +-+---+---+-+
256362306a36Sopenharmony_ci		       |  Host B   |
256462306a36Sopenharmony_ci		       +-----------+
256562306a36Sopenharmony_ci
256662306a36Sopenharmony_ciIn this configuration, the switches are isolated from one
256762306a36Sopenharmony_cianother.  One reason to employ a topology such as this is for an
256862306a36Sopenharmony_ciisolated network with many hosts (a cluster configured for high
256962306a36Sopenharmony_ciperformance, for example), using multiple smaller switches can be more
257062306a36Sopenharmony_cicost effective than a single larger switch, e.g., on a network with 24
257162306a36Sopenharmony_cihosts, three 24 port switches can be significantly less expensive than
257262306a36Sopenharmony_cia single 72 port switch.
257362306a36Sopenharmony_ci
257462306a36Sopenharmony_ciIf access beyond the network is required, an individual host
257562306a36Sopenharmony_cican be equipped with an additional network device connected to an
257662306a36Sopenharmony_ciexternal network; this host then additionally acts as a gateway.
257762306a36Sopenharmony_ci
257862306a36Sopenharmony_ci12.2.1 MT Bonding Mode Selection for Multiple Switch Topology
257962306a36Sopenharmony_ci-------------------------------------------------------------
258062306a36Sopenharmony_ci
258162306a36Sopenharmony_ciIn actual practice, the bonding mode typically employed in
258262306a36Sopenharmony_ciconfigurations of this type is balance-rr.  Historically, in this
258362306a36Sopenharmony_cinetwork configuration, the usual caveats about out of order packet
258462306a36Sopenharmony_cidelivery are mitigated by the use of network adapters that do not do
258562306a36Sopenharmony_ciany kind of packet coalescing (via the use of NAPI, or because the
258662306a36Sopenharmony_cidevice itself does not generate interrupts until some number of
258762306a36Sopenharmony_cipackets has arrived).  When employed in this fashion, the balance-rr
258862306a36Sopenharmony_cimode allows individual connections between two hosts to effectively
258962306a36Sopenharmony_ciutilize greater than one interface's bandwidth.
259062306a36Sopenharmony_ci
259162306a36Sopenharmony_ci12.2.2 MT Link Monitoring for Multiple Switch Topology
259262306a36Sopenharmony_ci------------------------------------------------------
259362306a36Sopenharmony_ci
259462306a36Sopenharmony_ciAgain, in actual practice, the MII monitor is most often used
259562306a36Sopenharmony_ciin this configuration, as performance is given preference over
259662306a36Sopenharmony_ciavailability.  The ARP monitor will function in this topology, but its
259762306a36Sopenharmony_ciadvantages over the MII monitor are mitigated by the volume of probes
259862306a36Sopenharmony_cineeded as the number of systems involved grows (remember that each
259962306a36Sopenharmony_cihost in the network is configured with bonding).
260062306a36Sopenharmony_ci
260162306a36Sopenharmony_ci13. Switch Behavior Issues
260262306a36Sopenharmony_ci==========================
260362306a36Sopenharmony_ci
260462306a36Sopenharmony_ci13.1 Link Establishment and Failover Delays
260562306a36Sopenharmony_ci-------------------------------------------
260662306a36Sopenharmony_ci
260762306a36Sopenharmony_ciSome switches exhibit undesirable behavior with regard to the
260862306a36Sopenharmony_citiming of link up and down reporting by the switch.
260962306a36Sopenharmony_ci
261062306a36Sopenharmony_ciFirst, when a link comes up, some switches may indicate that
261162306a36Sopenharmony_cithe link is up (carrier available), but not pass traffic over the
261262306a36Sopenharmony_ciinterface for some period of time.  This delay is typically due to
261362306a36Sopenharmony_cisome type of autonegotiation or routing protocol, but may also occur
261462306a36Sopenharmony_ciduring switch initialization (e.g., during recovery after a switch
261562306a36Sopenharmony_cifailure).  If you find this to be a problem, specify an appropriate
261662306a36Sopenharmony_civalue to the updelay bonding module option to delay the use of the
261762306a36Sopenharmony_cirelevant interface(s).
261862306a36Sopenharmony_ci
261962306a36Sopenharmony_ciSecond, some switches may "bounce" the link state one or more
262062306a36Sopenharmony_citimes while a link is changing state.  This occurs most commonly while
262162306a36Sopenharmony_cithe switch is initializing.  Again, an appropriate updelay value may
262262306a36Sopenharmony_cihelp.
262362306a36Sopenharmony_ci
262462306a36Sopenharmony_ciNote that when a bonding interface has no active links, the
262562306a36Sopenharmony_cidriver will immediately reuse the first link that goes up, even if the
262662306a36Sopenharmony_ciupdelay parameter has been specified (the updelay is ignored in this
262762306a36Sopenharmony_cicase).  If there are slave interfaces waiting for the updelay timeout
262862306a36Sopenharmony_cito expire, the interface that first went into that state will be
262962306a36Sopenharmony_ciimmediately reused.  This reduces down time of the network if the
263062306a36Sopenharmony_civalue of updelay has been overestimated, and since this occurs only in
263162306a36Sopenharmony_cicases with no connectivity, there is no additional penalty for
263262306a36Sopenharmony_ciignoring the updelay.
263362306a36Sopenharmony_ci
263462306a36Sopenharmony_ciIn addition to the concerns about switch timings, if your
263562306a36Sopenharmony_ciswitches take a long time to go into backup mode, it may be desirable
263662306a36Sopenharmony_cito not activate a backup interface immediately after a link goes down.
263762306a36Sopenharmony_ciFailover may be delayed via the downdelay bonding module option.
263862306a36Sopenharmony_ci
263962306a36Sopenharmony_ci13.2 Duplicated Incoming Packets
264062306a36Sopenharmony_ci--------------------------------
264162306a36Sopenharmony_ci
264262306a36Sopenharmony_ciNOTE: Starting with version 3.0.2, the bonding driver has logic to
264362306a36Sopenharmony_cisuppress duplicate packets, which should largely eliminate this problem.
264462306a36Sopenharmony_ciThe following description is kept for reference.
264562306a36Sopenharmony_ci
264662306a36Sopenharmony_ciIt is not uncommon to observe a short burst of duplicated
264762306a36Sopenharmony_citraffic when the bonding device is first used, or after it has been
264862306a36Sopenharmony_ciidle for some period of time.  This is most easily observed by issuing
264962306a36Sopenharmony_cia "ping" to some other host on the network, and noticing that the
265062306a36Sopenharmony_cioutput from ping flags duplicates (typically one per slave).
265162306a36Sopenharmony_ci
265262306a36Sopenharmony_ciFor example, on a bond in active-backup mode with five slaves
265362306a36Sopenharmony_ciall connected to one switch, the output may appear as follows::
265462306a36Sopenharmony_ci
265562306a36Sopenharmony_ci	# ping -n 10.0.4.2
265662306a36Sopenharmony_ci	PING 10.0.4.2 (10.0.4.2) from 10.0.3.10 : 56(84) bytes of data.
265762306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.7 ms
265862306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
265962306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
266062306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
266162306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=1 ttl=64 time=13.8 ms (DUP!)
266262306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=2 ttl=64 time=0.216 ms
266362306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=3 ttl=64 time=0.267 ms
266462306a36Sopenharmony_ci	64 bytes from 10.0.4.2: icmp_seq=4 ttl=64 time=0.222 ms
266562306a36Sopenharmony_ci
266662306a36Sopenharmony_ciThis is not due to an error in the bonding driver, rather, it
266762306a36Sopenharmony_ciis a side effect of how many switches update their MAC forwarding
266862306a36Sopenharmony_citables.  Initially, the switch does not associate the MAC address in
266962306a36Sopenharmony_cithe packet with a particular switch port, and so it may send the
267062306a36Sopenharmony_citraffic to all ports until its MAC forwarding table is updated.  Since
267162306a36Sopenharmony_cithe interfaces attached to the bond may occupy multiple ports on a
267262306a36Sopenharmony_cisingle switch, when the switch (temporarily) floods the traffic to all
267362306a36Sopenharmony_ciports, the bond device receives multiple copies of the same packet
267462306a36Sopenharmony_ci(one per slave device).
267562306a36Sopenharmony_ci
267662306a36Sopenharmony_ciThe duplicated packet behavior is switch dependent, some
267762306a36Sopenharmony_ciswitches exhibit this, and some do not.  On switches that display this
267862306a36Sopenharmony_cibehavior, it can be induced by clearing the MAC forwarding table (on
267962306a36Sopenharmony_cimost Cisco switches, the privileged command "clear mac address-table
268062306a36Sopenharmony_cidynamic" will accomplish this).
268162306a36Sopenharmony_ci
268262306a36Sopenharmony_ci14. Hardware Specific Considerations
268362306a36Sopenharmony_ci====================================
268462306a36Sopenharmony_ci
268562306a36Sopenharmony_ciThis section contains additional information for configuring
268662306a36Sopenharmony_cibonding on specific hardware platforms, or for interfacing bonding
268762306a36Sopenharmony_ciwith particular switches or other devices.
268862306a36Sopenharmony_ci
268962306a36Sopenharmony_ci14.1 IBM BladeCenter
269062306a36Sopenharmony_ci--------------------
269162306a36Sopenharmony_ci
269262306a36Sopenharmony_ciThis applies to the JS20 and similar systems.
269362306a36Sopenharmony_ci
269462306a36Sopenharmony_ciOn the JS20 blades, the bonding driver supports only
269562306a36Sopenharmony_cibalance-rr, active-backup, balance-tlb and balance-alb modes.  This is
269662306a36Sopenharmony_cilargely due to the network topology inside the BladeCenter, detailed
269762306a36Sopenharmony_cibelow.
269862306a36Sopenharmony_ci
269962306a36Sopenharmony_ciJS20 network adapter information
270062306a36Sopenharmony_ci--------------------------------
270162306a36Sopenharmony_ci
270262306a36Sopenharmony_ciAll JS20s come with two Broadcom Gigabit Ethernet ports
270362306a36Sopenharmony_ciintegrated on the planar (that's "motherboard" in IBM-speak).  In the
270462306a36Sopenharmony_ciBladeCenter chassis, the eth0 port of all JS20 blades is hard wired to
270562306a36Sopenharmony_ciI/O Module #1; similarly, all eth1 ports are wired to I/O Module #2.
270662306a36Sopenharmony_ciAn add-on Broadcom daughter card can be installed on a JS20 to provide
270762306a36Sopenharmony_citwo more Gigabit Ethernet ports.  These ports, eth2 and eth3, are
270862306a36Sopenharmony_ciwired to I/O Modules 3 and 4, respectively.
270962306a36Sopenharmony_ci
271062306a36Sopenharmony_ciEach I/O Module may contain either a switch or a passthrough
271162306a36Sopenharmony_cimodule (which allows ports to be directly connected to an external
271262306a36Sopenharmony_ciswitch).  Some bonding modes require a specific BladeCenter internal
271362306a36Sopenharmony_cinetwork topology in order to function; these are detailed below.
271462306a36Sopenharmony_ci
271562306a36Sopenharmony_ciAdditional BladeCenter-specific networking information can be
271662306a36Sopenharmony_cifound in two IBM Redbooks (www.ibm.com/redbooks):
271762306a36Sopenharmony_ci
271862306a36Sopenharmony_ci- "IBM eServer BladeCenter Networking Options"
271962306a36Sopenharmony_ci- "IBM eServer BladeCenter Layer 2-7 Network Switching"
272062306a36Sopenharmony_ci
272162306a36Sopenharmony_ciBladeCenter networking configuration
272262306a36Sopenharmony_ci------------------------------------
272362306a36Sopenharmony_ci
272462306a36Sopenharmony_ciBecause a BladeCenter can be configured in a very large number
272562306a36Sopenharmony_ciof ways, this discussion will be confined to describing basic
272662306a36Sopenharmony_ciconfigurations.
272762306a36Sopenharmony_ci
272862306a36Sopenharmony_ciNormally, Ethernet Switch Modules (ESMs) are used in I/O
272962306a36Sopenharmony_cimodules 1 and 2.  In this configuration, the eth0 and eth1 ports of a
273062306a36Sopenharmony_ciJS20 will be connected to different internal switches (in the
273162306a36Sopenharmony_cirespective I/O modules).
273262306a36Sopenharmony_ci
273362306a36Sopenharmony_ciA passthrough module (OPM or CPM, optical or copper,
273462306a36Sopenharmony_cipassthrough module) connects the I/O module directly to an external
273562306a36Sopenharmony_ciswitch.  By using PMs in I/O module #1 and #2, the eth0 and eth1
273662306a36Sopenharmony_ciinterfaces of a JS20 can be redirected to the outside world and
273762306a36Sopenharmony_ciconnected to a common external switch.
273862306a36Sopenharmony_ci
273962306a36Sopenharmony_ciDepending upon the mix of ESMs and PMs, the network will
274062306a36Sopenharmony_ciappear to bonding as either a single switch topology (all PMs) or as a
274162306a36Sopenharmony_cimultiple switch topology (one or more ESMs, zero or more PMs).  It is
274262306a36Sopenharmony_cialso possible to connect ESMs together, resulting in a configuration
274362306a36Sopenharmony_cimuch like the example in "High Availability in a Multiple Switch
274462306a36Sopenharmony_ciTopology," above.
274562306a36Sopenharmony_ci
274662306a36Sopenharmony_ciRequirements for specific modes
274762306a36Sopenharmony_ci-------------------------------
274862306a36Sopenharmony_ci
274962306a36Sopenharmony_ciThe balance-rr mode requires the use of passthrough modules
275062306a36Sopenharmony_cifor devices in the bond, all connected to an common external switch.
275162306a36Sopenharmony_ciThat switch must be configured for "etherchannel" or "trunking" on the
275262306a36Sopenharmony_ciappropriate ports, as is usual for balance-rr.
275362306a36Sopenharmony_ci
275462306a36Sopenharmony_ciThe balance-alb and balance-tlb modes will function with
275562306a36Sopenharmony_cieither switch modules or passthrough modules (or a mix).  The only
275662306a36Sopenharmony_cispecific requirement for these modes is that all network interfaces
275762306a36Sopenharmony_cimust be able to reach all destinations for traffic sent over the
275862306a36Sopenharmony_cibonding device (i.e., the network must converge at some point outside
275962306a36Sopenharmony_cithe BladeCenter).
276062306a36Sopenharmony_ci
276162306a36Sopenharmony_ciThe active-backup mode has no additional requirements.
276262306a36Sopenharmony_ci
276362306a36Sopenharmony_ciLink monitoring issues
276462306a36Sopenharmony_ci----------------------
276562306a36Sopenharmony_ci
276662306a36Sopenharmony_ciWhen an Ethernet Switch Module is in place, only the ARP
276762306a36Sopenharmony_cimonitor will reliably detect link loss to an external switch.  This is
276862306a36Sopenharmony_cinothing unusual, but examination of the BladeCenter cabinet would
276962306a36Sopenharmony_cisuggest that the "external" network ports are the ethernet ports for
277062306a36Sopenharmony_cithe system, when it fact there is a switch between these "external"
277162306a36Sopenharmony_ciports and the devices on the JS20 system itself.  The MII monitor is
277262306a36Sopenharmony_cionly able to detect link failures between the ESM and the JS20 system.
277362306a36Sopenharmony_ci
277462306a36Sopenharmony_ciWhen a passthrough module is in place, the MII monitor does
277562306a36Sopenharmony_cidetect failures to the "external" port, which is then directly
277662306a36Sopenharmony_ciconnected to the JS20 system.
277762306a36Sopenharmony_ci
277862306a36Sopenharmony_ciOther concerns
277962306a36Sopenharmony_ci--------------
278062306a36Sopenharmony_ci
278162306a36Sopenharmony_ciThe Serial Over LAN (SoL) link is established over the primary
278262306a36Sopenharmony_ciethernet (eth0) only, therefore, any loss of link to eth0 will result
278362306a36Sopenharmony_ciin losing your SoL connection.  It will not fail over with other
278462306a36Sopenharmony_cinetwork traffic, as the SoL system is beyond the control of the
278562306a36Sopenharmony_cibonding driver.
278662306a36Sopenharmony_ci
278762306a36Sopenharmony_ciIt may be desirable to disable spanning tree on the switch
278862306a36Sopenharmony_ci(either the internal Ethernet Switch Module, or an external switch) to
278962306a36Sopenharmony_ciavoid fail-over delay issues when using bonding.
279062306a36Sopenharmony_ci
279162306a36Sopenharmony_ci
279262306a36Sopenharmony_ci15. Frequently Asked Questions
279362306a36Sopenharmony_ci==============================
279462306a36Sopenharmony_ci
279562306a36Sopenharmony_ci1.  Is it SMP safe?
279662306a36Sopenharmony_ci-------------------
279762306a36Sopenharmony_ci
279862306a36Sopenharmony_ciYes. The old 2.0.xx channel bonding patch was not SMP safe.
279962306a36Sopenharmony_ciThe new driver was designed to be SMP safe from the start.
280062306a36Sopenharmony_ci
280162306a36Sopenharmony_ci2.  What type of cards will work with it?
280262306a36Sopenharmony_ci-----------------------------------------
280362306a36Sopenharmony_ci
280462306a36Sopenharmony_ciAny Ethernet type cards (you can even mix cards - a Intel
280562306a36Sopenharmony_ciEtherExpress PRO/100 and a 3com 3c905b, for example).  For most modes,
280662306a36Sopenharmony_cidevices need not be of the same speed.
280762306a36Sopenharmony_ci
280862306a36Sopenharmony_ciStarting with version 3.2.1, bonding also supports Infiniband
280962306a36Sopenharmony_cislaves in active-backup mode.
281062306a36Sopenharmony_ci
281162306a36Sopenharmony_ci3.  How many bonding devices can I have?
281262306a36Sopenharmony_ci----------------------------------------
281362306a36Sopenharmony_ci
281462306a36Sopenharmony_ciThere is no limit.
281562306a36Sopenharmony_ci
281662306a36Sopenharmony_ci4.  How many slaves can a bonding device have?
281762306a36Sopenharmony_ci----------------------------------------------
281862306a36Sopenharmony_ci
281962306a36Sopenharmony_ciThis is limited only by the number of network interfaces Linux
282062306a36Sopenharmony_cisupports and/or the number of network cards you can place in your
282162306a36Sopenharmony_cisystem.
282262306a36Sopenharmony_ci
282362306a36Sopenharmony_ci5.  What happens when a slave link dies?
282462306a36Sopenharmony_ci----------------------------------------
282562306a36Sopenharmony_ci
282662306a36Sopenharmony_ciIf link monitoring is enabled, then the failing device will be
282762306a36Sopenharmony_cidisabled.  The active-backup mode will fail over to a backup link, and
282862306a36Sopenharmony_ciother modes will ignore the failed link.  The link will continue to be
282962306a36Sopenharmony_cimonitored, and should it recover, it will rejoin the bond (in whatever
283062306a36Sopenharmony_cimanner is appropriate for the mode). See the sections on High
283162306a36Sopenharmony_ciAvailability and the documentation for each mode for additional
283262306a36Sopenharmony_ciinformation.
283362306a36Sopenharmony_ci
283462306a36Sopenharmony_ciLink monitoring can be enabled via either the miimon or
283562306a36Sopenharmony_ciarp_interval parameters (described in the module parameters section,
283662306a36Sopenharmony_ciabove).  In general, miimon monitors the carrier state as sensed by
283762306a36Sopenharmony_cithe underlying network device, and the arp monitor (arp_interval)
283862306a36Sopenharmony_cimonitors connectivity to another host on the local network.
283962306a36Sopenharmony_ci
284062306a36Sopenharmony_ciIf no link monitoring is configured, the bonding driver will
284162306a36Sopenharmony_cibe unable to detect link failures, and will assume that all links are
284262306a36Sopenharmony_cialways available.  This will likely result in lost packets, and a
284362306a36Sopenharmony_ciresulting degradation of performance.  The precise performance loss
284462306a36Sopenharmony_cidepends upon the bonding mode and network configuration.
284562306a36Sopenharmony_ci
284662306a36Sopenharmony_ci6.  Can bonding be used for High Availability?
284762306a36Sopenharmony_ci----------------------------------------------
284862306a36Sopenharmony_ci
284962306a36Sopenharmony_ciYes.  See the section on High Availability for details.
285062306a36Sopenharmony_ci
285162306a36Sopenharmony_ci7.  Which switches/systems does it work with?
285262306a36Sopenharmony_ci---------------------------------------------
285362306a36Sopenharmony_ci
285462306a36Sopenharmony_ciThe full answer to this depends upon the desired mode.
285562306a36Sopenharmony_ci
285662306a36Sopenharmony_ciIn the basic balance modes (balance-rr and balance-xor), it
285762306a36Sopenharmony_ciworks with any system that supports etherchannel (also called
285862306a36Sopenharmony_citrunking).  Most managed switches currently available have such
285962306a36Sopenharmony_cisupport, and many unmanaged switches as well.
286062306a36Sopenharmony_ci
286162306a36Sopenharmony_ciThe advanced balance modes (balance-tlb and balance-alb) do
286262306a36Sopenharmony_cinot have special switch requirements, but do need device drivers that
286362306a36Sopenharmony_cisupport specific features (described in the appropriate section under
286462306a36Sopenharmony_cimodule parameters, above).
286562306a36Sopenharmony_ci
286662306a36Sopenharmony_ciIn 802.3ad mode, it works with systems that support IEEE
286762306a36Sopenharmony_ci802.3ad Dynamic Link Aggregation.  Most managed and many unmanaged
286862306a36Sopenharmony_ciswitches currently available support 802.3ad.
286962306a36Sopenharmony_ci
287062306a36Sopenharmony_ciThe active-backup mode should work with any Layer-II switch.
287162306a36Sopenharmony_ci
287262306a36Sopenharmony_ci8.  Where does a bonding device get its MAC address from?
287362306a36Sopenharmony_ci---------------------------------------------------------
287462306a36Sopenharmony_ci
287562306a36Sopenharmony_ciWhen using slave devices that have fixed MAC addresses, or when
287662306a36Sopenharmony_cithe fail_over_mac option is enabled, the bonding device's MAC address is
287762306a36Sopenharmony_cithe MAC address of the active slave.
287862306a36Sopenharmony_ci
287962306a36Sopenharmony_ciFor other configurations, if not explicitly configured (with
288062306a36Sopenharmony_ciifconfig or ip link), the MAC address of the bonding device is taken from
288162306a36Sopenharmony_ciits first slave device.  This MAC address is then passed to all following
288262306a36Sopenharmony_cislaves and remains persistent (even if the first slave is removed) until
288362306a36Sopenharmony_cithe bonding device is brought down or reconfigured.
288462306a36Sopenharmony_ci
288562306a36Sopenharmony_ciIf you wish to change the MAC address, you can set it with
288662306a36Sopenharmony_ciifconfig or ip link::
288762306a36Sopenharmony_ci
288862306a36Sopenharmony_ci	# ifconfig bond0 hw ether 00:11:22:33:44:55
288962306a36Sopenharmony_ci
289062306a36Sopenharmony_ci	# ip link set bond0 address 66:77:88:99:aa:bb
289162306a36Sopenharmony_ci
289262306a36Sopenharmony_ciThe MAC address can be also changed by bringing down/up the
289362306a36Sopenharmony_cidevice and then changing its slaves (or their order)::
289462306a36Sopenharmony_ci
289562306a36Sopenharmony_ci	# ifconfig bond0 down ; modprobe -r bonding
289662306a36Sopenharmony_ci	# ifconfig bond0 .... up
289762306a36Sopenharmony_ci	# ifenslave bond0 eth...
289862306a36Sopenharmony_ci
289962306a36Sopenharmony_ciThis method will automatically take the address from the next
290062306a36Sopenharmony_cislave that is added.
290162306a36Sopenharmony_ci
290262306a36Sopenharmony_ciTo restore your slaves' MAC addresses, you need to detach them
290362306a36Sopenharmony_cifrom the bond (``ifenslave -d bond0 eth0``). The bonding driver will
290462306a36Sopenharmony_cithen restore the MAC addresses that the slaves had before they were
290562306a36Sopenharmony_cienslaved.
290662306a36Sopenharmony_ci
290762306a36Sopenharmony_ci16. Resources and Links
290862306a36Sopenharmony_ci=======================
290962306a36Sopenharmony_ci
291062306a36Sopenharmony_ciThe latest version of the bonding driver can be found in the latest
291162306a36Sopenharmony_civersion of the linux kernel, found on http://kernel.org
291262306a36Sopenharmony_ci
291362306a36Sopenharmony_ciThe latest version of this document can be found in the latest kernel
291462306a36Sopenharmony_cisource (named Documentation/networking/bonding.rst).
291562306a36Sopenharmony_ci
291662306a36Sopenharmony_ciDiscussions regarding the development of the bonding driver take place
291762306a36Sopenharmony_cion the main Linux network mailing list, hosted at vger.kernel.org. The list
291862306a36Sopenharmony_ciaddress is:
291962306a36Sopenharmony_ci
292062306a36Sopenharmony_cinetdev@vger.kernel.org
292162306a36Sopenharmony_ci
292262306a36Sopenharmony_ciThe administrative interface (to subscribe or unsubscribe) can
292362306a36Sopenharmony_cibe found at:
292462306a36Sopenharmony_ci
292562306a36Sopenharmony_cihttp://vger.kernel.org/vger-lists.html#netdev
2926