跳转到内容
Ask AI

LAG Configuration Guide

此内容尚不支持你的语言。

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.

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.

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.

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.

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.

Table 1 Configuring Static Aggregation Groups

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create an aggregation group.interface link-aggregation lag-idAggregate group id, range 1-9999
Configure static aggregation mode.mode static-
Submit operation.commitModify the configuration and submit it for effect

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

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter Ethernet interface view.interface ethernet interface-name-
Add to the LAG.link-aggregation-group lag-id-

Table 3 Overview of LAG Configuration Tasks

Configuration TasksDescriptionRefer to
Configure aggregation groupConfigure dynamic aggregation groupRequiredConfigure dynamic aggregation group
Configure the relevant parameters of the dynamic aggregation groupConfigure aggregation group member portsRequiredConfigure aggregation group member ports
Configure LACP timeout modeOptionalConfigure LACP timeout mode
Configure LACP fallbackOptionalConfigure LACP Fallback
Configure LACP system priorityOptionalConfigure LACP system priority
Configure LACP port-priorityOptionalConfigure LACP port-priority
Configure the minimum number of active LACP linksOptionalConfigure the minimum number of active LACP links
Configure LACP system IDOptionalConfigure LACP system ID
Configure LACP keyOptionalConfigure LACP key
Configure LACP graceful-downOptionalConfigure LACP graceful-down

The LAG default setting is shown in the table below.

Table 4 LAG Default Setting

ParametersDefault value
LACP timeout mode for interfacesLong timeout
System LACP priority65535
LACP priority for interfaces255
Minimum number of active LACP links1
LACP system IDMAC address of the interface
Interface LACP key value0
Interface LACP fallbackshutdown
Port IDDefault is to add one to the interface number

Table 5 Configure Dynamic Aggregation Group

PurposeCommandsDescription
Enter global configuration viewconfigure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-idAggregate group id, range 1-9999
Configure dynamic aggregation modemode dynamicCan be omitted, default is dynamic
Submit operationcommitModify the configuration and submit it for effect

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

PurposeCommandsDescription
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.

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

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP fast-rate timeoutlacp fast-rate-
Submit operationcommitModify the configuration and submit it for effect

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

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP fallbacklacp fallback-
Submit operationcommitModify the configuration and submit it for effect

Table 9 Configure LACP system priority

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP system prioritylacp system-priority system-priority-
Submit operationcommitModify the configuration and submit it for effect

Table 10 Configure LACP port-priority

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter Ethernet interface view.interface ethernet interface-nameEnter 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.
Section titled “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

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP minimum number of active LACP links.lacp min-links min-links-
Submit operationcommitModify the configuration and submit it for effect

System id defaults to the interface MAC address, and when manually configured, the configured address takes effect.

Table 12 Configure LACP system ID

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP system IDlacp system-id HH:HH:HH:HH:HH:HH-

Table 13 Configure LACP system ID

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP keylacp key value-

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

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view and create aggregation groupinterface link-aggregation lag-id-
Configure LACP graceful-downlacp graceful-down-

Configure Load Balancing Algorithm for Aggregation Group Members

Section titled “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

PurposeCommandsDescription
Enter global configuration view.configure terminal-
Enter LAG interface configuration view.interface link-aggregation lag-idAggregate group id, range 1-9999
Configure load balancing algorithm.hash algorithm {random|round_robin}-
Commit configuration.commit-

Table 16 Set the IP Address for LAGIF

PurposeCommandsDescription
Enter global configuration viewconfigure terminal-
Enter LAG interface configuration viewinterface link-aggregation lag-idAggregate group id, range 1-9999
Set the IP address of the LAG interfaceip 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.

Table 17 Configure the MTU for LAGIF

PurposeCommandsDescription
Enter global configuration viewconfigure terminal-
Enter LAG interface configuration viewinterface link-aggregation lag-idAggregate group id, range 1-9999
Configure the MTU of the LAG interfacemtu mtuMTU range: 1312 to 9216

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

PurposeCommandsDescription
Enter global configuration viewconfigure terminal-
Enter LAG interface configuration viewinterface link-aggregation lag-idAggregate group id, range 1-9999
Configure the MAC address of LAGIFmac-address HH:HH:HH:HH:HH:HHMAC addresses are not case-sensitive
Restore the MAC address of LAGIF to its default valueno mac-address-

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

PurposeCommandsDescription
Enter global configuration viewconfigure terminal-
Enter LAG interface configuration viewinterface link-aggregation lag-idAggregate group id, range 1-9999
Close the aggregation interfaceshutdown-
Opening the aggregation interfaceno shutdown-

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

PurposeCommandsDescription
Display aggregation group related informationshow 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.
  1. 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.
  2. Topology

  1. 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 20

Device B Similar to Device A, the configuration process is skipped.

  1. Verify the configuration.
show link-aggregation summary

The VMs in Vlan10 and Vlan20 ping each other separately and can ping through.

  1. 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.

  1. Topology

  1. 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 20

Device B

Similar to Device A, the configuration process is skipped.

  1. Verify the configuration.
show link-aggregation summary

The VMs in Vlan10 and Vlan20 ping each other separately and can ping through.

  1. 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.
  2. Topology

  1. 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/24

Device B

Similar to Device A, the configuration process is skipped. 4. Verify the configuration.

show link-aggregation summary

Device A pinging Device B can ping through.

  1. 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.
  2. Topology

  1. 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/24

Device B

Similar to Device A, the configuration process is skipped. 4. Verify the configuration.

show link-aggregation summary

Device A pinging Device B can ping through.