What Is LACP?
Introduction
This chapter defines Link Aggregation Control Protocol (LACP), introduces related concepts, and provides configuration examples.
LACP is a basic feature of Huawei data communications products, including switches, routers, WLAN products, and firewalls. Descriptions and examples in this chapter are based on Huawei's S12700 switch.
Understanding LACP
LACP, as specified in IEEE 802.3ad, implements dynamic link aggregation and de-aggregation, allowing LACP-enabled switches at both ends to exchange Link Aggregation Control Protocol Data Units (LACPDUs). LACP provides a standard negotiation mechanism that a Huawei switch can use to create and enable the aggregated link based on its configuration. After an aggregated link is formed, LACP is responsible for maintaining the link. LACP adjusts the link if an aggregated link's status changes.
For example, in Figure 1, 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 is connected to an interface on DeviceC. As a result, DeviceA may send data destined for DeviceB to DeviceC. In manual mode, this fault would go undetected.
In this case, 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.
The concepts in LACP include:
- 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
LACP interface priorities affect which interfaces of an Eth-Trunk are selected as active interfaces. A smaller numerical value represents a higher priority. The interfaces with the highest LACP interface priority become active interfaces.
- M:N backup of member interfaces
LACP mode is also called M:N mode, where M refers to the number of active links and N refers to the number of backup links. This mode guarantees high reliability and allows traffic to be load balanced among M active links.
In Figure 2, M+N links with the same attributes (in the same LAG) are set up between two devices. When data is transmitted over the aggregated link, traffic is load balanced among M active links, with no data transmitted over N backup links. Therefore, the actual bandwidth of the aggregated link is the sum of the M links' bandwidth, and the maximum bandwidth of the aggregated link is the sum of the (M+N) links' bandwidth.
If one of the M links fails, LACP selects one of the N backup links to replace the faulty link. The actual bandwidth of the aggregated link is still the sum of M links' bandwidth, but the maximum bandwidth of the aggregated link is the sum of the (M+N-1) links' bandwidth.
LACP Implementation
LACP-enabled switches exchange LACPDUs. An LACPDU contains the LACP system priority, MAC address, LACP interface priority, interface number, and operational key.
An Eth-Trunk in LACP mode is set up as follows:
After member interfaces are added to an Eth-Trunk in LACP mode, both ends send LACPDUs.
In Figure 1, 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.
In Figure 2, when DeviceB receives LACPDUs from DeviceA, DeviceB checks and records information about DeviceA and compares LACP system priorities. If the LACP system priority of DeviceA is higher than that of DeviceB, DeviceA becomes the Actor. If DeviceA and DeviceB have the same LACP system priority, the device with a smaller MAC address becomes the Actor.
After the Actor is selected, both devices select active interfaces based on the interface priorities of the Actor. If priorities of interfaces on the Actor are the same, interfaces with smaller interface numbers are selected as active interfaces. An Eth-Trunk is established when both devices select the same interfaces as active interfaces. Active links then load balance traffic.
Load Balancing in LACP Mode
Because an Eth-Trunk between two devices consists of multiple physical links bundled together, an Eth-Trunk may transmit data frames of the same data flow over different physical links. A potential problem arises in that the second data frame may arrive at the remote device earlier than the first data frame, resulting in out-of-order packets.
To prevent out-of-order packets, Eth-Trunk uses flow-based load balancing. This mechanism uses the hash algorithm to calculate the address in a data frame and generate a hash key based on which the system searches for the outbound interface in the Eth-Trunk forwarding table. Each MAC or IP address corresponds to a hash key, so the system uses different outbound interfaces to forward data. This mechanism ensures that frames of the same data flow are forwarded on the same physical link and implements load balancing of data flows. Flow-based load balancing ensures that data is transmitted in the correct sequence, but cannot ensure efficient bandwidth usage.
You can set the load balancing mode based on traffic models. When a parameter of traffic changes frequently, you can set the load balancing mode based on this parameter to ensure that the traffic is load balanced evenly. For example, if IP addresses in packets change frequently, use the load balancing mode based on dst-ip, src-ip, or src-dst-ip so that traffic can be properly load balanced among physical links. If MAC addresses in packets change frequently and IP addresses are fixed, use the load balancing mode based on dst-mac, src-mac, or src-dst-mac so that traffic can be properly load balanced among physical links.
According to your network requirements, you can carry out load balancing based on the following information:
- Source MAC addresses of data frames
- Destination MAC address of data frames
- Exclusive-Or result of source and destination MAC addresses of data frames
- Source IP addresses of data frames
- Destination IP addresses of data frames
- Exclusive-Or result of source and destination IP addresses of data frames
Configuring LACP
For details about the configurations and commands, see S12700 V200R013C00 Configuration Guide - Ethernet Switching Configuration Guide.
- Run the system-view command to enter the system view.
- Run the interface eth-trunk trunk-id command to create an Eth-Trunk interface and enter the Eth-Trunk interface view.
- Run the mode lacp command to configure the Eth-Trunk to work in LACP mode. By default, an Eth-Trunk works in manual mode.
- Run the quit command to return to the system view.
- Perform either of the following operations as required.
- Add member interfaces to an Eth-Trunk in the Eth-Trunk interface view.
- Run the interface eth-trunk trunk-id command to enter the Eth-Trunk interface view.
- Run the trunkport interface-type { interface-number1 [ to interface-number2 ] } &<1-8> [ mode { active | passive } ] command to add member interfaces to the Eth-Trunk.
Add member interfaces to an Eth-Trunk in the member interface view.
- Run the interface interface-type interface-number command to enter the interface view.
- Run the eth-trunk trunk-id [ mode { active | passive } ] command to add the current interface to the Eth-Trunk.
- (Optional) Run the load-balance { dst-ip | dst-mac | src-ip | src-mac | src-dst-ip | src-dst-mac } command to set a load balancing mode of the Eth-Trunk. The default load balancing mode is src-dst-ip.
The following example describes how to create an Eth-Trunk working in LACP mode, add GE1/0/1, GE1/0/2, and GE1/0/3 to the Eth-Trunk, and check the configuration result.
[HUAWEI] interface eth-trunk 1 [HUAWEI-Eth-Trunk1] mode lacp [HUAWEI-Eth-Trunk1] trunkport gigabitethernet 1/0/1 to 1/0/3 [HUAWEI-Eth-Trunk1] quit [HUAWEI] display eth-trunk 1 Eth-Trunk1's state information is: Local: LAG ID: 1 WorkingMode: LACP Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP System Priority: 32768 System ID: 00e0-fca8-0417 Least Active-linknumber: 1 Max Active-linknumber: 8 Operate status: up Number Of Up Port In Trunk: 3 -------------------------------------------------------------------------------- ActorPortName Status PortType PortPri PortNo PortKey PortState Weight GigabitEthernet1/0/1 Selected 1GE 32768 1 305 10100010 1 GigabitEthernet1/0/2 Selected 1GE 32768 2 305 10100010 1 GigabitEthernet1/0/3 Selected 1GE 32768 3 305 10100010 1 Partner: -------------------------------------------------------------------------------- ActorPortName SysPri SystemID PortPri PortNo PortKey PortState GigabitEthernet1/0/1 32768 00e0-fca6-7f85 32768 1 305 10100011 GigabitEthernet1/0/2 32768 00e0-fca6-7f85 32768 2 305 10100011 GigabitEthernet1/0/3 32768 00e0-fca6-7f85 32768 3 305 10100011
Other Configurations
For details about other LACP configurations, such as the LACP system priority, LACP preemption, timeout interval for receiving LACPDUs, and enhanced load balancing mode, see "Configuring Link Aggregation in LACP mode" in the S12700 V200R013C00 Configuration Guide - Ethernet Switching Configuration Guide.