了解EtherChannel-技术
在大多数网络设计中,网络管理员在设备之间连接多个物理以太网链接,以实现更多的带宽和冗余。
这样一来,链接就会被阻断,以防止生成树协议的交换循环。出于这个原因,我们需要一种技术,允许生成树协议不阻止的冗余链接。
这时,EtherChannel技术的概念及其配置将有助于轻松地处理这个问题。
前提条件
读者必须遵守以下先决条件。
- 对基本的网络概念有良好的理解。
- 对如何使用数据包追踪器配置交换机有很好的理解。
- 读者最好知道如何使用思科数据包追踪器。
什么是EtherChannel技术?
EtherChannel Technology 是一种链路聚合技术,它使交换机之间的几个物理链路结合成一个逻辑链路,以提供高速链路和冗余,而不被生成树协议所阻断。
有提供容错、负载平衡、增加带宽和冗余的功能。通过与两个协议的协商形成。 端口聚合协议(PAgp)和 链路聚合控制协议(LACP).
EtherChannel术语
EtherChannel- 是一种端口通道架构,将多个物理以太网链接组合成一个逻辑链接,在交换机和其他网络设备之间提供容错、高速和冗余的链接。Spanning Tree Protocol- 是一种数据链路层协议,可以防止具有冗余链接的网络出现环路。Port-Channel- 指交换机之间的通信链路,将多个以太网端口带宽合并为一个逻辑链路。Channel Group- 一个单一交换机上的以太网接口的集合。
EtherChannel技术协议
端口汇聚协议(PAgp)
端口汇聚协议(PAgp)是一个基于cisco的协议,在支持PAgp的厂商许可的交换机上运行。它通过检测每一方的链路配置并确保链路兼容以形成乙醚通道链路,促进了乙醚通道链路的自动创建。
它在三通道模式下工作。
- 接口上 - 在这种模式下,没有PAgP数据包的交换。
- 理想接口 - 理想模式下,接口通过发送PAgp数据包相互协商。
- 自动以太网接口 - 响应PAgp数据包,但不能与其他接口开始协商。
注意:要形成一个以太网通道,链路两边的模式必须兼容。下表显示了可以形成乙醚通道链接的不同模式组合。
| S1模式 | S2模式 | 以太通道的形成 |
|---|---|---|
| 开 | 开 | 是 |
| 开 | 希望或自动 | 无 |
| 适宜 | 理想或自动 | 是 |
| 自动 | 适宜的 | 是 |
| 自动 | 自动 | 无 |
链路聚合控制协议(LACP)
链路聚合控制协议(LACP)与PAgp协议类似,但它是一个开放的标准协议,便于在多厂商环境中配置以太网通道。不仅仅局限于cisco交换机,它允许主动链接和备用链接。
它以三种模式工作。
- 接口上 - 在这种模式下,不存在LACP数据包的交换。
- 主动接口 - 主动模式,接口通过发送LACP数据包相互协商。
- 被动-这里的接口-对收到的LACP数据包作出反应,但不能与其他接口开始协商。
下表显示了可以用LACP形成以太网通道链接的各种模式组合。
| S1模式 | S2模式 | 以太通道的形成 |
|---|---|---|
| 开 | 开 | 是 |
| 开 | 主动或被动 | 无 |
| 主动 | 主动或被动 | 是 |
| 被动 | 主动 | 是 |
| 被动 | 被动 | 无 |
注意:活动链路是当前传输流量的以太网通道链路。当当前的一个活动链路出现故障时,备用链路就会变成活动链路并接管。
以太信道网络配置
在这篇文章中,我们将学习如何使用上面讨论的两个协议来配置以太网通道。
考虑一个有三个交换机连接的网络,3台PC分别连接到一个交换机,如图所示。

我们必须将网络配置为使用一条逻辑链路,而不是连接交换机的两条快速以太网(Fa)链路。
我们将使用三个端口通道。
- 端口通道1-连接S1和S2(Fa0/1, Fa0/2)。
- 连接S2和S3的端口通道2-链路(Fa0/3, Fa0/4)。
- 连接S1和S3的端口通道3-链路(Fa0/5, Fa0/6 )
我们将通过以下步骤在端口通道1和2上使用LACP,在通道3上使用PAgp。
第一步 - 交换机的基本配置
交换机1的配置
Switch>enable
Switch#configure terminal
Switch(config)#hostname S1 !giving switch 1 a name S1
S1(config)#
交换机2的配置
Switch>enable
Switch#configure terminal
Switch(config)#hostname S2 !giving switch 2 a name S2
S2(config)#
交换机3的配置
Switch>enable
Switch#configure terminal
Switch(config)#hostname S3 !giving switch 3 a name S3
S3(config)#
第二步 - 中继端口的配置
干线端口在交换机之间传输网络中的流量。
在我们上面的网络中,主干端口是。
- Fa0/1, Fa0/2 - 连接S1和S2。
- Fa0/3, Fa0/4 - 连接S2和S3。
- Fa0/5, Fa0/6 - 连接S1和S3。
S1的主干端口配置
S1(config)#interface range fa 0/1-2, fa 0/5-6 ! configuring multiple ports at the same time
S1(config-if-range)#switchport mode trunk !configuring the ports to be trunk ports
S1(config-if-range)#do write !saving our configurations
S1(config-if-range)#
S2 干线端口配置
S2(config)#interface range fa0/1-4
S2(config-if-range)#switchport mode trunk
S2(config-if-range)#do write
S2(config-if-range)#
S3 干线端口配置
S2(config)#interface range fa0/3-6
S2(config-if-range)#switchport mode trunk
S2(config-if-range)#do write
S2(config-if-range)#
注意:
fa是指用于连接网络主机和交换机或路由器的快速以太网端口。
第三步 - 使用LACP和PAgp进行端口通道配置
使用LACP模式激活端口通道1的配置
端口通道1通过接口fa0/1和fa0/2连接交换机S1和S2。
S1配置
S1#config terminal
S1(config)#interface range fa 0/1-2
S1(config-if-range)#shutdown !disables all functions of the interfaces fa 0/1-2
S1(config-if-range)#channel-group 1 mode ? !specifying the port-channel number
S1(config-if-range)#channel-group 1 mode active !specifying the channel mode to use in our case its active for LACP
S1(config-if-range)#no shutdown !activating the port-channel interface
S1(config-if-range)#exit !exiting the interface configuartion mode
S1(config)#interface port-channel 1 !entering the interface port-channel to make it a trunk
S1(config-if)#switchport mode trunk !making the port-channel 1 a trunk port interface
S1(config-if)#do write !saving our configurations
S2配置
S2#config terminal
S2(config)#interface range fa 0/1-2
S2(config-if-range)#shutdown
S2(config-if-range)#channel-group 1 mode ?
S2(config-if-range)#channel-group 1 mode active
S2(config-if-range)#no shutdown
S2(config-if-range)#exit
S2(config)#interface port-channel 1
S2(config-if)#switchport mode trunk
S2(config-if)#do write
使用LACP模式被动和主动的端口通道2的配置。
端口通道2通过接口fa0/3和fa0/4连接交换机S2和S3。
S2配置
S2#config terminal
S2(config)#interface range fa 0/3-4
S2(config-if-range)#shutdown
S2(config-if-range)#channel-group 2 mode ?
S2(config-if-range)#channel-group 2 mode passive
S2(config-if-range)#no shutdown
S2(config-if-range)#exit
S2(config)#interface port-channel 2
S2(config-if)#switchport mode trunk
S2(config-if)#do write
S3的配置
S3#config terminal
S3(config)#interface range fa 0/3-4
S3(config-if-range)#shutdown
S3(config-if-range)#channel-group 2 mode ?
S3(config-if-range)#channel-group 2 mode active
S3(config-if-range)#no shutdown
S3(config-if-range)#exit
S3(config)#interface port-channel 2
S3(config-if)#switchport mode trunk
S3(config-if)#do write
使用PAgp模式的端口通道3的配置是可取的
端口通道3通过接口fa0/5和fa0/6连接交换机S1和S3。
S1配置
S1#config terminal
S1(config)#interface range fa 0/5-6
S1(config-if-range)#shutdown
S1(config-if-range)#channel-group 3 mode ?
S1(config-if-range)#channel-group 3 mode desirable
S1(config-if-range)#no shutdown
S1(config-if-range)#exit
S1(config)#interface port-channel 3
S1(config-if)#switchport mode trunk
S1(config-if)#do write
S3的配置
S3#config terminal
S3(config)#interface range fa 0/5-6
S3(config-if-range)#shutdown
S3(config-if-range)#channel-group 3 mode ?
S3(config-if-range)#channel-group 3 mode desirable
S3(config-if-range)#no shutdown
S3(config-if-range)#exit
S3(config)#interface port-channel 3
S3(config-if)#switchport mode trunk
S3(config-if)#do write
完成所有的配置后,我们已经创建了我们的以太网通道。我们现在可以验证端口通道是否存在,并测试PC是否可以通过创建的通道进行通信。

第四步 - 以太通道验证
为了验证我们的网络以太通道配置,使用命令show etherchannel summary ,如下图所示。
S1#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------
1 Po1(SU) LACP Fa0/1(P) Fa0/2(P)
3 Po3(SU) PAgP Fa0/5(P) Fa0/6(P)
S1#
上面,两个端口通道链接连接到交换机S1:Po1(SU) LACP 和Po3(SU) PAgp ,并显示了接口。如果我们在其他交换机上进行同样的尝试,输出仍然会显示我们的通道已经建立并运行。
为了测试我们的连接性,我们将尝试ping连接到交换机的PC。首先,让我们为这三台PCS静态分配IP地址。
就是说。
- PC3 - 192.168.1.1
- pc4 - 192.168.1.2
- pc5 - 192.168.1.3

现在,让我们从PC3. pingPC5 它应该发送回复。
以太信道的故障排除
如果以太信道链路没有运行,我们可以通过故障排除来找到错误并尝试修复它们。
- 第1步- 在这里,我们通过使用命令
show EtherChannel summary,查看已经停机的端口通道。 - 第2步- 在确定哪个端口通道被关闭后。使用命令
show EtherChannel port-channel,,将显示一个详细的输出,显示在交换机上配置的不兼容的PAgP/LACP模式。 - 第3步- 我们现在可以通过使用命令
no interface port-channel.删除该端口通道来纠正错误的配置。例如,如果是端口通道,就输入no interface port-channel1来删除端口通道1。然后,重复我们上面讨论的步骤,创建另一个端口通道,纠正不兼容的模式。
总结
正如我们所看到的,以太网通道技术对于增加我们的带宽和网络中的冗余是很方便的,而冗余的链路不会被生成树协议所阻断。
总结一下。
- 我们了解了什么是EtherChannel技术。
- 我们探索了用于EtherChannel配置的不同协议。
- 我们使用LACP和PAgp协议配置了一个网络。
- 我们学习了如何验证和排除以太通道的故障。