这篇文章只是初步讨论链路聚合。

链路聚合 Link Aggregation 是英文的标准术语,他还有其他说法:

端口聚合 Port Aggregation

链路捆绑 Link Bundling

以太网通道 Ether Channel(思科叫法)

以太网链路聚合接口 Eth-Trunk(华为叫法)


链路聚合的作用

链路聚合在不升级物理设备的基础上,将两个设备间多个物理接口绑定成一个逻辑接口,在增加链路带宽的同时,采用备份链路的机制,可以有效地提升链路的可靠性,此外,它还可以实现负载均衡

  • 提高链路带宽
  • 增强网络可用性
  • 支持负载分担

这两台设备可以是一对路由器,一对交换机,或者是一台路由器和一台交换机。

一条聚合链路可以包含多条成员链路,在ARG3系列路由器和X7系列交换机上默认最多为8条。

以后会涉及堆叠、E-Trunk 、M-LAG

链路聚合的模式

手动负载分担模式 & LACP(Link Aggregation Control Protocol)模式

手动负载分担模式 LACP模式
手动配置,无协商 运行LACP,自动协商
无法检测对接错误 能够检测对接的逻辑错误
无法指定备份端口 可以实现M:N备份,有专用的备份链路

Eth-Trunk链路两端参数必须相同,即物理接口的数量、速率、双工方式、流控方式必须一致

逐流负载分担

为了使同一条“流”数据走一条线,避免乱序,Eth-Trunk采用逐流负载分担的机制,这种机制把数据帧中的地址通过HASH算法生成HASH-KEY值,然后根据这个数值在Eth-Trunk转发表中寻找对应的出接口。

对于链路而言

  • 实现了流量在聚合组内各个物理链路上的负载分担

对于一个流而言

  • 确保了同一条流在同一物理链路上传输,避免乱序
  • 单条流的速度仍然受单根物理链路带宽约束

二层链路聚合配置命令

ensp链路聚合

1
2
3
4
5
6
7
# 创建Eth-Trunk口
interface Eth-Trunk 1
# 进入GigabitEthernet口,加入Eth-Trunk口
int GigabitEthernet 0/0/1
eth-trunk 1
int GigabitEthernet 0/0/2
eth-trunk 1

也有另外一种方式加入Eth-Trunk口

1
2
3
4
5
interface Eth-Trunk 1
# 配置为手动负载分担模式,默认就是该模式,可以不进行配置
mode manual load-balance
# 在Eth-Trunk视角下,指定trunkport
trunkport GigabitEthernet 0/0/1 to 0/0/2

查看链路聚合信息

1
2
3
4
5
6
7
8
9
[sw1]dis eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 2
------------------------------------------------------------------------------
PortName Status Weight
GigabitEthernet0/0/1 Up 1
GigabitEthernet0/0/2 Up 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[sw1]display interface Eth-Trunk 1
Eth-Trunk1 current state : UP
Line protocol current state : UP
Description:
Switch Port, PVID : 1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW:
2G, Current BW: 2G, The Maximum Frame Length is 9216
IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is 4c1f-cc25-7bf7
Current system time: 2026-07-07 19:38:48-08:00
Input bandwidth utilization : 0%
Output bandwidth utilization : 0%
-----------------------------------------------------
PortName Status Weight
-----------------------------------------------------
GigabitEthernet0/0/1 UP 1
GigabitEthernet0/0/2 UP 1
-----------------------------------------------------
The Number of Ports in Trunk : 2
The Number of UP Ports in Trunk : 2