EtherChannel
EtherChannel(以太通道)是由Cisco研發的,應用於交換機之間的多鏈路捆綁技術。它的基本原理是:將兩個設備間多條相同特性的快速以太或千兆位以太物理鏈路捆綁在一起組成一條邏輯鏈路,從而達到帶寬倍增的目的。除了增加帶寬外,EtherChannel還可以在多條鏈路上均衡分配流量,起到負載分擔的作用;當一條或多條鏈路故障時,只要還有鏈路正常,流量將轉移到其它的鏈路上,整個過程在幾毫秒內完成,從而起到冗餘的作用,增強了網絡的穩定性和安全性。在EtherChannel中,負載在各個鏈路上的分佈可以根據源IP地址、目的IP地址、源MAC地址、目的MAC地址、源IP地址和目的IP地址組合,以及源MAC地址和目的MAC地址組合等來進行分佈。兩臺交換機之間是否形成EtherChannel也可以用協議自動協商。目前有兩個協商協議:PAgP和LACP,PAgP(端口匯聚協議 Port Aggregation Protocol)是Cisco私有的協議,而LACP(鏈路匯聚控制協議 LinkAggregation Control Protocol)是基於IEEE 802.3ad的國際標準。
能形成EtherChannel的模式總結:
EtherChannel命令組合:
如果想把端口配置爲on:
sw1(config-if-range)#channel-group 1mode on
如果想把端口配置爲PAgP的desirable:
sw1(config-if-range)#channel-protocolpagp
sw1(config-if-range)#channel-group 1mode desirable
如果想把端口配置爲PAgP的auto:
sw1(config-if-range)#channel-protocolpagp
sw1(config-if-range)#channel-group 1mode auto
如果想把端口配置爲LACP的active:
sw1(config-if-range)#channel-protocollacp
sw1(config-if-range)#channel-group 1mode active
如果想把端口配置爲LACP的passive:
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-ip、dst-mac、src-dst-ip、src-dst-mac、src-ip、src-mac,默認情況下
是基於源MAC地址的負載平衡。
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信息
sw1#show etherchannel load-balance //查看EtherChannel負載平衡方式
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 指定自動恢復時間間隔
轉載自新浪微博三憶三哭