一、基本概念
将多个端口捆绑在一起来实现更高带宽的功能称为链路聚合。
我们使用 channel-group 命令聚合多个以太网端口。所创建的单个逻辑接口称为 port-channel。
在 Cisco Catalyst 交换机上,我们可以最多聚合八个 10/100 端口,
捆绑中的所有端口必须具有相同的运行状态和配置。
以太网帧在 EtherChannel 上“不分段”或“不分裂” - 以太网帧发送到一个选定端口并原封不动地穿过链路。
设置两个冗余链路时生成树为了防止出现环路,会阻塞其中一个端口。这样会导致不能完全使用链路的性能。
EtherChannel 允许生成树将两个物理链路视为一个逻辑端口,不会被生成树协议阻塞,以便两个端口在完全转发模式运行
二、EtherChannel 工作原理
如果组中的一条物理链路失败,则 EtherChannel 只丢失该链路提供的带宽。如果该物理链路恢复,则会动态添加到 EtherChannel。
生成树将 EtherChannel 捆绑视为单个逻辑交换端口,并调整生成树开销来反映带宽增加情况。
EtherChannel 不一定配置为 TRUNK,具体取决于所需的设计。
三、EtherChannel 负载均衡
EtherChannel 在组中的所有物理端口上进行负载均衡操作。
默认负载均衡方式使用帧中的源 MAC地址。来自不同源的帧会被发送到不同端口,但来自同一个源的所有帧会被发送到同一端口。
我们可以使用全局配置命令更改默认负载均衡:
port-channel load-balance [dst-ip | dst-mac | src-dst-ip | src-dst-mac | src-ip | src-mac]
四、通道协议
Catalyst 交换机可以利用协议动态建立和维护 EtherChannel 捆绑。
channel-group mode 命令可以用来确定 EtherChannel 组使用端口聚合协议 (PAgP)、链路聚合控制协议 (LACP),还是强制接口不使用 PAgP 或 LACP 来建立通道。
如果任何接口之间配置不同,强制接口建立通道可能会引起问题。
五、端口聚合协议
PAgP 允许交换机获知分配给 EtherChannel 捆绑的每个接口的功能,并以可靠方式激活具有类似配置的接口来形成 port-channel。
如果端口处于中继模式,PAgP 将在EthernetChannel 中的所有接口上发送和接收消息,但只限制在本征 VLAN(VLAN 1)上传输 PAgP 流量。
LACP 的工作原理类似于 PAgP,LACP 是基于标准的技术(IEEE 802.3ad),而 PAgP 是思科专有技术。
其它控制协议(如 DTP、VTP、CDP 和 STP)仍然通过 port-channel 发送和接收帧。STP 只在 port-channel 的第一个接口发送帧,并将 port-channel 视为单个物理端口
六、EtherChannel 配置
Switch(config)# interface range fa0/1 – 4 {我们可以使用范围或单个接口}
Switch(config-if)# channel-group [1 – 6] mode [auto | desirable | on | active | passive]
channel group 的数量与平台相关。
auto 和 desirable 模式激活 PAgP。
active 和 passive 模式激活 LACP。
on 模式强制接口不使用 PAgP 或 LACP 来建立通道。
Switch(config)#interface range ethernet0/1-2
Switch(config-if-range)#channel-group 1 mode active
七、EtherChannel 验证
如果我们想查看运行情况,可以使用关键字“etherchannel”。
S1#show interfaces etherchannel
----
Ethernet0/1:
Port state = Up Mstr Assoc In-Bndl
Channel group = 1 Mode = Active Gcchange = -
Port-channel = Po1 GC = - Pseudo port-channel = Po1
Port index = 0 Load = 0x00 Protocol = LACP
Flags: S - Device is sending Slow LACPDUs F - Device is sending fast LACPDUs.
A - Device is in active mode. P - Device is in passive mode.
Local information:
LACP port Admin Oper Port Port
Port Flags State Priority Key Key Number State
Et0/1 SA bndl 32768 0x1 0x1 0x2 0x3D
Partner's information:
LACP port Admin Oper Port Port
Port Flags Priority Dev ID Age key Key Number State
Et0/1 SA 32768 aabb.cc80.0400 12s 0x0 0x1 0x2 0x3D
Age of the port in the current state: 0d:00h:25m:17s
----
Ethernet0/2:
Port state = Up Mstr Assoc In-Bndl
Channel group = 1 Mode = Active Gcchange = -
Port-channel = Po1 GC = - Pseudo port-channel = Po1
Port index = 0 Load = 0x00 Protocol = LACP
Flags: S - Device is sending Slow LACPDUs F - Device is sending fast LACPDUs.
A - Device is in active mode. P - Device is in passive mode.
Local information:
LACP port Admin Oper Port Port
Port Flags State Priority Key Key Number State
Et0/2 SA bndl 32768 0x1 0x1 0x3 0x3D
Partner's information:
LACP port Admin Oper Port Port
Port Flags Priority Dev ID Age key Key Number State
Et0/2 SA 32768 aabb.cc80.0400 2s 0x0 0x1 0x3 0x3D
Age of the port in the current state: 0d:00h:25m:18s
----
Port-channel1:Port-channel1 (Primary aggregator)
Age of the Port-channel = 0d:00h:25m:29s
Logical slot/port = 16/0 Number of ports = 2
HotStandBy port = null
Port state = Port-channel Ag-Inuse
Protocol = LACP
Port security = Disabled
Ports in the Port-channel:
Index Load Port EC state No of bits
------+------+------+------------------+-----------
0 00 Et0/1 Active 0
0 00 Et0/2 Active 0
Time since last port bundled: 0d:00h:25m:17s Et0/1
Switch# show etherchannel [summary | load balance | port-channel]
S1#show etherchannel summary
Flags: D - down P - bundled in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use N - not in use, no aggregation
f - failed to allocate aggregator
M - not in use, minimum links not met
m - not in use, port not aggregated due to minimum links not met
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
A - formed by Auto LAG
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) LACP Et0/1(P) Et0/2(P)