miimon
or arp_interval
and the arp_ip_target
parameters. See Section 4.4.1, “Bonding Module Directives” for a list of available options and how to quickly determine the best ones for your bonded interface.
BONDING_OPTS="<bonding parameters>"
directive in your bonding interface configuration file (ifcfg-bond0
for example). Parameters to bonded interfaces can be configured without unloading (and reloading) the bonding module by manipulating files in the sysfs
file system.
sysfs
is a virtual file system that represents kernel objects as directories, files and symbolic links. sysfs
can be used to query for information about kernel objects, and can also manipulate those objects through the use of normal file system commands. The sysfs
virtual file system is mounted under the /sys/
directory. All bonding interfaces can be configured dynamically by interacting with and manipulating files under the /sys/class/net/
directory.
ifcfg-bond0
by following the instructions in Section 4.3.2, “Create a Channel Bonding Interface”. Insert the SLAVE=yes
and MASTER=bond0
directives in the configuration files for each interface bonded to bond0. Once this is completed, you can proceed to testing the parameters.
/usr/sbin/ifup bond<N>
as root
:
~]# /usr/sbin/ifup bond0
ifcfg-bond0
bonding interface file, you will be able to see bond0
listed in the output of running ip link show
as root
:
~]# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 52:54:00:e9:ce:d2 brd ff:ff:ff:ff:ff:ff
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 52:54:00:38:a6:4c brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT
link/ether 52:54:00:38:a6:4c brd ff:ff:ff:ff:ff:ff
~]$ cat /sys/class/net/bonding_masters
bond0
/sys/class/net/bond<N>/bonding/
directory. First, the bond you are configuring must be taken down:
~]# /usr/sbin/ifdown bond0
root
:
~]# echo 1000 > /sys/class/net/bond0/bonding/miimon
balance-alb
mode, run either:
~]# echo 6 > /sys/class/net/bond0/bonding/mode
~]# echo balance-alb > /sys/class/net/bond0/bonding/mode
/usr/sbin/ifup bond<N>
. If you decide to change the options, take the interface down, modify its parameters using sysfs
, bring it back up, and re-test.
BONDING_OPTS=
directive of the /etc/sysconfig/network-scripts/ifcfg-bond<N>
file for the bonding interface you are configuring. Whenever that bond is brought up (for example, by the system during the boot sequence if the ONBOOT=yes
directive is set), the bonding options specified in the BONDING_OPTS
will take effect for that bond.
parm
in modinfo bonding
output, or for more detailed information, see https://www.kernel.org/doc/Documentation/networking/bonding.txt.
Bonding Interface Parameters
ad_select=<value>
stable
or 0
— Default setting. The active aggregator is chosen by largest aggregate bandwidth. Reselection of the active aggregator occurs only when all slaves of the active aggregator are down or if the active aggregator has no slaves.
bandwidth
or 1
— The active aggregator is chosen by largest aggregate bandwidth. Reselection occurs if:
count
or 2
— The active aggregator is chosen by the largest number of slaves. Reselection occurs as described for the bandwidth
setting above.
bandwidth
and count
selection policies permit failover of 802.3ad aggregations when partial failure of the active aggregator occurs. This keeps the aggregator with the highest availability, either in bandwidth or in number of slaves, active at all times.
arp_interval=<time_in_milliseconds>
ARP
monitoring occurs.
Important
arp_interval
and arp_ip_target
parameters are specified, or, alternatively, the miimon
parameter is specified. Failure to do so can cause degradation of network performance in the event that a link fails.
mode=0
or mode=1
(the two load-balancing modes), the network switch must be configured to distribute packets evenly across the NICs. For more information on how to accomplish this, see https://www.kernel.org/doc/Documentation/networking/bonding.txt.
0
by default, which disables it.
arp_ip_target=<ip_address>[,<ip_address_2>,…<ip_address_16>]
IP
address of ARP
requests when the arp_interval
parameter is enabled. Up to 16 IP
addresses can be specified in a comma separated list.
arp_validate=<value>
ARP
probes; default is none
. Other valid values are active
, backup
, and all
.
downdelay=<time_in_milliseconds>
miimon
parameter. The value is set to 0
by default, which disables it.
fail_over_mac=<value>
none
or 0
— Default setting. This setting disables fail_over_mac
, and causes bonding to set all slaves of an active-backup bond to the same MAC address at enslavement time.
active
or 1
— The “active”> fail_over_mac
policy indicates that the MAC address of the bond should always be the MAC address of the currently active slave. The MAC address of the slaves is not changed; instead, the MAC address of the bond changes during a failover.
follow
or 2
— The “follow” fail_over_mac
policy causes the MAC address of the bond to be selected normally (normally the MAC address of the first slave added to the bond). However, the second and subsequent slaves are not set to this MAC address while they are in a backup role; a slave is programmed with the bond's MAC address at failover time (and the formerly active slave receives the newly active slave's MAC address).
slow
or 0
— Default setting. This specifies that partners should transmit LACPDUs every 30 seconds.
fast
or 1
— Specifies that partners should transmit LACPDUs every 1 second.
miimon=<time_in_milliseconds>
~]# ethtool <interface_name> | grep "Link detected:"
eth0
, not the bond interface. If MII is supported, the command returns:
Link detected: yes
0
(the default), turns this feature off. When configuring this setting, a good starting point for this parameter is 100
.
Important
arp_interval
and arp_ip_target
parameters are specified, or, alternatively, the miimon
parameter is specified. Failure to do so can cause degradation of network performance in the event that a link fails.
mode=<value>
balance-rr
or 0
— Sets a round-robin policy for fault tolerance and load balancing. Transmissions are received and sent out sequentially on each bonded slave interface beginning with the first one available.
active-backup
or 1
— Sets an active-backup policy for fault tolerance. Transmissions are received and sent out via the first available bonded slave interface. Another bonded slave interface is only used if the active bonded slave interface fails.
balance-xor
or 2
— Transmissions are based on the selected hash policy. The default is to derive a hash by XOR of the source and destination MAC addresses multiplied by the modulo of the number of slave interfaces. In this mode traffic destined for specific peers will always be sent over the same interface. As the destination is determined by the MAC addresses this method works best for traffic to peers on the same link or local network. If traffic has to pass through a single router then this mode of traffic balancing will be suboptimal.
broadcast
or 3
— Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
802.3ad
or 4
— Sets an IEEE 802.3ad dynamic link aggregation policy. Creates aggregation groups that share the same speed and duplex settings. Transmits and receives on all slaves in the active aggregator. Requires a switch that is 802.3ad compliant.
balance-tlb
or 5
— Sets a Transmit Load Balancing (TLB) policy for fault tolerance and load balancing. The outgoing traffic is distributed according to the current load on each slave interface. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed slave. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.
balance-alb
or 6
— Sets an Adaptive Load Balancing (ALB) policy for fault tolerance and load balancing. Includes transmit and receive load balancing for IPv4
traffic. Receive load balancing is achieved through ARP
negotiation. This mode is only suitable for local addresses known to the kernel bonding module and therefore cannot be used behind a bridge with virtual machines.
primary=<interface_name>
eth0
, of the primary device. The primary
device is the first of the bonding interfaces to be used and is not abandoned unless it fails. This setting is particularly useful when one NIC in the bonding interface is faster and, therefore, able to handle a bigger load.
active-backup
mode. See https://www.kernel.org/doc/Documentation/networking/bonding.txt for more information.
primary_reselect=<value>
always
or 0
(default) — The primary slave becomes the active slave whenever it comes back up.
better
or 1
— The primary slave becomes the active slave when it comes back up, if the speed and duplex of the primary slave is better than the speed and duplex of the current active slave.
failure
or 2
— The primary slave becomes the active slave only if the current active slave fails and the primary slave is up.
primary_reselect
setting is ignored in two cases:
primary_reselect
policy via sysfs
will cause an immediate selection of the best active slave according to the new policy. This may or may not result in a change of the active slave, depending upon the circumstances
resend_igmp=range
0
to 255
; the default value is 1
. A value of 0
prevents the IGMP membership report from being issued in response to the failover event.
balance-rr
(mode 0), active-backup
(mode 1), balance-tlb
(mode 5) and balance-alb
(mode 6), in which a failover can switch the IGMP traffic from one slave to another. Therefore a fresh IGMP report must be issued to cause the switch to forward the incoming IGMP traffic over the newly selected slave.
updelay=<time_in_milliseconds>
miimon
parameter. The value is set to 0
by default, which disables it.
use_carrier=<number>
miimon
should use MII/ETHTOOL ioctls or netif_carrier_ok()
to determine the link state. The netif_carrier_ok()
function relies on the device driver to maintains its state with netif_carrier_on/off
; most device drivers support this function.
netif_carrier_on/off
.
1
— Default setting. Enables the use of netif_carrier_ok()
.
0
— Enables the use of MII/ETHTOOL ioctls.
Note
netif_carrier_on/off
.
xmit_hash_policy=<value>
balance-xor
and 802.3ad
modes. Possible values are:
0
or layer2
— Default setting. This parameter uses the XOR of hardware MAC addresses to generate the hash. The formula used is:
(<source_MAC_address> XOR <destination_MAC>) MODULO <slave_count>
1
or layer3+4
— Uses upper layer protocol information (when available) to generate the hash. This allows for traffic to a particular network peer to span multiple slaves, although a single connection will not span multiple slaves.
((<source_port> XOR <dest_port>) XOR
((<source_IP> XOR <dest_IP>) AND 0xffff
)
MODULO <slave_count>
IP
protocol traffic, the source and destination port information is omitted. For non-IP
traffic, the formula is the same as the layer2
transmit hash policy.
2
or layer2+3
— Uses a combination of layer2 and layer3 protocol information to generate the hash.
IP
addresses to generate the hash. The formula is:
(((<source_IP> XOR <dest_IP>) AND 0xffff
) XOR
( <source_MAC> XOR <destination_MAC> ))
MODULO <slave_count>
IP
traffic, the formula is the same as for the layer2 transmit hash policy.