HAProxy Enterprise Documentation 10.5

Link Aggregation

Link aggregation, which is also known as link bonding, joins multiple network interfaces to form a single, unified interface to:

  • increase throughput, and/or

  • provide redundancy in case one of the links fails.

Create a bonding

  1. In the Services tab, click network setup setup_icon to display the current configuration of your network interfaces.

    https://cdn.haproxy.com/documentation/aloha/10-5/assets/interface_setup_bonding-fa9150a69f20efe3af0a4ad78b52e18da894956799caafbd0d266b00df7a9172.png

    Three network interfaces are defined: lo, eth0, and eth1.

    service network lo
      ip address 127.0.0.
    
    service network eth0
      auto on
      ip autoconfig
      ip address 192.168.0.200/255.255.255.0
      ip route default 192.168.0.1
    
    service network eth1
      auto on
  2. Remove any IP configuration from any interfaces you wish to bond together.

    Note

    When a network interface is part of a bond, it cannot have an IP configuration.

    We prepare to bond the eth0 and eth1 interfaces by removing the ip rules from them.

    service network lo
      ip address 127.0.0.1/9
    
    service network eth0
      auto on
    
    service network eth1
      auto on
  3. Use the service network directive to create a new interface that will serve as the bonded interface.

    • Set the bonding primary directive to the name of the first interface

    • Set the slave directive to the names of the interfaces that will be bonded

    • Set the ip address directive to the IP address to bind to this new interface

    We crete a new interface named bond0.

    service network lo
      ip address 127.0.0.1/9
    
    service network eth0
      auto on
    
    service network eth1
      auto on
    
    service network bond0
      bonding primary eth0
      slave eth0 eth1
      ip address 172.16.24.237/24
  4. Configure the bond mode:

    • Set the bonding mode directive to one of the supported bonding mode values.

    Failover mode with one active interface at a time

    Create a bond0 interface in active/passive mode on top of interfaces eth0 and eth1:

    service network eth0
      auto on
    
    service network eth1
      auto on
    
    service network bond0
      bonding primary eth0
      slave eth0 eth1
      ip address 172.16.24.237/24
      bonding mode active-backup

    IEEE 802.3ad (LACP) Dynamic link aggregation

    Create a bond0 interface in active/active mode on top of interfaces eth0 and eth1:

    service network eth0
      auto on
    
    service network eth1
      auto on
    
    service network bond1
      bonding primary eth0
      slave eth0 eth1
      ip address 172.16.24.237/24
      bonding mode 802.3ad
  5. Do one of the following.

    • If you updated an existing bond interface, reload the network interface.

    • If you created a new bond interface, restart the network interface.

Available settings

The following settings are available to configure the bonding interface:

Parameter

Description

slave <iface> <iface>...

interfaces to add in the bond

bonding primary <iface>

primary slave for current bond

bonding mode <mode>

bonding mode (default: 1 or active-backup)

bonding updelay <ms>

bonding delay check in ms (default: 1000)

bonding downdelay <ms>

bonding delay check in ms (default: 1000)

Available modes

The following table shows which bonding modes are supported.

Mode number

Mode code

Description

O

balance-rr

Select output interfaces in a round-robin fashion.

1

active-backup

Failover mode with one active interface at a time.

2

balance-xor

Transmit based on MAC address.

The default policy is a source+destination MAC address algorithm. You can select alternate transmit policies through the xmit-hash-policy directive.

3

broadcast

Not supported.

4

802.3ad

You can bundle several physical ports to form a single logical channel through the Link Aggregation Control Protocol (LACP), which is part of the IEEE specification 802.3ad.

Prerequisites:
  • Ethtool support in drivers to retrieve the speed and duplex of each slave.

  • A switch that supports IEEE 802.3ad Dynamic link aggregation.

5

balance-tlb

Transmit load balancing. The outgoing interface is selected based on interfaces load.

Prerequisites:
  • Ethtool support in drivers to retrieve the speed and duplex of each slave.

6

balance-alb

Adaptive load balancing; balance-tlb mode with a reception load balancing mode made using the ARP protocol.

Troubleshooting

When the bonding configuration is correctly set up:

  • The bondX interface has at least the MASTER and MULTICAST labels

  • The ethX interfaces have at least the SLAVE and MULTICAST labels

  • Both bondX and associated ethX are UP

  • The bondX and ethX interfaces have the same MAC address

bond0 Link encap:Ethernet HWaddr 00:0D:B9:13:52:2D
   inet addr:10.0.32.10 Bcast:0.0.0.0 Mask:255.255.0.0
   UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
   RX packets:0 errors:0 dropped:0 overruns:0 frame:0
   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
   collisions:0 txqueuelen:0
   RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
eth0 Link encap:Ethernet HWaddr 00:0D:B9:13:52:2D
   UP BROADCAST NOARP SLAVE MULTICAST MTU:1500 Metric:1
   RX packets:0 errors:0 dropped:0 overruns:0 frame:0
   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
   collisions:0 txqueuelen:1000
   RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
   Interrupt:11 Base address:0x2000
eth1 Link encap:Ethernet HWaddr 00:0D:B9:13:52:2D
   UP BROADCAST NOARP SLAVE MULTICAST MTU:1500 Metric:1
   RX packets:0 errors:0 dropped:0 overruns:0 frame:0
   TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
   collisions:0 txqueuelen:1000
   RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
   Interrupt:12 Base address:0x4000

Advanced parameter: xmit-hash-policy

When used in active/active mode (i.e. bonding mode is set to 802.3ad), the choice of which network interface to use for outbound traffic is made using the destination MAC address.

In some cases, for example, when the traffic to your default gateway is higher than a single network interface capacity, you can change the xmit-hash-policy by setting the /sys parameter.

  1. Add a xmit-hash-policy directive using the syntax below:

    bonding xmit_hash_policy <policyid>

The <policyid> can have two values and describes the information used to compute the hash algorithm:

0 or layer2

Use the destination MAC address

1 or layer3+4

When available, use source and destination IPs and ports

Change xmit_hash_policy to 1 for bonding1:

service network bond1
  slave eth0 eth1
  bonding primary eth0
  bonding mode 802.3ad
  ip address 172.16.24.237/24
  bonding xmit_hash_policy 1

Next up

Network Interfaces