实验5:EtherChannel配置1.实验目的通过本实验,读者可以掌握如下技能:①EtherChannel的工作原理;②EtherChannel的配置。
2.实验拓扑实验拓扑图如图5-1所示。
图5-1 实验4拓扑图3.实验步骤构成EnterChannel的端口必须具有相同的特性,如双工模式、速度和Trunking 的状态等。
配置EtherChannel有手支配置和自动配置(PAGP或者LAGP)两种方法,自动配置就是让EtherChannel协商协议自动协商EtherChannel的建立。
实验1-1:(1)手动配置EtherChannelS1(config)#interface port-channel 1//以上是创建以太通道,要指定一个唯一的通道组号,组号的范围是1~6的正整数。
要取消EtherChannel时用”no interface port-channel 1”命令S1(config)#interface f0/13S1(config-if)#channel-group 1 mode onS1(config)#interface f0/14S1(config-if)#channel-group 1 mode on//以上将物理接口指定到已创建的通道中S1(config)#int port-channel 1S1(config-if)#switchport mode trunkS1(config-if)#speed 100S1(config-if)#duplex full//以上配置通道中的物理接口的速率及双工等属性S1(config)#port-channel load-balance dst-ip//在EtherChannel中,负载在各个链路上的分布可以根据源IP地址、目的IP地址、源MAC 地址、目的MAC地址、源IP地址和目的IP地址组合,以及源MAC地址和目的MAC地址组合等来进行分布。
两台交换机之间是否形成EtherChannel也可以用协议自动协商。
目前有两个协商协议:PAgP和LACP,PAgP(端口汇聚协议 Port Aggregation Protocol)是Cisco私有的协议,而LACP(链路汇聚控制协议 Link Aggregation Control Protocol)是基于IEEE 802.3ad的国际标准。
//以上是配置EtherChannel的负载平衡方式,命令格式为”port-channel load-balance method”,负载平衡的方式有:dst-ip、dst-mac、src-dst-ip、src-dst-mac等S2(config)#interface port-channel 1S2(config)#interface f0/13S2(config-if)#channel-group 1 mode onS2(config)#interface f0/14S2(config-if)#channel-group 1 mode onS2(config)#int port-channel 1S2(config-if)#switchport 1 mode trunkS2(config-if)#speed 100S2(config-if)#duplex full //注意交换机提示:%Command not available for fiber interfaces.S2(config)#port-channel load-balance dst-mac//以上是配置EtherChannel的负载平衡方式,命令格式为”port-channel load-balance method”,负载平衡的方式有:dst-ip、dst-mac、src-dst-ip、src-dst-mac等(2)查看EtherChannel信息S1#show etherchannel summaryFlags; D - down P - in port-channelI - stand-alone s - suspendedH - Hot-standby (LACP only)R - Layer3 S - Layer2U - in use f - failed to allocate aggregatoru - unsuitable for bundlingw – waiting to be aggregatedd - default portNumber of channel-groups in use; 1Number of aggregators; 1Group Port-channel Protocol Ports------+-------------+-----------+-----------------------------------------------1 Po1(SU) - Fa0/13(P) Fa0/14(P)//可以看到EtherChannel已经形成,”SU”表示EtherChannel正常,如果显示为”SD”,表示把EthernetChannel接口关掉重新开启。
S1# show etherchannel load-balance//显示负载平衡方式。
IPV4和IPv6数据包均基于目的IP进行负载平衡,而对于非ip包则基于目的MAC进行负载平衡。
实验1-2:PAGP配置:(1)配置PAGP或者LAGP Cisco交换机默认PAGP协议!【技术要点】●要想把接口配置为PAGP的desirable模式使用命令:”channel-group 1 mode desirable”;●要想把接口配置为PAGP的auto模式使用命令:”channel-group 1 mode auto”;●要想把接口配置为LACP的active模式使用命令:”channel-group 1 mode active”;●要想把接口配置为LACP的passive模式使用命令:”channel-group 1 mode passive”。
PAGP配置:在这里进行如下配置:S1(config)#interface range f0/13 – 14S1(config-if)#channel-protocal pagp//PAGP 是默认协议,可以不配置S1(config-if)#channel-group 1 mode desirable//配置PAGP的模式为DESIRABLES1(config-if)#switchport mode trunkS2(config)#interface range f0/13 – 14S2(config-if)#channel-group 1 mode autoS2(config-if)#switchport mode trunk(2)Show etherchannel summary 该命令用来查看ether-channel的简要信息S1#show etherchannel summaryFlags; D - down P - in port-channelI - stand-alone s - suspendedH - Hot-standby (LACP only)R - Layer3 S - Layer2U - in use f - failed to allocate aggregatoru - unsuitable for bundlingw – waiting to be aggregatedd - default portNumber of channel-groups in use; 1Number of aggregators; 1Group Port-channel Protocol Ports------+-------------+-----------+-----------------------------------------------1 Po1(SU) - Fa0/13(Pd) Fa0/14(P)//可以看到EtherChannel协商成功。
注意:应在链路的两端都进行检查,确认两端都形成以太通道才行(3)Show etherchannel port-channel该命令用来查看指定的etherchannel包含的接口。
(4) 测试etherchannel 的冗余功能在交换机S1和交换机S2的VLAN 接口上配置IP地址S1(config)#interface vlan 1S1(config)#ip add 173.16.100.1 255.255.255.0S1(config)#interface fa 0/15S1(config-if)#shutdownS2(config)#interface vlan 1S2(config)#ip add 173.16.100.2 255.255.255.0S2(config)#interface fa 0/15S2(config-if)#shutdown从交换机S1连续PING 交换机S2 ,命令为:ping 172.16.100.2 repeat 9000000 ,在交换机S2上关闭f 0/13 ,在交换机S1上查看通讯应该不中断。
在S2上开启f0/13 f0/14 ,在交换机S1上查看通讯应该不中断。
S2#Show etherchannel summary//当f0/14接口关闭后,Etherchannel gropup只有一个接口了,f0/14处于down 状态。
能形成EtherChannel的模式总结:EtherChannel命令组合:如果想把端口配置为on:sw1(config-if-range)#channel-group 1 mode on如果想把端口配置为PAgP的desirable:sw1(config-if-range)#channel-protocol pagpsw1(config-if-range)#channel-group 1 mode desirable如果想把端口配置为PAgP的auto:sw1(config-if-range)#channel-protocol pagpsw1(config-if-range)#channel-group 1 mode auto如果想把端口配置为LACP的active:sw1(config-if-range)#channel-protocol lacpsw1(config-if-range)#channel-group 1 mode active如果想把端口配置为LACP的passive:sw1(config-if-range)#channel-protocol lacpsw1(config-if-range)#channel-group 1 mode passiveEtherChannel说明:①Cisco最多允许EtherChannel绑定8个端口;1>如果是快速以太网,总带宽可达1600Mbit/s;2>如果是Gbit以太网,总带宽可达16Gbit/s。