LAG Configuration Guide
Introduction
Link Aggregation increases link bandwidth, enables load sharing of traffic and improves link reliability by aggregating multiple physical links together to form a single logical link. As shown below, Device A and Device B are connected by three physical links, which are bundled into one logical link with a maximum bandwidth equal to the total bandwidth of the three physical links. At the same time, the three physical links are backed up by each other, so that when one of the links goes down, the other two links can still work.

Basic Concepts
Aggregation Group and Member Port
Multiple ports are aggregated to form an aggregation group and these ports are called member ports of that aggregation group. Each aggregation group uniquely corresponds to a logical interface, called link aggregation interface. Aggregation group and link aggregation interface are numbered consistently.
NOTE: In this manual, ‘portchannel’ and ‘lag’ have the same meaning, both referring to a link aggregation group.
Status of Member Port
The member ports within the aggregation group have the following states.
- Selected: The member ports in this state are called selected ports and can participate in data forwarding.
- Unselected: member ports in this state are called unselected ports and do not participate in data forwarding.
Aggregation Mode
Link aggregation is divided into two modes: static and dynamic aggregation.
- Static Aggregation
Once configured, the selected/unselected state of the port is not affected by the network environment and is more stable.
- Dynamic Aggregation
It can adjust the selected/unselected status of the port according to the information on the other side and the local side, which is more flexible. To ensure proper use, the aggregation method chosen for both ends of the aggregation group needs to be the same. The dynamic aggregation mode is implemented through the LACP (Link Aggregation Control Protocol) protocol. The LACP protocol, based on the IEEE 802.3ad standard, is a protocol that enables dynamic link aggregation, where devices running this protocol send LACPDU to each other to exchange information about link aggregation.
- LACP working mode
The LACP operating modes are Active and Passive (or Inactive); Active mode, i.e. actively sending out LACPDU probes; Passive mode, i.e. not actively sending out LACPDUs until they are received. If the LACP mode of member ports in the dynamic aggregation group is Passive and the LACP mode of the opposite end is also Passive, both ends will not be able to send LACPDU; if the LACP mode of either end is Active, both ends will be able to send LACPDU; to ensure normal use o, at least one of the LAG at both ends must be Active.
- LACP Priority
Depending on the role, LACP priority can be divided into two categories: system priority and port priority. System priority is used to distinguish between the higher and lower priority of the switches at both ends. When one of the two ends has a higher priority, the other end will select the selected port of this end according to the end with the higher priority, thus making the selected ports of the two ends agree; the port priority is used to distinguish the priority of each member port to become the selected port. The lower the priority value, the higher the priority.
- LACP timeout
This parameter defines the long and short timeout attribute of the aggregation group, which is the timeout of the member ports waiting to receive LACPDU. If the LACP timeout is short, the peer will send LACPDU quickly (1 LACPDU every 1 second); if the LACP timeout is long, the peer will send LACPDU slowly (1 LACPDU every 30 seconds). It should be noted that the communication status changes rapidly in the actual network, in order to ensure the quality of communication, for dynamic aggregation groups, no matter the configuration of long timeout or short timeout, after the completion of link aggregation configuration, if the status of a member port on the local side is down, the other side will immediately sense it and set the corresponding port status to down. For dynamic aggregation mode, the switches on both ends of the aggregated link will automatically negotiate the status of the ports within their respective aggregation groups, and the user only needs to ensure that when the local ports are aggregated together, the peers are also aggregated together accordingly.
Static LAG Configuration
In scenarios where the network structure is simple and changes infrequently, or when connected devices (such as older switches or servers) do not support the LACP protocol, static aggregation can be used to manually bind physical ports to achieve bandwidth aggregation and redundancy.
Configure Static Aggregation Group
Table 1 Configuring Static Aggregation Groups
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create an aggregation group. | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Configure static aggregation mode. | mode static | - |
Submit operation. | commit | Modify the configuration and submit it for effect |
Configure Aggregation Group Member Ports
When adding a physical interface to an aggregation group, the interface must be in a free state, meaning it has no IP configuration, is not assigned to a VLAN, and is not part of another aggregation group.
Table 2 Configuring Aggregation Group Member Ports
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter Ethernet interface view. | interface ethernet interface-name | - |
Add to the LAG. | link-aggregation-group lag-id | - |
Dynamic LAG Configuration
Table 3 Overview of LAG Configuration Tasks
Configuration Tasks | Description | Refer to | |
|---|---|---|---|
Configure aggregation group | Configure dynamic aggregation group | Required | Configure dynamic aggregation groupConfigure dynamic aggregation group |
Configure the relevant parameters of the dynamic aggregation group | Configure aggregation group member ports | Required | |
Configure LACP timeout mode | Optional | Configure LACP timeout modeConfigure LACP timeout mode | |
Configure LACP fallback | Optional | Configure LACP FallbackConfigure LACP Fallback | |
Configure LACP system priority | Optional | Configure LACP system priorityConfigure LACP system priority | |
Configure LACP port-priority | Optional | Configure LACP port-priorityConfigure LACP port-priority | |
Configure the minimum number of active LACP links | Optional | Configure the minimum number of active LACP linksConfigure the minimum number of active LACP links | |
Configure LACP system ID | Optional | Configure LACP system IDConfigure LACP system ID | |
Configure LACP key | Optional | Configure LACP keyConfigure LACP key | |
Configure LACP graceful-down | Optional | Configure LACP graceful-downConfigure LACP graceful-down | |
LAG Default Setting
The LAG default setting is shown in the table below.
Table 4 LAG Default Setting
Parameters | Default value |
|---|---|
LACP timeout mode for interfaces | Long timeout |
System LACP priority | 65535 |
LACP priority for interfaces | 255 |
Minimum number of active LACP links | 1 |
LACP system ID | MAC address of the interface |
Interface LACP key value | 0 |
Interface LACP fallback | shutdown |
Port ID | Default is to add one to the interface number |
Configure Dynamic Aggregation Group
Table 5 Configure Dynamic Aggregation Group
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Configure dynamic aggregation mode | mode dynamic | Can be omitted, default is dynamic |
Submit operation | commit | Modify the configuration and submit it for effect |
Configure Aggregation Group Member Ports
When adding a physical interface to an aggregation group, the interface must be in a free state, meaning it has no IP configuration, is not assigned to a VLAN, and is not part of another aggregation group.
Table 6 Configuring Aggregation Group Member Ports
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter Ethernet interface view. | interface ethernet interface-name | - |
Add to the LAG (port priority can be specified). | link-aggregation-group lag-id [port-priority port-priority] | Port priority, range 0 to 65535, default 255. |
Configure LACP timeout mode
When an interface is added to a link aggregation, it periodically sends LACP protocol packets to dynamically maintain the status of the link aggregation group. After configuring the fast-rate option with a short timeout, it sends LACP packets every 1 second. In the event of a link failure, the fast-rate mode can detect the problem more quickly, making it suitable for scenarios where high network availability is required. In scenarios where network stability is high and the recovery time for failures is not critical, a long timeout can be used to reduce unnecessary packet overhead.
Table 7 Configure LACP fast-rate timeout
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP fast-rate timeout | lacp fast-rate | - |
Submit operation | commit | Modify the configuration and submit it for effect |
Configure LACP fallback
LACP dynamically negotiates link aggregation by exchanging LACP protocol data units (LACPDUs). But in some cases (such as when the peer device does not support LACP, link failure, or configuration mismatch), LACP negotiation may fail. In this case, configuring the skip fallback function can force the aggregation group state to UP, thereby avoiding link failure and traffic interruption, and improving reliability. In addition, in scenarios where the server needs to be installed through PXE, this feature also needs to be enabled.
Table 8 Configure LACP fallback
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP fallback | lacp fallback | - |
Submit operation | commit | Modify the configuration and submit it for effect |
Configure LACP system priority
Table 9 Configure LACP system priority
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP system priority | lacp system-priority system-priority | - |
Submit operation | commit | Modify the configuration and submit it for effect |
Configure LACP port-priority
Table 10 Configure LACP port-priority
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter Ethernet interface view. | interface ethernet interface-name | Enter Ethernet interface view. |
Add to the LAG (port priority can be specified). | link-aggregation-group lag-id [port-priority port-priority] | Port priority, range 0 to 65535, default 255. |
Configure the Minimum number of active LACP links
The minimum number of active links in LACP is an important configuration parameter in Link Aggregation Control Protocol (LACP), which ensures that the minimum number of active links in the Link Aggregation Group meets the requirements during operation. When the number of active links is lower than this value, the entire aggregation group status will become down, which can ensure that the minimum available bandwidth of the aggregation group meets business requirements and prevent partial link failures from causing overload of remaining link traffic.
Table 11 Minimum number of active LACP links
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP minimum number of active LACP links. | lacp min-links min-links | - |
Submit operation | commit | Modify the configuration and submit it for effect |
Configure LACP system ID
System id defaults to the interface MAC address, and when manually configured, the configured address takes effect.
Table 12 Configure LACP system ID
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP system ID | lacp system-id HH:HH:HH:HH:HH:HH | - |
Configure LACP key
Table 13 Configure LACP system ID
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP key | lacp key value | - |
Configure LACP graceful-down
LACP graceful Down is an elegant closure mechanism used to avoid traffic interruption when actively closing the LACP aggregation link. It ensures that devices at both ends of the link synchronously perceive the port closure status through protocol level coordination, thereby achieving smooth traffic switching and avoiding packet loss during traffic switching.
Table 14 Configure LACP graceful-down
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view and create aggregation group | interface link-aggregation lag-id | - |
Configure LACP graceful-down | lacp graceful-down | - |
General Configuration of LAG
Configure Load Balancing Algorithm for Aggregation Group Members
The default load balancing method for members of an aggregation group is based on a five-tuple hash. CX864P-NT supports two packet-based hash algorithms: round_robin and random.
Table 15 Configure Load Balancing Algorithm for Aggregation Group Members
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view. | configure terminal | - |
Enter LAG interface configuration view. | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Configure load balancing algorithm. | hash algorithm {random|round_robin} | - |
Commit configuration. | commit | - |
NOTE: The aggregation group mode, system LACP priority, and load balancing algorithm must be configured when creating the LAG. If the LAG has Layer 2 or Layer 3 configurations or contains member ports, these configurations should be removed before modifying the attributes.
Set the IP Address for LAGIF
Table 16 Set the IP Address for LAGIF
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view | configure terminal | - |
Enter LAG interface configuration view | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Set the IP address of the LAG interface | ip address {A.B.C.D/M|A::B/M} | IPv4 address with subnet mask /32 is not allowed to be configured. Addresses with subnet mask /31 is allowed. In other subnet masks, addresses with the host portion all-zeros or all-ones are not allowed.IPv6 address with subnet mask /127 or /128 is not allowed to be configured. In other subnet masks, addresses with the host portion all-zeros are not allowed, but all-ones are allowed. |
Configure MTU for LAGIF
Table 17 Configure the MTU for LAGIF
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view | configure terminal | - |
Enter LAG interface configuration view | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Configure the MTU of the LAG interface | mtu mtu | MTU range: 1312 to 9216 |
Configure MAC Address for LAGIF
By default, the MAC address of the interface is dynamically assigned by the system or is the same as the MAC address of the switch. This series supports users to reconfigure the MAC of physical interfaces, VLAN interfaces and link aggregated interfaces.
Table 18 Configure MAC Address for LAGIF
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view | configure terminal | - |
Enter LAG interface configuration view | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Configure the MAC address of LAGIF | mac-address HH:HH:HH:HH:HH:HH | MAC addresses are not case-sensitive |
Restore the MAC address of LAGIF to its default value | no mac-address | - |
Shutdown the LAGIF
Shutting down the aggregation port will cause all selected ports in the group to become unselected ports and the state of all member ports to change to down.
Table 19 Shutdown the LAGIF
Purpose | Commands | Description |
|---|---|---|
Enter global configuration view | configure terminal | - |
Enter LAG interface configuration view | interface link-aggregation lag-id | Aggregate group id, range 1-9999 |
Close the aggregation interface | shutdown | - |
Opening the aggregation interface | no shutdown | - |
Display and Maintenance
Check the current aggregation group configuration status, display the protocol of each aggregation group of the system and ports in it.
Table 20 LAG Display and Maintenance
Purpose | Commands | Description |
|---|---|---|
Display aggregation group related information | show link-aggregation summary | - |
Abbreviations in table description: A - Active, I - InActive, Up - up, Dw - Down, N/A - not available, S - selected, D - deselected
Example.
sonic# show link-aggregation summary
Flags: A - Active, I - inActive, Up - up, Dw - Down, N/A - not available,
S - selected, D - deselected, \* - not synced
No. Team Dev Protocol Ports
----- --------------- --------------- -----------------------------
0001 PortChannel0001 LACP(A)(Dw) Ethernet46(D)
0002 PortChannel0002 LACP(A)(Dw) N/A
0100 PortChannel0100 LOADBALANCE(Up) Ethernet28(up)
0101 PortChannel0101 LOADBALANCE(Up) Ethernet41(dw) Ethernet40(up)In the example, we can see that the third column of Protocol is identified as LACP or LOADBALANCE, when it is "LACP", it means that member ports are added and removed dynamically via lacp, and the addition and deletion of member ports to the chip follows the 802.1ax protocol. When it is "LOADBALANCE", it means static lag configuration, and the addition and deletion of member ports to the chip is directly dependent on manual configuration.
- When Protocol is in LACP mode, two attributes will be available: the LACP operating mode and the port status.
- LACP working mode has two states, I and A. A means Active mode and I means Inactive mode. For normal use, the Active mode is not provided for the configuration interface, and Active mode is used by default.
- The other attribute indicates the port status (Up/Dw), with Up indicating that the lag is functional and Dw indicating that the lag port is not forwarding traffic properly.
- The member port under the LACP protocol has a status attribute (S/S*/D). Only when it is S does it mean that the interaction with the peer is successful and the member port is correctly sent down to the chip. The rest of the states are not working properly: when it is S*, it is most likely that there is a mismatch between the local and the peer information; when it is D, it is likely that no LACPDU packet has been received, that is, the peer has not configured the lag. In the dynamic LAG only if the number of the member port in the S state is not less than min-links, the lag will be in the up state and can participate in forwarding.
- When Protocol is LOADBALANCE mode, there is only one port status attribute. This attribute is actually the link state of the port.
- When the port link status is up, it means the port is working normally, and it is added to the portchannel as a member port in the chip, and can participate in the forwarding of the portchannel.
- When the port link status is down, it means that the port is working down and not added to the LAG.
Typical Configuration Example
Layer 2 Static Aggregation
- Networking Requirements Device A and Device B are connected to each other via their respective Ethernet0, 1. Configure a Layer 2 static link aggregation group on Device A and Device B and implement separate interworking of VMs in VLAN 10 and VLAN 20.
- Topology

- Procedure
Device A
#Create VLAN10 and add Ethernet2 to this VLAN.
sonic# configure terminal
sonic(config)# vlan 10
sonic(config-vlan-10)# ex
sonic(config)# interface ethernet 0/2
sonic(config-if-0/2)# switchport access vlan 10
sonic(config-if-0/2)# ex#Create VLAN 20 and add Ethernet3 to this VLAN.
sonic(config)# vlan 20
sonic(config-vlan-20)# ex
sonic(config)# interface ethernet 0/3
sonic(config-if-0/3)# switchport access vlan 20
sonic(config-if-0/3)# ex#Create static aggregation port Lag1 and add Ethernet0, 1 to this aggregation group.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# mode static
sonic(config-lagif-1)# commit
sonic(config-lagif-1)# ex
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 1
sonic(config-if-0/0)# ex
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# link-aggregation-group 1
sonic(config-if-0/1)# ex#Add Lag1 to VLAN10, 20.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# switchport trunk vlan 10
sonic(config-lagif-1)# switchport trunk vlan 20Device B Similar to Device A, the configuration process is skipped.
- Verify the configuration.
show link-aggregation summaryThe VMs in Vlan10 and Vlan20 ping each other separately and can ping through.
Layer 2 Dynamic Aggregation
- Networking Requirements
Device A and Device B are connected to each other via their respective Ethernet0, 1. Configure a Layer 2 dynamic link aggregation group on Device A and Device B and implement separate interworking of VMs in VLAN 10 and VLAN 20.
- Topology

- Procedure
Device A #Create VLAN10 and add Ethernet2 to this VLAN.
sonic# configure terminal
sonic(config)# vlan 10
sonic(config-vlan-10)# ex
sonic(config)# interface ethernet 0/2
sonic(config-if-0/2)# switchport access vlan 10
sonic(config-if-0/2)# ex#Create VLAN 20 and add Ethernet3 to this VLAN.
sonic(config)# vlan 20
sonic(config-vlan-20)# ex
sonic(config)# interface ethernet 0/3
sonic(config-if-0/3)# switchport access vlan 20
sonic(config-if-0/3)# ex#Create dynamic aggregation port Lag1 and add Ethernet0, 1 to this aggregation group.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# mode dynamic
sonic(config-lagif-1)# commit
sonic(config-lagif-1)# ex
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 1
sonic(config-if-0/0)# ex
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# link-aggregation-group 1
sonic(config-if-0/1)# ex#Add PortChannel0001 to VLANs 10 and 20.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# switchport trunk vlan 10
sonic(config-lagif-1)# switchport trunk vlan 20Device B
Similar to Device A, the configuration process is skipped.
- Verify the configuration.
show link-aggregation summaryThe VMs in Vlan10 and Vlan20 ping each other separately and can ping through.
Layer 3 Static Aggregation
- Networking Requirements Device A and Device B are connected to each other via their respective Ethernet0, 1. Configure a Layer 3 static link aggregation group with IP on Device A and Device B respectively.
- Topology

- Procedure
Device A #Create static aggregation port Lag1 and add Ethernet0, 1 to this aggregation group.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# mode static
sonic(config-lagif-1)# commit
sonic(config-lagif-1)# ex
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 1
sonic(config-if-0/0)# ex
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# link-aggregation-group 1
sonic(config-if-0/1)# ex#Set the IP for Lag1.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# ip address 100.0.0.1/24Device B
Similar to Device A, the configuration process is skipped. 4. Verify the configuration.
show link-aggregation summaryDevice A pinging Device B can ping through.
Layer 3 Dynamic Aggregation
- Networking Requirements Device A and Device B are connected to each other via their respective Ethernet0, 1. Configure a Layer 3 dynamic link aggregation group with IPs on Device A and Device B respectively, and require a short timeout for LACP.
- Topology

- Procedure
Device A
#Create dynamic aggregation port Lag1 and add Ethernet0, 1 to this aggregation group.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# mode dynamic
sonic(config-lagif-1)# commit
sonic(config-lagif-1)# lacp fast-rate
sonic(config-lagif-1)# commit
sonic(config-lagif-1)# ex
sonic(config)# interface ethernet 0/0
sonic(config-if-0/0)# link-aggregation-group 1
sonic(config-if-0/0)# ex
sonic(config)# interface ethernet 0/1
sonic(config-if-0/1)# link-aggregation-group 1
sonic(config-if-0/1)# ex#Set the IP for Lag1.
sonic(config)# interface link-aggregation 1
sonic(config-lagif-1)# ip address 100.0.0.1/24Device B
Similar to Device A, the configuration process is skipped. 4. Verify the configuration.
show link-aggregation summaryDevice A pinging Device B can ping through.