EtherChannel詳解

1簡介

etherchannel特性在switchswitchswitchrouter之間提供冗餘的、高速的連接方式,簡單說就是將兩個設備間多條FEGE物理鏈路捆在一起組成一條設備間邏輯鏈路,從而達到增加帶寬,提供冗餘的目的。

通過這個技術能夠將多個物理端口綁定爲一個邏輯端口通過多個端口綁定,能充分利用現有端口來增加帶寬。Cisco交換機最多允許綁定8個端口。如果是快速以太網,總帶寬可達1600Mbit/s如果是Gbit以太網,總帶寬可達16Gbit/s綁定後的端口默認繼承原來物理接口的配置模式。
etherchannel
不支持10M端口的綁定
cisco的交換機不僅可以支持第二層etherchannel,還可以支持第三層etherchannel
一個etherchannel內所有的端口都必須具有相同的速率和雙工模式。LACP只能是全雙工。
二層接口和三層接口的區別:
二層接口不能配置IP地址,不能宣告進路由協議,只能對二層以太網幀進行轉發。
三層接口可以配置IP地址,可運行路由協議,能接收IP包並且轉發。
EtherChannel的模式:
可以直接將物理端口綁定,也可以讓兩臺交換機之間通過協議進行協商,來形成channel通道。
On:強行起etherchannel
Sw1(config)#int rangef0/8 ,f0/9
Sw1(config-if-range)#channel-group 1 mode on
將這兩個接口綁定爲一組並指定on模式組號本地有效
Sw1(config)#interface  port-channel  1
Sw1(config-if)#switchport  mode  trunk
指定接口模式爲trunk,如不指定,會自動繼承物理接口的模式
Sw1#show etherchannel summary
可以看到綁定了多少接口
Show interface etherchannel
Sw1(config)#no interface port-channel 1
拆除etherchannel
強行起通道的話要在短期內在雙方啓用。否則可能環路。協商起鏈路則沒有這問題,因爲啓用不起通道的話會down


Port AggregationProtocol (PAgP)端口匯聚協議
Cisco
私有技術,這個協議又有兩種模式:
auto:被動只收不發
desirable:主動會發也會收協商消息
Sw1(config)#int range f0/8 ,f0/9
Sw1(config-if-range)#channel-group 1 mode desi
rable
Sw1(config)#int range f0/8 ,f0/9
Sw1(config-if-range)#channel-group 1 mode auto
Sw1(config)#interface  port-channel  1
Sw1(config-if)#switchport  mode  trunk
Link AggregationControl Protocol (LACP) 鏈路聚合控制協議
802.3ad
,業界標準
Passvie相當於PAgPauto  
Active相當於PAgPdesirable  又發又收協商消息
Sw1(config)#int range f0/8 ,f0/9
Sw1(config-if-range)#channel-group 1 mode passive
Sw1(config)#int range f0/8 ,f0/9
Sw1(config-if-range)#channel-group 1 mode active
Sw1(config)#interface  port-channel  1
Sw1(config-if)#switchport  mode  trunk
show etherchannel 1 summary
show etherchannel  summary  
查看所有的group
還有一種好的辦法是先對每個接口封裝trunk,再劃入channel-group中,channel-group接口會自動繼承trunk
注:channel-group接口會自動繼承第一個物理接口的接口配置模式,或最先配置的接口模式。


三層channel
所謂三層的channel其實就是將多個三層接口綁定。只能在三層交換機上配置。
3550這樣的交換機上,所有接口默認都是二層接口。首先需要將交換機的的二層接口改爲三層接口。可用以下命令實現:
3550(config)#interface  gigabitethernet 0/1
3550(config-if)#no  switchport
然後再綁定:
3550(config-if)#channel-group  1  mode  desirable
3550(config-if)#exit
將另一個端口也綁進來
3550(config)#interface  gigabitethernet 0/2
3550(config-if)#no  switchport
3550(config-if)#channel-group  1  mode  desirable
3550(config-if)#exit
channel通道配上IP地址:
3550(config)#interface  port-channel  1
3550(config-if)#ip  address  100.1.1.1  255.255.255.0
當物理接口放進了邏輯接口,那物理接口的配置就忽略了,如ip地址。
配置etherchannel負載均衡
默認情況下是基於源MAC地址的負載均衡
port-channel load-balance [dst-mac|src-mac]
show etherchannel load-balance
3560
可以基於源目IP來做負載均衡
Err-disable
特性:
接口如果進入err-disable狀態:有兩種方法恢復
1
、手動恢復
shutdown、再no shutdown
2
、自動恢復
  errdisable recovery cause {all|arp-inspection|bpduguard|link-flap}
指定原因
  errdisable recovery interval 30  
指定自動恢復時間間隔
兩臺交換機之間是否形成EtherChannel也可以用協議自動協商。目前有兩個協商協議:PAGPLACP,前者是CISCO專有的協議,而LACP是公共的標準。
LACP協商的規律
              ON      active      passive
ON          √           ×              ×
active      ×          √              √
passive   ×          √               ×
PAGP
協商的規律
             ON      Desirable     auto
ON          √           ×               ×
desirable ×           √               √
auto        ×            √                ×
要想把接口配置爲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”
端口通道負載均衡  port-channel load-balance
sw1(config)#port-channel load-balance ?
 dst-ip       Dst IP Addr
 dst-mac      Dst Mac Addr
 src-dst-ip   Src XOR Dst IP Addr
 src-dst-mac  Src XOR Dst Mac Addr
 src-ip       Src IP Addr
 src-mac      Src Mac Addr
sw1#show etherchannel summary
Flags:  D - down        P - inport-channel
       I - stand-alone s - suspended
       R -Layer3      S - Layer2
       U - in use
Group Port-channel  Ports
-----+------------+-----------------------------------------------------------
1     Po1(SD)     Fa0/0(s)  Fa0/1(s)
sw1#show etherchannel load-balance
Po1 ---> Source XOR Destination IP address
備註:
1
、以太網通道最多可以捆綁8條物理鏈路
2
、捆綁遵循以下規則:
1)相同VLAN
2)端口中繼模式
3)相同speedduplex

-----------------------------------------------------------------------------------------------------------------------------------------------------

2命令

EtherChannel命令組合:

如果想把端口配置爲on:

sw1(config-if-range)#channel-group1 mode on

如果想把端口配置爲PAgP的desirable:

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

sw1(config-if-range)#channel-group1 mode desirable

如果想把端口配置爲PAgP的auto:

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

sw1(config-if-range)#channel-group1 mode auto

如果想把端口配置爲LACP的active:

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

sw1(config-if-range)#channel-group1 mode active

如果想把端口配置爲LACP的passive:

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

sw1(config-if-range)#channel-group1 mode 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。

查看EtherChannel信息

S1#show etherchannel summary

------------------------------------------------------------------------------

3案例


案例一(強制模式)

1.實驗目的

掌握

①EtherChannel的工作原理;

②EtherChannel的配置。

2.實驗拓撲圖

3.實驗步驟

構成EnterChannel的端口必須具有相同的特性,如雙工模式、速度和Trunking 的狀態等。

S1(config)#interface rangefastEthernet 0/1 - 2

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

S1(config-if-range)#exit

S1(config)#interface port-channel 1

S1(config-if)#switchport trunkencapsulation dot1q

S1(config-if)#switchport mode trunk


S2(config)#interface rangefastEthernet 0/1 - 2

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

S2(config-if-range)#exit

S2(config)#interface port-channel 1

S2(config-if)#switchport trunkencapsulation dot1q

S2(config-if)#switchport mode trunk


S1(config)#port-channel load-balancedst-msc

S2(config)#port-channel load-balancedst-msc

//以上是配置EtherChannel的負載平衡方式,默認爲源MAC地址

命令格式爲”port-channelload-balance method”,負載平衡的方式有:dst-ip、dst-mac、src-dst-ip、src-dst-mac等


(2)查看EtherChannel信息

S2#show etherchannel summary

Flags: D - down        P - inport-channel

      I - stand-alone s - suspended

      H - Hot-standby (LACP only)

      R - Layer3      S - Layer2

      U - in use      f - failed toallocate 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)           PAgP   Fa0/1(P) Fa0/2(P)


//可以看到EtherChannel已經形成,”SU”表示EtherChannel正常,如果顯示爲”SD”,表示把EthernetChannel接口關掉重新開啓。

案例二(PAGP模式)

1.實驗目的

掌握

①EtherChannel的工作原理;

②EtherChannel的配置。

2.實驗拓撲圖

1.實驗步驟


S1(config)#interface range f0/1 - 2

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

S1(config-if-range)#exit

S1(config)#int port-channel 1

S1(config-if)#switchport trunk encapsulation dot1q

S1(config-if)#switchport mode trunk


S2(config)#interface range f0/1 - 2

S2(config-if-range)#channel-group 1 modedesirable

S2(config-if-range)#exit

S2(config)#int port-channel 1

S2(config-if)#switchport trunkencapsulation dot1q

S2(config-if)#switchport mode trunk


S1(config)#port-channel load-balancedst-msc

S2(config)#port-channel load-balancedst-msc

//以上是配置EtherChannel的負載平衡方式,默認爲源MAC地址

命令格式爲”port-channelload-balance method”,負載平衡的方式有:dst-ip、dst-mac、src-dst-ip、src-dst-mac等


(2)查看EtherChannel信息

S2#sho etherchannel summary

Flags:  D -down        P - in port-channel

       I -stand-alone s - suspended

       H -Hot-standby (LACP only)

       R -Layer3      S - Layer2

       U - inuse      f - failed to allocateaggregator

       u -unsuitable for bundling

       w - waitingto be aggregated

       d - defaultport



Number of channel-groups in use: 1

Number of aggregators:           1


Group Port-channel  Protocol    Ports

------+-------------+-----------+----------------------------------------------


1      Po1(SU)           PAgP   Fa0/1(P) Fa0/2(P)



//可以看到EtherChannel已經形成,”SU”表示EtherChannel正常,如果顯示爲”SD”,表示把EthernetChannel接口關掉重新開啓。


案例三(LACP模式)

1.實驗目的

掌握

①EtherChannel的工作原理;

②EtherChannel的配置。

2.實驗拓撲圖

2.實驗步驟


S1(config)#interface range f0/1 - 2

S1(config-if-range)#channel-group1 mode active

S1(config-if-range)#exit

S1(config)#int port-channel 1

S1(config-if)#switchport trunk encapsulation dot1q

S1(config-if)#switchport mode trunk


S2(config)#interface range f0/1 - 2

S2(config-if-range)#channel-group 1 modeactive

S2(config-if-range)#exit

S2(config)#int port-channel 1

S2(config-if)#switchport trunkencapsulation dot1q

S2(config-if)#switchport mode trunk


S1(config)#port-channel load-balancedst-msc

S2(config)#port-channel load-balancedst-msc

//以上是配置EtherChannel的負載平衡方式,默認爲源MAC地址

命令格式爲”port-channelload-balance method”,負載平衡的方式有:dst-ip、dst-mac、src-dst-ip、src-dst-mac等


(2)查看EtherChannel信息

S1#sh etherchannel summary

Flags:  D -down        P - in port-channel

       I -stand-alone s - suspended

       H -Hot-standby (LACP only)

       R -Layer3      S - Layer2

       U - inuse      f - failed to allocateaggregator

       u -unsuitable for bundling

       w - waitingto be aggregated

       d - defaultport



Number of channel-groups in use: 1

Number of aggregators:           1


Group Port-channel  Protocol    Ports

------+-------------+-----------+----------------------------------------------


1      Po1(SU)           LACP   Fa0/1(P) Fa0/2(P)


//可以看到EtherChannel已經形成,”SU”表示EtherChannel正常,如果顯示爲”SD”,表示把EthernetChannel接口關掉重新開啓。


案例四(三層模式)

1.實驗目的

掌握

①EtherChannel的工作原理;

②EtherChannel的配置。

2.實驗拓撲圖


配置

S1(config)#interface range f0/1 – 2

S1(config-if-range)no switchport  開啓接口三層端口

S1(config-if-range)#channel-group1 mode active

S1(config-if-range)#exit

S1(config)#int port-channel 1

S1(config-if)# ip add 192.168.1.0 255.255.255.0


S2(config)#interface range f0/1 – 2

S2(config-if-range)no switchport 開啓接口三層端口

S2(config-if-range)#channel-group 1 modeactive

S2(config-if-range)#exit

S2(config)#int port-channel 1

S1(config-if)# ip add 192.168.2.0 255.255.255.0


S1(config)#port-channel load-balancedst-msc

S2(config)#port-channel load-balancedst-msc

//以上是配置EtherChannel的負載平衡方式,默認爲源MAC地址

命令格式爲”port-channelload-balance method”,負載平衡的方式有:dst-ip、dst-mac、src-dst-ip、src-dst-mac等


(2)查看EtherChannel信息

Switch#show etherchannel查看Etherchannel的相關參數)


四、應用場景

網絡骨幹鏈路上實現高帶寬、鏈路備份、負載均衡


注:三層模式其他方式同二層,注意使用S1(config-if-range)noswitchport  開啓接口三層端口



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章