Hello everyone,
Today I will share with you the working principle and characteristics of LACP.
1. LACP aggregation
There are two working modes for LACP aggregation: dynamic LACP aggregation and static LACP aggregation. In these two modes, the LACP protocol is in the enabled state. The LACP protocol uses LACPDU (Link Aggregation Control Protocol Data Unit, Link Aggregation Control Protocol Data Unit) to exchange information with the opposite end to achieve link aggregation. When adding a port to an aggregation group, you need to compare the basic configuration of the port. Only ports with the same basic configuration can be added to the same aggregation port. The active interfaces selected by the devices at both ends must be consistent, otherwise, the link aggregation group cannot be established. If you want to keep the active interfaces of both ends consistent, you can make one end have a higher priority, and the other end can select the active interface according to the higher priority end. This can be achieved by setting the system LACP priority and the port LACP priority. Priority distinction. The system LACP priority is a parameter configured to distinguish the priority of the two ends. The smaller the system LACP priority value, the higher the priority. The interface LACP priority is to distinguish the priority of different interfaces being selected as active interfaces. The smaller the interface LACP priority value, the higher the priority.
After the system enables the LACP protocol of a port, the port will send LACPDUs to notify the opposite end of its system priority, system MAC, port priority, port number, and an operation key. After receiving the information, the opposite end compares the information with the information stored in other ports to select a port that can be aggregated, so that both parties can reach an agreement on the port joining or leaving a certain aggregation group. The operation key is a configuration combination generated by the LACP protocol according to the port configuration (that is, speed, duplex, basic configuration, and management key) when ports are aggregated. Among them, after the LACP protocol is enabled on the dynamic aggregation port, its management key defaults to zero. After LACP is enabled on a static aggregation port, the management key of the port is the same as the aggregation group ID. For dynamic aggregation groups, members of the same group must have the same operation key, while in manual and static aggregation groups, selected ports have the same operation key.
2. The working principle of LACP aggregation
2.1 Static LACP aggregation
Static LACP mode link aggregation is an aggregation mode that uses the LACP protocol for parameter negotiation to select active links. In this mode, the LACP protocol determines the active and inactive links in the aggregation group. It is also called the M:N mode, that is, the mode of M active links and N backup links. This model provides higher link reliability and can achieve load balancing in different ways among M links.
Figure 1 Static link aggregation

There are M+N links with the same attributes between the two devices, and load sharing is performed on the M links when sending traffic on the aggregate link, that is, the main link. Instead of sending traffic on the other N links, these N links provide a backup function, that is, a backup link. At this time, the actual bandwidth of the link is the sum of M links, but the large bandwidth that can be provided is the sum of M+N. When one of the M links fails, LACP will find a normal link from the N backup links to replace the failed link to form an M: N backup. At this time, the actual bandwidth of the link is still the sum of M links, but the large bandwidth that can be provided becomes the sum of M+N-1 links.
2.1.1 The process of static LACP protocol
a. Both ends send LACPDU packets to each other
As shown in Figure 2, create an Eth-Trunk on Switch A and SwitchB and configure it in static LACP mode, and then manually add member interfaces to the Eth-Trunk. At this time, the LACP protocol is enabled on the member interface, and both ends send LACPDU packets to each other.
Figure 2 LACPDU transmission process

b. The devices at both ends determine the active end according to the system LACP priority and system ID.
As shown in Figure 3, the devices at both ends will receive LACP packets from the opposite end. Take Switch B as an example. When Switch B receives an LACP packet from Switch A, Switch B will check and record the peer information and compare the system priority field. If the system priority of the peer device Switch A is higher than that of the local device Switch B Priority, it is determined that Switch A is the LACP active end, and Switch B will select the active interface according to the interface priority of Switch A so that the devices at both ends reach an agreement on the selection of the active interface.
Figure 3 Determine the active end of static LACP mode

c. The devices at both ends determine the active interface according to the LACP priority and interface ID of the active end interface.
As shown in Figure 4, after the devices at both ends select the active end, both ends will select the active interface based on the interface priority of the active end. When the devices at both ends select the same active interface, the active link group can be established, and data can be forwarded from these active links in a load balancing mode.
Figure 4 The process of selecting active interface in static LACP mode

2.1.2 Active link and inactive link switchover
The following events are detected at either end of the static mode link aggregation group, which will trigger the link switch of the aggregation group:
l Link Down event.
l ETH-OAM detects link failure.
l The LACP protocol finds a link failure.
l The interface is not available.
l On the premise that LACP preemption is enabled, after changing the priority of the backup interface to be higher than the priority of the currently active interface, a switchover process will occur.
When one of the above switching conditions is met, switch according to the following steps:
l Close the faulty link.
l Select the link with the highest priority from the N backup links to replace the failed link in the active link.
l The backup link with the highest priority turns into an active state and forwards data to complete the switch.
2.1.3 Two important characteristics of static LACP
The LACP timeout period is the timeout period for the member ports in the dynamic aggregation group to wait to receive LACPDUs. After three times the LACP timeout period, if the local member port still does not receive the LACPDU from the opposite end, the opposite member port is considered invalid. The LACP timeout has only two values: short timeout (1 second) and long timeout (30 seconds).
LACP periodically exchanges and aggregates the two parties to each other at regular intervals. When a selected member link fails to work for some reason, the link aggregation can quickly perceive it and reset the link status. The link is blocked, and the traffic is redistributed to other selected member links. In this way, the functions of increasing bandwidth and link dynamic backup are realized.
Port Leave
a. Timeout, if the Actor port fails to receive the LACP message sent by the Partner port in the long timeout, it declares itself in the timeout state. If it does not receive the Partner message within the next short timeout, it will leave this Aggregator.
b. If the LACP message is received from the Partner port, it is found that the LAG ID has changed (the system ID or operation KEY has changed. The system ID change indicates that the connected peer device has changed, and the operation KEY may have changed. The attribute of the opposite port has changed), at this time the port will also leave the Aggregator.
c. The attributes of the Actor port itself have changed, and the operation KEY assigned to it by the device through the dynamic operation KEY function has changed, which causes a mismatch with the LAG ID of the Aggregator and leaves the aggregation group.
Preemption Delay
Figure 5 LACP Preemption Scenario

When the interface GE1/0/1 fails, it is replaced by GE1/0/3. If preemption is not enabled on the Eth-Trunk interface, GE1/0/1 will still maintain the backup interface status when the fault is restored; if enabled LACP preempts. When GE1/0/1 recovers from the failure, it can become the active interface again, and GE1/0/3 becomes the backup interface again.
If you want GE1/0/3 to replace one of GE1/0/1 and GE1/0/2 as the active interface, you can change the LACP priority of GE1/0/3 to 8 or a lower value. This is achieved, but the prerequisite is that the LACP preemption function has been enabled. If the LACP preemption function is not enabled, even if the priority of the backup interface is adjusted to be higher than the priority of the currently active interface, the system will not proceed to the process of reselecting the active interface and will not switch the active interface.
2.2 Dynamic LACP aggregation
Dynamic LACP aggregation is an aggregation created/deleted automatically by the system. Users are not allowed to add or delete member ports in a dynamic LACP aggregation. Only ports with the same speed and duplex properties, connected to the same device, and the same basic configuration can be used. Dynamically gather together. Even if there is only one port, a dynamic aggregation can be created. At this time, it is a single-port aggregation. In dynamic aggregation, the LACP protocol of the port is in the enabled state.
To enable dynamic LACP for a port, you only need to enable LACP on the port. You do not need to specify an aggregation group for the port. The port that enables dynamic LACP needs to find the dynamic aggregation group by itself. End information) the same aggregation group, directly join; if you do not find the aggregation group consistent with your own information, create a new aggregation group.
The negotiation process between the dynamic LACP protocol and the peer end is the same as the static convergence process.
That is all I want to share with you! Thank you!





