Network

Link aggregation

This page applies to:

  • HAProxy ALOHA - all versions

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.

Configure bonded interfaces Jump to heading

To configure link aggregation, you’ll join two existing, physical network interfaces, such as eth1 and eth2, to create a new network interface.

To bond two network interfaces together via the web UI:

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

    Interface Setup Bonding

  2. Remove any IP configuration from any interfaces you wish to bond together. When a network interface is part of a bond, it can’t have an IP configuration.

    Below, we prepare to bond the eth1 and eth2 interfaces by removing the ip rules from them.

    service network eth1 auto on service network eth2 auto on
    service network eth1 auto on service network eth2 auto on
  3. Add a service network section to create a new interface that will serve as the bonded interface.

    The type of bonding depends on the bonding mode directive. Below, we show common configurations, but refer to the bonding modes section for more information.

    • Active-backup - To enable failover with one active interface at a time, create a bond1 interface in active-passive mode with slave set to the interfaces eth1 and eth2.

      service network eth1 auto on service network eth2 auto on service network bond1 type bonding bonding mode active-backup bonding primary eth1 slave eth1 eth2 ip address 172.16.24.5/24
      service network eth1 auto on service network eth2 auto on service network bond1 type bonding bonding mode active-backup bonding primary eth1 slave eth1 eth2 ip address 172.16.24.5/24
    • 802.3ad - To set up IEEE 802.3ad (LACP) Dynamic link aggregation, create a bond1 interface in 802.3ad mode with slave set to the interfaces eth1 and eth2.

      service network eth1 auto on service network eth2 auto on service network bond1 type bonding bonding mode 802.3ad slave eth1 eth2 ip address 172.16.24.5/24
      service network eth1 auto on service network eth2 auto on service network bond1 type bonding bonding mode 802.3ad slave eth1 eth2 ip address 172.16.24.5/24
  4. Click OK and Close to return to the Services tab.

  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.

    In versions newer than 16.0, click the Apply new configuration button on the interface to apply the changes and automatically restart the network interface service.

  6. To make your changes persistent after a reboot, click the Setup tab. Then click Save under Configuration.

This method applies to HAProxy ALOHA 16.5 and newer

To bond two network interfaces together via the Network Management CLI:

  1. If you haven’t already done so, install the Network Management CLI.

  2. Go to the Tools tab and click Launch terminal.

  3. Create a new interface that will serve as the bonded interface. Below, we use the netctl connection add and netctl connection up commands to define a bonded interface having a connection.id of bond1.

    The type of bonding depends on the mode. Below, we show common configurations, but refer to the bonding modes section for more information.

    • Active-backup - To enable failover with one active interface at a time, set the active-backup mode. We set the primary interface to eth1.

      nix
      sudo netctl connection add connection.type bond \
      connection.id bond1 \
      connection.interface-name bond1 \
      bond.options mode=active-backup,primary=eth1 \
      ipv4.addresses 172.16.100.5/24
      sudo netctl connection up bond1
      nix
      sudo netctl connection add connection.type bond \
      connection.id bond1 \
      connection.interface-name bond1 \
      bond.options mode=active-backup,primary=eth1 \
      ipv4.addresses 172.16.100.5/24
      sudo netctl connection up bond1
      output
      text
      Warning: service/instance not found in /var/state/network.rc, using default values.
      # Stopping network[bond1] ...
      ==> stop network[bond1] : Done.
      # Starting network[bond1] ...
      ==> modprobe bonding: Done.
      ==> create bonding master bond1: Done.
      ==> start network[bond1] : Done.
      RTNETLINK answers: File exists
      ==> load ip config network[bond1] : Done.
      Connection successfully activated
      output
      text
      Warning: service/instance not found in /var/state/network.rc, using default values.
      # Stopping network[bond1] ...
      ==> stop network[bond1] : Done.
      # Starting network[bond1] ...
      ==> modprobe bonding: Done.
      ==> create bonding master bond1: Done.
      ==> start network[bond1] : Done.
      RTNETLINK answers: File exists
      ==> load ip config network[bond1] : Done.
      Connection successfully activated
    • 802.3ad - To set up IEEE 802.3ad (LACP) Dynamic link aggregation, set the 802.3ad mode.

      nix
      sudo netctl connection add connection.type bond \
      connection.id bond1 \
      connection.interface-name bond1 \
      bond.options mode=802.3ad \
      ipv4.addresses 172.16.100.5/24
      sudo netctl connection up bond1
      nix
      sudo netctl connection add connection.type bond \
      connection.id bond1 \
      connection.interface-name bond1 \
      bond.options mode=802.3ad \
      ipv4.addresses 172.16.100.5/24
      sudo netctl connection up bond1
      output
      text
      Warning: service/instance not found in /var/state/network.rc, using default values.
      # Stopping network[bond1] ...
      ==> stop network[bond1] : Done.
      # Starting network[bond1] ...
      ==> modprobe bonding: Done.
      ==> create bonding master bond1: Done.
      ==> start network[bond1] : Done.
      ==> load ip config network[bond1] : Done.
      Connection successfully activated
      output
      text
      Warning: service/instance not found in /var/state/network.rc, using default values.
      # Stopping network[bond1] ...
      ==> stop network[bond1] : Done.
      # Starting network[bond1] ...
      ==> modprobe bonding: Done.
      ==> create bonding master bond1: Done.
      ==> start network[bond1] : Done.
      ==> load ip config network[bond1] : Done.
      Connection successfully activated
  4. Indicate which interfaces to bond by replacing their connection profiles with new profiles that set connection.slave-type bond and connection.master bond1.

    For example, here we use the netctl connection add and netctl connection up commands to replace the eth1 and eth2 profiles.

    nix
    sudo netctl connection add connection.type ethernet \
    connection.id bond1-eth1 \
    connection.interface-name eth1 \
    connection.slave-type bond\
    connection.master bond1
    sudo netctl connection up bond1-eth1
    sudo netctl connection add connection.type ethernet \
    connection.id bond1-eth2 \
    connection.interface-name eth2 \
    connection.slave-type bond \
    connection.master bond1
    sudo netctl connection up bond1-eth2
    nix
    sudo netctl connection add connection.type ethernet \
    connection.id bond1-eth1 \
    connection.interface-name eth1 \
    connection.slave-type bond\
    connection.master bond1
    sudo netctl connection up bond1-eth1
    sudo netctl connection add connection.type ethernet \
    connection.id bond1-eth2 \
    connection.interface-name eth2 \
    connection.slave-type bond \
    connection.master bond1
    sudo netctl connection up bond1-eth2
    output
    text
    Connection 'bond1-eth1' (5bd87600-df4c-4bfe-af1c-2c419c8f435b) successfully added.
    # Stopping network[eth1] ...
    ==> stop network[eth1] : Done.
    # Stopping network[bond1] ...
    ==> stop network[bond1] : Done.
    # Starting network[bond1] ...
    ==> start network[bond1] : Done.
    RTNETLINK answers: File exists
    ==> load ip config network[bond1] : Done.
    Connection successfully activated
    Connection 'bond1-eth2' (858f3aae-35f5-4b20-ace0-bdda0282ed30) successfully added.
    # Stopping network[eth2] ...
    ==> stop network[eth2] : Done.
    # Stopping network[bond1] ...
    ==> stop network[bond1] : Done.
    # Starting network[bond1] ...
    ==> start network[bond1] : Done.
    RTNETLINK answers: File exists
    ==> load ip config network[bond1] : Done.
    Connection successfully activated
    output
    text
    Connection 'bond1-eth1' (5bd87600-df4c-4bfe-af1c-2c419c8f435b) successfully added.
    # Stopping network[eth1] ...
    ==> stop network[eth1] : Done.
    # Stopping network[bond1] ...
    ==> stop network[bond1] : Done.
    # Starting network[bond1] ...
    ==> start network[bond1] : Done.
    RTNETLINK answers: File exists
    ==> load ip config network[bond1] : Done.
    Connection successfully activated
    Connection 'bond1-eth2' (858f3aae-35f5-4b20-ace0-bdda0282ed30) successfully added.
    # Stopping network[eth2] ...
    ==> stop network[eth2] : Done.
    # Stopping network[bond1] ...
    ==> stop network[bond1] : Done.
    # Starting network[bond1] ...
    ==> start network[bond1] : Done.
    RTNETLINK answers: File exists
    ==> load ip config network[bond1] : Done.
    Connection successfully activated
  5. Save the configuration to make your changes persistent after a reboot.

    nix
    sudo config save
    nix
    sudo config save

To verify, call ip address show to show network interfaces. The bond1 interface should show the MASTER and MULTICAST labels. The eth1 and eth2 interfaces should show the SLAVE and MULTICAST labels.

nix
ip address show
nix
ip address show
output
text
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP group default qlen 1000
link/ether 00:0c:29:a1:4c:5a brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP group default qlen 1000
link/ether 00:0c:29:a1:4c:5a brd ff:ff:ff:ff:ff:ff permaddr 00:0c:29:a1:4c:64
7: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:a1:4c:5a brd ff:ff:ff:ff:ff:ff
inet 172.16.100.5/24 scope global bond1
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea1:4c5a/64 scope link
valid_lft forever preferred_lft forever
output
text
3: eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP group default qlen 1000
link/ether 00:0c:29:a1:4c:5a brd ff:ff:ff:ff:ff:ff
4: eth2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master bond1 state UP group default qlen 1000
link/ether 00:0c:29:a1:4c:5a brd ff:ff:ff:ff:ff:ff permaddr 00:0c:29:a1:4c:64
7: bond1: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 00:0c:29:a1:4c:5a brd ff:ff:ff:ff:ff:ff
inet 172.16.100.5/24 scope global bond1
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fea1:4c5a/64 scope link
valid_lft forever preferred_lft forever

List connection profiles

You can also list connection profiles with the netctl connection command.

Network service reference Jump to heading

Here you will see all available link aggregation settings that you can use in the service network section.

Directives Jump to heading

The following directives 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)

Bonding modes Jump to heading

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 interface load.

Prerequisite:

  • 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 Jump to heading

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.

Example:

bond1 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) 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:11 Base address:0x2000 eth2 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
bond1 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) 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:11 Base address:0x2000 eth2 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 Jump to heading

When used in active/active mode (that is, 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.

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

    bonding xmit_hash_policy <policyid>
    bonding xmit_hash_policy <policyid>

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

Value Description
0 or layer2 Use the destination MAC address.
1 or layer3+4 When available, use source and destination IPs and ports.

Below, we change xmit_hash_policy to 1 for bonding1:

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

If you change the configuration, save the changes. To make your changes persistent after a reboot, click the Setup tab. Then click Save under Configuration.

See also Jump to heading

  • You can also configure link aggregation using the HAProxy Data Plane API. For details, see Link aggregation.

Do you have any suggestions on how we can improve the content of this page?