EtherChannel

EtherChannel(以太通道)是由Cisco研发的,应用于交换机之间的多链路捆绑技术。它的基本原理是:将两个设备间多条相同特性的快速以太或千兆位以太物理链路捆绑在一起组成一条逻辑链路,从而达到带宽倍增的目的。除了增加带宽外,EtherChannel还可以在多条链路上均衡分配流量,起到负载分担的作用;当一条或多条链路故障时,只要还有链路正常,流量将转移到其它的链路上,整个过程在几毫秒内完成,从而起到冗余的作用,增强了网络的稳定性和安全性。在EtherChannel中,负载在各个链路上的分布可以根据源IP地址、目的IP地址、源MAC地址、目的MAC地址、源IP地址和目的IP地址组合,以及源MAC地址和目的MAC地址组合等来进行分布。两台交换机之间是否形成EtherChannel也可以用协议自动协商。目前有两个协商协议:PAgPLACPPAgP(端口汇聚协议 Port Aggregation Protocol)Cisco私有的协议,而LACP(链路汇聚控制协议 LinkAggregation Control Protocol)是基于IEEE 802.3ad的国际标准。

能形成EtherChannel的模式总结:

wKioL1bmH6axMmVaAADDF64Tk-w444.jpg

EtherChannel命令组合:

如果想把端口配置为on

sw1(config-if-range)#channel-group 1mode on

如果想把端口配置为PAgPdesirable

sw1(config-if-range)#channel-protocolpagp

sw1(config-if-range)#channel-group 1mode desirable

如果想把端口配置为PAgPauto

sw1(config-if-range)#channel-protocolpagp

sw1(config-if-range)#channel-group 1mode auto

如果想把端口配置为LACPactive

sw1(config-if-range)#channel-protocollacp

sw1(config-if-range)#channel-group 1mode active

如果想把端口配置为LACPpassive

sw1(config-if-range)#channel-protocollacp

sw1(config-if-range)#channel-group 1mode passive

EtherChannel说明:

①Cisco最多允许EtherChannel绑定8个端口;

 1>如果是快速以太网,总带宽可达1600Mbit/s

 2>如果是Gbit以太网,总带宽可达16Gbit/s

②EtherChannel不支持10M端口;

③EtherChannel编号只在本地有效,链路两端的编号可以不一样;

④EtherChannel默认使用PAgP协议;

⑤EtherChannel默认情况下是基于源MAC地址的负载平衡;

一个EtherChannel内所有的端口都必须具有相同的端口速率和双工模式,LACP只能是全双工模式;

⑦channel-group接口会自动继承最小物理接口,或最先配置的接口模式;

⑧cisco的交换机不仅可以支持第二层EtherChannel,还可以支持第三层EtherChannel

 

实验

命令:

sw1(config)#int port-channel 1        //创建以太通道,编号为1

sw1(config-if-range)#channel-group 1mode on        //将物理接口指定到已创建的通道中,模式为on

sw1(config)#port-channel load-balancedst-ip      //配置以太通道的负载平衡方式,基于目的IP

说明:

创建以太通道时要指定一个唯一的通道编号,编号范围是1-6的整数,这个编号只有本地有效,因此链路两端

  的编号可以不一样;

以太通道的负载平衡方式有:dst-ipdst-macsrc-dst-ipsrc-dst-macsrc-ipsrc-mac,默认情况下

  是基于源MAC地址的负载平衡。

wKioL1bmIibi9FhZAAAiHb-3RxI388.jpg

sw1(config)#int port-channel 1

sw1(config)#int range f0/13 - 14

sw1(config-if-range)#switchport trunkencapsulation dot1q

sw1(config-if-range)#switchport mode trunk

sw1(config-if-range)#speed 100

sw1(config-if-range)#duplex full

sw1(config-if-range)#channel-group 1 modeon

sw1(config)#port-channel load-balancedst-ip

sw2(config)#int port-channel 1

sw2(config)#int range f0/13 - 14

sw2(config-if-range)#switchport trunkencapsulation dot1q

sw2(config-if-range)#switchport mode trunk

sw2(config-if-range)#speed 100

sw2(config-if-range)#duplex full

sw2(config-if-range)#channel-group 1 modeon

sw2(config)#port-channel load-balancedst-ip

特别说明:如果本试验中交换机sw2上接的是服务器,客户计算机接在sw1上,这时在交换机sw1上应该配置为基于src-ip的负载平衡方式,而在sw2上应该配置为基于dst-ip的负载平衡方式。

实验调试

sw1#show etherchannel summary        //查看EtherChannel信息

wKioL1bmIkWTdG5GAAEx2rBtV3U232.jpg

sw1#show etherchannel load-balance        //查看EtherChannel负载平衡方式

wKiom1bmId3jkIjIAAB7JnzT2Os136.jpg

sw1#show etherchannel port-channel        //查看指定的EtherChannel包含的接口


sw1#show etherchannel protocol        //显示各个Channel-group使用的协商协议
接口如果进入err-disable状态有两种方法恢复:

手动恢复:先shutdown,再no shutdown

自动恢复:errdisablerecovery cause {all|arp-inspection|bpduguard|link-flap} 指定原因

            errdisablerecovery interval 30 指定自动恢复时间间隔

 

转载自新浪微博三忆三哭