Link Aggregation in LACP Mode
Background
An Eth-Trunk in manual load balancing mode can increase the bandwidth. In manual mode, however, only member link disconnections can be detected. Other faults, such as link layer faults and incorrect link connections, cannot be detected.
The Link Aggregation Control Protocol (LACP) can be used to detect more fault types, improving fault tolerance of the Eth-Trunk, providing backup, and ensuring high reliability of member links.
LACP provides a standard negotiation mechanism that a switching device can use to create and start the aggregated link based on its configuration. LACP maintains the link status after the aggregated link is created and adjusts or removes the link if an aggregated link's status changes.
For example, in Figure 3-4, four interfaces on DeviceA should be connected to the corresponding interfaces on DeviceB, and these interfaces are all bundled into an Eth-Trunk. However, one interface on DeviceA has been connected to an interface on DeviceC. As a result, DeviceA may send data destined for DeviceB to DeviceC. If link aggregation in manual mode load balancing is used, this fault would go undetected.
In this situation, if LACP is enabled on DeviceA and DeviceB, the Eth-Trunk only selects active links (links connected to DeviceB) to forward data after negotiation. Data sent by DeviceA destined for DeviceB only reaches DeviceB.
Concepts
LACP system priority
LACP system priorities determine the sequence in which devices at two ends of an Eth-Trunk select active interfaces to join a LAG. In order for a LAG to be established, both devices must select the same interfaces as active interfaces. To achieve this, one device (with a higher priority) is responsible for selecting the active interfaces. The other device (with a lower priority) then selects the same interfaces as active interfaces. In priority comparisons, numerically lower values have higher priority.
LACP interface priority
Interface LACP priorities affect which interfaces of an Eth-Trunk are selected as active interfaces. The smaller the LACP interface priority value, the higher the LACP interface priority. The interfaces with the highest LACP interface priority become active interfaces.
Implementation of Link Aggregation in LACP Mode
LACP, as specified in IEEE 802.3ad, implements dynamic link aggregation and de-aggregation, allowing devices at both ends of the link to exchange Link Aggregation Control Protocol Data Units (LACPDUs).
After member interfaces are added to an Eth-Trunk in LACP mode, each device sends LACPDUs to inform the other device of its system priority, MAC address, member interface priorities, interface numbers, and keys. Keys are used to determine whether the remote end connected to each interface is in the same LAG and whether bandwidth of each interface is the same. The other device then compares this information with its own corresponding information, and selects which interfaces are to be aggregated. Both devices perform LACP negotiation to select active interfaces and links.
An Eth-Trunk in LACP mode is set up as follows:
Devices at both ends exchange LACPDUs.
As shown in Figure 3-5, create an Eth-Trunk in LACP mode on DeviceA and DeviceB and add member interfaces to the Eth-Trunk. Then enable LACP on the member interfaces. Both devices can then exchange LACPDUs.
Devices at both ends determine the Actor and active links.
As shown in Figure 3-6, when DeviceB receives LACPDUs from DeviceA, DeviceB checks and records information about DeviceA and compares system priorities. If the system priority of DeviceA is higher than that of DeviceB, DeviceA becomes the Actor. If DeviceA and DeviceB have the same system priority, the device with a smaller MAC address becomes the Actor.
After devices at both ends select the Actor, they select active interfaces according to the priorities of the Actor's interfaces. An Eth-Trunk is established when devices at both ends select the same interfaces as active interfaces. After Eth-Trunk is established, active links load balance data.
LACP preemption
When LACP preemption is enabled, interfaces with higher priorities in a LAG always function as active interfaces.
As shown in Figure 3-7, Port 1, Port 2, and Port 3 are member interfaces of an Eth-Trunk; DeviceA acts as the Actor; the upper threshold for the number of active interfaces is 2; LACP priorities of Port 1, Port 2, and Port 3 are 10, 20, and 30 respectively. When LACP negotiation is complete, Port 1 and Port 2 are selected as active interfaces because their LACP priorities are higher, and Port 3 is used as the backup interface.
LACP preemption has the following effects on selection of the active interfaces:
- LACP preemption allows the original active interface to be re-selected after recovering from a fault. For example, when Port 1 fails, Port 3 replaces Port 1 as the active interface. LACP preemption is not enabled on the Eth-Trunk by default, and Port 1 remains in the backup state after it recovers. If LACP preemption is enabled on the Eth-Trunk, Port 1 replaces Port 3 to become the active interface again.
- LACP preemption allows active interfaces to be re-selected when the LACP interface priority changes. For example, the LACP interface priority of Port 3 is changed to 5. If LACP preemption is enabled, Port 3 will replace Port 2 as an active interface.
LACP preemption delay
The LACP preemption delay is the time that a backup link waits before becoming the active link after LACP preemption occurs. The LACP preemption delay is used to prevent unstable data transmission over an Eth-Trunk link caused by frequent status changes of member links.
Switchover between active and inactive links
In LACP mode, a link switchover in a LAG is triggered if a device at one end detects one of the following events:
An active link goes Down.
LACP detects a link fault.
An active interface becomes unavailable.
When LACP preemption is enabled, a backup interface becomes the active interface when its priority is changed to be higher than that of the current active interface.
When any of the preceding events occurs, LACP takes effect in the following sequence:
Shuts down the faulty link.
Selects the backup link with the highest priority among N backup links to replace the faulty active link.
The highest priority backup link becomes the active link and begins forwarding data.
LACP Implementation Modes
LACP can work in static or dynamic LACP mode:
Static LACP mode
In static LACP mode, two ends exchange LACPDUs to negotiate link aggregation parameters to determine active and inactive interfaces.
In static LACP mode, you must manually create an Eth-Trunk and add member interfaces to the Eth-Trunk. Different from the manual load balancing mode, the static LACP mode selects active member interfaces by sending LACPDUs. That is, when a group of interfaces are added to an Eth-Trunk, devices at the two ends determine active and inactive interfaces by sending LACPDUs to each other.
The static LACP mode is called the M:N mode. In this mode, both load balancing and redundancy can be implemented. In a LAG, M links are active to forward data and perform load balancing, and other N links are inactive. The inactive links function as backup links and do not forward data. When one active link fails, the system selects the link with the highest priority among backup links to replace the faulty link. The link with the highest priority becomes active and starts to forward data.
On the network shown in Figure 3-8, DeviceA and DeviceB are directly connected and both of them support LACP. The Eth-Trunk working in static LACP mode can be configured on the two devices to implement load balancing and link backup. The static LACP mode is mainly applied to situations where the bandwidth of M links must be assured and a fault tolerance mechanism is in place. If an active link fails, the system selects the backup link with the highest priority as the active link.
Dynamic LACP mode
LACPDU exchange in static and dynamic LACP modes is the same, but the processing upon an LACP negotiation failure is different:- In static LACP mode, an Eth-Trunk becomes Down and cannot forward data after an LACP negotiation failure.
- In dynamic LACP mode, an Eth-Trunk becomes Down after an LACP negotiation failure, but its member interfaces inherit VLAN attributes of the Eth-Trunk and enter the Indep state. The member interfaces can still forward data at Layer 2.
After a device configured with an Eth-Trunk in dynamic LACP mode receives LACPDUs from the remote device, the two devices will use LACPDUs to negotiate link aggregation parameters. After the negotiation, link aggregation provides the same function as the Eth-Trunk working in static LACP mode.
An Eth-Trunk in dynamic LACP mode is often used to directly connect the device and server. As shown in Figure 3-9, ServerA needs to obtain the configuration file from ServerB through DeviceA.- After ServerA restarts and has no configuration, LACP negotiation fails. The dynamic LACP mode ensures that ServerA obtains the configuration file from ServerB through an Eth-Trunk member interface.
- After DeviceA receives LACPDUs from ServerA, it uses LACPDUs to negotiate link aggregation parameters with ServerA.
Eth-Trunk in dynamic LACP mode can be used only in a scenario where a Huawei device is interconnected with a server. (Ports on the server must be isolated from each other. For example, NICs on the server cannot be configured to work in bridge mode. If the ports are not isolated, loops may occur on the network.) In other scenarios, you are advised to deploy Eth-Trunk in static LACP mode.