Configure a network bond
A network bond aggregates physical and virtual network interfaces into a single logical one. The kernel exclusively handles all operations. You can create bonds on different device types, such as Ethernet or VLANs, for higher throughput or redundancy.
Red Hat Enterprise Linux provides administrators different options to configure bond devices. For example:
- Use
nmclito configure bond connections using the command line. - Use the RHEL web console to configure bond connections using a web browser.
- Use
nmtuito configure bond connections in a text-based user interface. - Use
nmstatectlto configure bond connections through the Nmstate API. - Use RHEL system roles to automate the bond configuration on one or multiple hosts.
Default behavior of controller and port interfaces Copy linkLink copied!
Understanding the default behavior of NetworkManager when managing bond port interfaces helps you to troubleshoot problems more effectively.
Default behavior:
- Starting the controller interface does not automatically start the port interfaces.
- Starting a port interface always starts the controller interface.
- Stopping the controller interface also stops the port interface.
- A controller without ports can start static IP connections.
- A controller without ports waits for ports when starting DHCP connections.
- A controller with a DHCP connection waiting for ports completes when you add a port with a carrier.
- A controller with a DHCP connection waiting for ports continues waiting when you add a port without a carrier.
Upstream switch configuration depending on the bonding modes Copy linkLink copied!
Depending on the bonding mode you want to use, you must configure the ports on the switch.
| Bonding mode | Configuration on the switch |
|---|---|
|
|
Requires static EtherChannel enabled, not Link Aggregation Control Protocol (LACP)-negotiated. |
|
|
No configuration required on the switch. |
|
|
Requires static EtherChannel enabled, not LACP-negotiated. |
|
|
Requires static EtherChannel enabled, not LACP-negotiated. |
|
|
Requires LACP-negotiated EtherChannel enabled. |
|
|
No configuration required on the switch. |
|
|
No configuration required on the switch. |
|
|
No configuration required on the switch. |
For details on how to configure your switch, see the documentation of the switch.
Certain network bonding features, such as the fail-over mechanism, do not support direct cable connections without a network switch.
Configure a network bond by using nmcli Copy linkLink copied!
To configure a network bond on the command line, use the nmcli utility.
Before you begin Copy linkLink copied!
- Two or more physical or virtual network devices are installed on the server.
- To use Ethernet devices as ports of the bond, the physical or virtual Ethernet devices must be installed on the server.
- To use bridge or Virtual Local Area Network (VLAN) devices as ports of the bond, you can either create these devices while you create the bond or you can create them in advance as described in:
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Temporarily remove the network cable from one of the network devices and check if the other device in the bond is handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools that deactivate connections, such as
nmcli, show only the bonding driver’s ability to handle port configuration changes and not actual link failure events. - Display the status of the bond:
# cat /proc/net/bonding/bond0
Configure a network bond by using the RHEL web console Copy linkLink copied!
Use the RHEL web console to configure a network bond if you prefer to manage network settings using a web browser-based interface.
Before you begin Copy linkLink copied!
- You are logged in to the RHEL web console.
- Two or more physical or virtual network devices are installed on the server.
- To use Ethernet devices as members of the bond, the physical or virtual Ethernet devices must be installed on the server.
- To use bridge or Virtual Local Area Network (VLAN) devices as members of the bond, create them in advance as described in:
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Select the Networking tab in the navigation on the left side of the screen, and check if there is incoming and outgoing traffic on the interface.
- Temporarily remove the network cable from one of the network devices and check if the other device in the bond is handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools that deactivate connections, such as the web console, show only the bonding driver’s ability to handle member configuration changes and not actual link failure events.
- Display the status of the bond:
# cat /proc/net/bonding/bond0
Configure a network bond by using nmtui Copy linkLink copied!
The nmtui application provides a text-based user interface for NetworkManager. You can use nmtui to configure a network bond on a host without a graphical interface.
Before you begin Copy linkLink copied!
- Two or more physical or virtual network devices are installed on the server.
- To use Ethernet devices as ports of the bond, the physical or virtual Ethernet devices must be installed on the server.
About this task Copy linkLink copied!
In nmtui:
- Navigate by using the cursor keys.
- Press a button by selecting it and hitting Enter.
- Select and clear checkboxes by using Space.
- To return to the previous screen, use ESC.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Temporarily remove the network cable from one of the network devices and check if the other device in the bond is handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools that deactivate connections, such as
nmcli, show only the bonding driver’s ability to handle port configuration changes and not actual link failure events. - Display the status of the bond:
# cat /proc/net/bonding/bond0
Configure a network bond by using nmstatectl Copy linkLink copied!
You can use the declarative Nmstate API to configure a network bond. Nmstate ensures that the result matches the configuration file or rolls back the changes.
Before you begin Copy linkLink copied!
- Two or more physical or virtual network devices are installed on the server.
- To use Ethernet devices as ports in the bond, the physical or virtual Ethernet devices must be installed on the server.
- To use bridge or Virtual Local Area Network (VLAN) devices as ports in the bond, set the interface name in the
portlist, and define the corresponding interfaces. - The
nmstatepackage is installed.
About this task Copy linkLink copied!
Depending on your environment, adjust the YAML file accordingly. For example, to use different devices than Ethernet adapters in the bond, adapt the base-iface attribute and type attributes of the ports you use in the bond.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Display the status of the devices and connections:
# nmcli device statusDEVICE TYPE STATE CONNECTION bond0 bond connected bond0 - Display all settings of the connection profile:
# nmcli connection show bond0connection.id: bond0 connection.uuid: 79cbc3bd-302e-4b1f-ad89-f12533b818ee connection.stable-id: -- connection.type: bond connection.interface-name: bond0 ... - Display the connection settings in YAML format:
# nmstatectl show bond0
Configure a network bond by using the network RHEL system role Copy linkLink copied!
You can use the network RHEL system role to configure a network bond and, if a connection profile for the bond’s parent device does not exist, the role can create it as well.
Before you begin Copy linkLink copied!
- You have prepared the control node and the managed nodes.
- You are logged in to the control node as a user who can run playbooks on the managed nodes.
- The account you use to connect to the managed nodes has
sudopermissions for these nodes. - Two or more physical or virtual network devices are installed on the server.
About this task Copy linkLink copied!
You can combine network interfaces in a bond to provide a logical interface with higher throughput or redundancy. To configure a bond, create a NetworkManager connection profile. By using Ansible and the network RHEL system role, you can automate this process and remotely configure connection profiles on the hosts defined in a playbook.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- Temporarily remove the network cable from one of the network devices and check if the other device in the bond is handling the traffic.
Note that there is no method to properly test link failure events using software utilities. Tools that deactivate connections, such as
nmcli, show only the bonding driver’s ability to handle port configuration changes and not actual link failure events.
The different network bonding modes Copy linkLink copied!
Bonding aggregates multiple network interfaces into a single logical one. The behavior of a bonded interface depends on its bonding policy, also known as mode, which provides either load-balancing or hot standby services.
The Linux bonding driver supports the following modes:
- Balance-rr (Mode 0)
-
Balance-rruses the round-robin algorithm that sequentially transmits packets from the first available port to the last one. This mode provides load balancing and fault tolerance.This mode requires switch configuration of a port aggregation group, also called EtherChannel or similar port grouping. An EtherChannel is a port link aggregation technology to group multiple physical Ethernet links to one logical Ethernet link.
The drawback of this mode is that it is not suitable for heavy workloads and if TCP throughput or ordered packet delivery is essential.
- Active-backup (Mode 1)
-
Active-backupuses the policy that determines that only one port is active in the bond. This mode provides fault tolerance and does not require any switch configuration.If the active port fails, an alternate port becomes active. The bond sends a gratuitous address resolution protocol (ARP) response to the network. The gratuitous ARP forces the receiver of the ARP frame to update their forwarding table. The
Active-backupmode transmits a gratuitous ARP to announce the new path to maintain connectivity for the host.The
primaryoption defines the preferred port of the bonding interface. - Balance-xor (Mode 2)
-
Balance-xoruses the selected transmit hash policy to send the packets. This mode provides load balancing, fault tolerance, and requires switch configuration to configure an Etherchannel or similar port grouping.To alter packet transmission and balance transmit, this mode uses the
xmit_hash_policyoption. Depending on the source or destination of traffic on the interface, the interface requires an additional load-balancing configuration. See description xmit_hash_policy bonding parameter. - Broadcast (Mode 3)
-
Broadcastuses a policy that transmits every packet on all interfaces. This mode provides fault tolerance and requires a switch configuration to configure an EtherChannel or similar port grouping.The drawback of this mode is that it is not suitable for heavy workloads and if TCP throughput or ordered packet delivery is essential.
- 802.3ad (Mode 4)
-
802.3aduses the same-named IEEE standard dynamic link aggregation policy. This mode provides fault tolerance. This mode requires switch configuration to configure a Link Aggregation Control Protocol (LACP) port grouping.This mode creates aggregation groups that share the same speed and duplex settings and uses all ports in the active aggregator. Depending on the source or destination of traffic on the interface, this mode requires an additional load-balancing configuration.
By default, the port selection for outgoing traffic depends on the transmit hash policy. Use the
xmit_hash_policyoption of the transmit hash policy to change the port selection and balance transmit.The difference between the
802.3adand theBalance-xoris compliance. The802.3adpolicy negotiates LACP between the port aggregation groups. See description xmit_hash_policy bonding parameter - Balance-tlb (Mode 5)
-
Balance-tlbuses the transmit load balancing policy. This mode provides fault tolerance, load balancing, and establishes channel bonding that does not require any switch support.The active port receives the incoming traffic. In case of failure of the active port, another one takes over the MAC address of the failed port. To decide which interface processes the outgoing traffic, use one of the following modes:
- Value
0: Uses the hash distribution policy to distribute traffic without load balancing - Value
1: Distributes traffic to each port by using load balancingWith the bonding option
tlb_dynamic_lb=0, this bonding mode uses thexmit_hash_policybonding option to balance transmit. Theprimaryoption defines the preferred port of the bonding interface.
See description xmit_hash_policy bonding parameter.
- Value
- Balance-alb (Mode 6)
-
Balance-albuses an adaptive load balancing policy. This mode provides fault tolerance, load balancing, and does not require any special switch support.This mode Includes balance-transmit load balancing (
balance-tlb) and receive-load balancing for IPv4 and IPv6 traffic. The bonding intercepts ARP replies sent by the local system and overwrites the source hardware address of one of the ports in the bond. ARP negotiation manages the receive-load balancing. Therefore, different ports use different hardware addresses for the server.The
primaryoption defines the preferred port of the bonding interface. With the bonding optiontlb_dynamic_lb=0, this bonding mode uses thexmit_hash_policybonding option to balance transmit. See description xmit_hash_policy bonding parameter.
Additionally, you can use NetworkManager to configure the following mode:
- Balance-slb
-
The source load balancing (SLB) bonding mode distributes outgoing data streams across multiple network interfaces based on the source address of the traffic and a Virtual Local Area Network (VLAN) hash. This mode does not require any switch configuration.
NetworkManager uses the
balance-xormode in combination withnftablesrules to provide SLB. For details about configuring this mode, see Red Hat Knowledgebase solution Configuring a network bond on RHEL with source load balancing.
The xmit_hash_policy bonding parameter Copy linkLink copied!
The xmit_hash_policy load balancing parameter selects the transmit hash policy for a node selection in the balance-xor, 802.3ad, balance-alb, and balance-tlb modes. It is only applicable to mode 5 and 6 if the tlb_dynamic_lb parameter is 0.
The possible values of tlb_dynamic_lb are layer2, layer2+3, layer3+4, encap2+3, encap3+4, and vlan+srcmac.
Refer the table for details:
|
Policy or Network layers |
Layer2 |
Layer2+3 |
Layer3+4 |
encap2+3 |
encap3+4 |
VLAN+srcmac |
|
Uses |
XOR of source and destination MAC addresses and Ethernet protocol type |
XOR of source and destination MAC addresses and IP addresses |
XOR of source and destination ports and IP addresses |
XOR of source and destination MAC addresses and IP addresses inside a supported tunnel, for example, Virtual Extensible LAN (VXLAN). This mode relies on |
XOR of source and destination ports and IP addresses inside a supported tunnel, for example, VXLAN. This mode relies on |
XOR of VLAN ID and source MAC vendor and source MAC device |
|
Placement of traffic |
All traffic to a particular network peer on the same underlying network interface |
All traffic to a particular IP address on the same underlying network interface |
All traffic to a particular IP address and port on the same underlying network interface |
|||
|
Primary choice |
If network traffic is between this system and multiple other systems in the same broadcast domain |
If network traffic between this system and multiple other systems goes through a default gateway |
If network traffic between this system and another system uses the same IP addresses but goes through multiple ports |
The encapsulated traffic is between the source system and multiple other systems using multiple IP addresses |
The encapsulated traffic is between the source system and other systems using multiple port numbers |
If the bond carries network traffic, from multiple containers or virtual machines (VM), that expose their MAC address directly to the external network such as the bridge network, and you cannot configure a switch for Mode 2 or Mode 4 |
|
Secondary choice |
If network traffic is mostly between this system and multiple other systems behind a default gateway |
If network traffic is mostly between this system and another system |
||||
|
Compliant |
802.3ad |
802.3ad |
Not 802.3ad |
|||
|
Default policy |
This is the default policy if no configuration is provided |
For non-IP traffic, the formula is the same as for the |
For non-IP traffic, the formula is the same as for the |