交換機S1, S2之間有兩條鏈路相連,如果捆綁在一起,成爲一個邏輯聚合鏈路 (trunk),不但增加帶寬,並提供冗餘容錯的能力。
構成EtherChannel的端口必須具有相同的特性,如雙工模式,速度,trunking的狀態等。可以採用手動配置和自動配置(PAGP或者LAGP)兩種方法來配置EtherChannel。自動配置就是讓EtherChannel協商協議自動協議,從而建立EtherChannel。
1、手動配置EtherChannel
S1>enable
S1#config t
Enter configuration commands, one per line. End with CNTL/Z.
S1(config)#int port-channel 1
S1(config-if)#exit
//以上創建EtherChannel 並指定唯一的編號 1
S1(config)#int f0/13
S1(config-if)#channel-group 1 mode on
S1(config-if)#exit
S1(config)#int f0/14
S1(config-if)#channel-group 1 mode on
S1(config-if)#exit
//以上將物理接口指定到已創建的通道中
S1(config)#int port-channel 1
S1(config-if)#switchport mode trunk
S1(config-if)#speed 100
S1(config-if)#duplex full
S1(config-if)#
S1(config-if)#exit
//以上配置通道中的物理接口的屬性
S1(config)#port-channel load-balance dst-mac
S1(config)#end
S1#
//以上配置EtherChannel 的負載平衡方式,命令格式爲port-channel load-balance method。
//負載平衡的方式有dst-ip、set-mac、src-dst-ip、src-dst-mac等。
S2的配置步驟和S1一樣!
2、查看EtherChannel信息
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: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
----------+----------------------+-----------------+----------------------------------
1 Po1(SU) ------ Fa0/14(P)
//可以看到,EtherChannel已經形成,‘SU’表示EtherChannel正常;如果顯示爲‘SD’,則把EtherChannel接口關閉重新開啓。
//關閉命令:no interface port-channel 1
3、配置PAGP或者LACP
技術要點:
要把接口配置爲PAGP的desirable模式,使用channel-group 1 mode desirable命令。
要把接口配置爲PAGP的auto模式,使用channel-group 1 mode auto命令。
要把接口配置爲LAGP的active模式,使用channel-group 1 mode active命令。
要把接口配置爲LAGP的passive模式,使用channel-group 1 mode passive命令。
S1(config)#int range f0/13-14
S1(config-if-range)#channel-group 1 mode desirable
//以上配置S1
S2(config)#int range f0/13-14
S2(config-if-range)#channel-group 1 mode desirable
//以上配置S2
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: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
----------+----------------------+-----------------+----------------------------------
1 Po1(SU) PApP Fa0/13(P) Fa0/14(P)
//可以看到,EtherChannel協商成功,注意應在鏈路的兩端進行檢查,確認兩端都形成EtherChannel通道才行