Product SiteDocumentation Site

30.5.2. The Channel Bonding Module

Fedora allows administrators to bind NICs together into a single channel using the bonding kernel module and a special network interface, called a channel bonding interface. Channel bonding enables two or more network interfaces to act as one, simultaneously increasing the bandwidth and providing redundancy.
To channel bond multiple network interfaces, the administrator must perform the following steps:
  1. Add the following line to /etc/modprobe.conf:
    alias bond<N> bonding
    Replace <N> with the interface number, such as 0. For each configured channel bonding interface, there must be a corresponding entry in /etc/modprobe.conf.
  2. Configure a channel bonding interface as outlined in Section 4.2.3, “Channel Bonding Interfaces”.
  3. To enhance performance, adjust available module options to ascertain what combination works best. Pay particular attention to the miimon or arp_interval and the arp_ip_target parameters. Refer to Section 30.5.2.1, “ bonding Module Directives” for a listing of available options.
  4. After testing, place preferred module options in /etc/modprobe.conf.

30.5.2.1.  bonding Module Directives

Before finalizing the settings for the bonding module, it is a good idea to test which settings work best. To do this, open a shell prompt as root and type:
tail -f /var/log/messages

Open another shell prompt and use the /sbin/insmod command to load the bonding module with different parameters while observing the kernel messages for errors.
The /sbin/insmod command is issued in the following format:
 /sbin/insmod bond<N> <parameter=value> 

Replace <N> with the number for the bonding interface. Replace <parameter=value> with a space separated list of desired parameters for the interface.
Once satisfied with the performance of the bonding interface (and verifying that there are no errors), add the appropriate bonding module parameters to ifcfg-bond<N> (where <N> is the number of the interface). These parameters are set as BONDING_OPTS="<parameters>". For more information, refer to Section 4.2.3, “Channel Bonding Interfaces”.
The following is a list of available parameters for the bonding module:
  • mode= — Specifies one of four policies allowed for the bonding module. Acceptable values for this parameter are:
    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.
    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.
    2 — Sets an XOR (exclusive-or) policy for fault tolerance and load balancing. Using this method, the interface matches up the incoming request's MAC address with the MAC address for one of the slave NICs. Once this link is established, transmissions are sent out sequentially beginning with the first available interface.
    3 — Sets a broadcast policy for fault tolerance. All transmissions are sent on all slave interfaces.
    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.
    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.
    6 — Sets an Active 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.
  • miimon= — Specifies (in milliseconds) how often MII link monitoring occurs. This is useful if high availability is required because MII is used to verify that the NIC is active. To verify that the driver for a particular NIC supports the MII tool, type the following command as root:
    ethtool <interface-name> | grep "Link detected:"
    In this command, replace <interface-name> with the name of the device interface, such as eth0, not the bond interface. If MII is supported, the command returns:
    Link detected: yes
    If using a bonded interface for high availability, the module for each NIC must support MII.
    Setting the value to 0 (the default), turns this feature off. When configuring this setting, a good starting point for this parameter is 100.
  • downdelay= — Specifies (in milliseconds) how long to wait after link failure before disabling the link. The value must be a multiple of the value specified in the miimon parameter. The value is set to 0 by default, which disables it.
  • updelay= — Specifies (in milliseconds) how long to wait before enabling a link. The value must be a multiple of the value specified in the miimon parameter. The value is set to 0 by default, which disables it.
  • arp_interval= — Specifies (in milliseconds) how often ARP monitoring occurs.
    If using this setting while in mode 0 or 2 (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, refer to
    /usr/share/doc/kernel-doc-<kernel-version>/Documentation/networking/ bonding.txt
    The value is set to 0 by default, which disables it.
  • arp_ip_target= — Specifies the target 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= — validate source/distribution of ARP probes; default is none. Other valid values are active, backup, and all.
  • lacp_rate= — Specifies the rate at which link partners should transmit LACPDU packets in 802.3ad mode. Possible values are:
    • 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.
  • primary= — Specifies the interface name, such as 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.
    This setting is only valid when the bonding interface is in active-backup mode. Refer to
    /usr/share/doc/kernel-doc-<kernel-version>/Documentation/networking/ bonding.txt
    for more information.
  • use_carrier= — Specifies whether or not miimon should use MII/ETHTOOL ioctls or netif_carrier_ok() to determine the link state. The netif_carrier_ok() relies on the device driver to maintains its state with netif_carrier_on/off ; most device drivers support this function.
    The MII/ETHROOL ioctls tools utilize a deprecated calling sequence within the kernel. However, this is still configurable in case your device driver does not support netif_carrier_on/off .
    Valid values are:
    • 1 — Default setting. Enables the use of netif_carrier_ok().
    • 0 — Enables the use of MII/ETHTOOL ioctls.

    Tip

    If bonding insists that the link is up when it should not be, it is possible that your network device driver does not support netif_carrier_on/off .
  • xmit_hash_policy — Selects the transmit hash policy used for slave selection in balance-xor and 802.3ad modes. Possible values are:
    • 0 or layer2 — Default setting. This option uses the XOR of hardware MAC addresses to generate the hash. The formula used is:
      (<source> <MAC> <XOR> <destination> <MAC>) <modulo slave count>
      
      
      This algorithm will place all traffic to a particular network peer on the same slave, and is 802.3ad compliant.
    • 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.
      The formula for unfragmented TCP and UDP packets used is:
      ((<source> <port> <XOR> <destination>) <XOR>
      	((<source> <IP> <XOR> <destination> <IP>) AND 0xffff)
      		<modulo slave count>
      
      
      For fragmented TCP or UDP packets and all other 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.
      This policy intends to mimic the behavior of certain switches; particularly, Cisco switches with PFC2 as well as some Foundry and IBM products.
      The algorithm used by this policy is not 802.3ad compliant.

Important

It is essential that either the arp_interval and arp_ip_target or miimon parameters are specified. Failure to due so can cause degradation of network performance in the event a link fails.
Refer to the following file for more information (note that you must have the kernel-doc package installed to read this file):
 /usr/share/doc/kernel-doc-<kernel-version>/Documentation/networking/ bonding.txt 

for detailed instructions regarding bonding interfaces.