日期:2015-06-02 點(diǎn)擊: 關(guān)鍵詞:Cisco Catalyst 6500,4500,2960,3750,3750G,3750X,3560 Series S
如何查看某一條流在etherchannel中走哪一條物理link,涉及設(shè)備平臺(tái):Cisco Catalyst 6500, 4500, 2960, 3750, 3750G,3750X, and 3560 Series Switches.
背景:
Etherchannel load-balance工作是基于所配置的對(duì)于不同流量的哈希算法所得到的0-7這8個(gè)哈希值的。哈希的結(jié)果我們叫做 Result Bundle Hash (RBH)
注意哈希值是根據(jù)我們所配置的load-balancing 的算法來確定的。下面是一個(gè)例子:
Source 192.168.1.1 (mac a.a.a ) sending a tcp stream to 172.16.1.1 ( mac b.b.b )
with a source tcp port of 50 and destination port 2000
Source 192.168.1.1 (mac a.a.a ) sending a tcp stream to 209.165.201.1 ( mac c.c.c )
with a source tcp port of 60 and destination 2000.
If configured load balancing algorithm is SRC_MAC
Then no of flows = 1
If configured load balancing algorithm is DST_MAC
Then no of flows = 2
If configured load balancing algorithm is DST_PORT
Then no of flows= 1
1, 查在用的load-balance算法
2, 進(jìn)入switch processor (SP),敲show etherchannel load-balance:
6500#remote login sw
Trying Switch ...
Entering CONSOLE for Switch
Type "^C^C^C" to end this session
6500−sp#show etherchannel load−balance
EtherChannel Load−Balancing Configuration:
src−dst−ip
mpls label−ip
3, 查具體某一條flow的RBH 值:
6500−sp#test etherchannel load−balance interface port−channel
在上面的例子中,這條flow是在192.168.1.1 和172.16.1.1,問題中的Portchannel是port-channel 1。如果我們配置的算法是基于src-dst ip 的,那我們就填入源目IP: 192.168.1.1 和 172.16.1.1:
6500−sp#test etherchannel load−balance int port−channel 1 ip 192.168.1.1 172.16.1.1
Computed RBH: 0x5
Would select Gi3/2 of Po1
4, 在一些IOS中是不會(huì)去顯示流量從哪個(gè)具體物理接口的,可以使用如下的方法:
在RP的console中敲show interface port−channel etherchannel。 然后再按照下面的方法計(jì)算出來是哪個(gè)物理端口:
6500#show interface port−channel 1 etherchannel
Port−channel1 (Primary aggregator)
Age of the Port−channel = 0d:01h:05m:54s
Logical slot/port = 14/1 Number of ports = 2
HotStandBy port = null
Port state = Port−channel Ag−Inuse
Protocol = LACP
Fast−switchover = disabled
Ports in the Port−channel:
Index Load Port EC state No of bits
−−−−−−+−−−−−−+−−−−−−+−−−−−−−−−−−−−−−−−−+−−−−−−−−−−−
0 55 Gi3/1 Active 4
1 AA Gi3/2 Active 4
在輸出中l(wèi)oad一欄可以看到兩個(gè)Portchannel中的接口分別為55 和AA。
我們分別將55和AA轉(zhuǎn)換為2進(jìn)制后,用下面的方法來確定RBH值對(duì)應(yīng)的物理接口是哪個(gè):
像上面這樣,AA對(duì)應(yīng)的2進(jìn)制是1010 1010;55對(duì)應(yīng)的是0101 0101 。然后再從7-0進(jìn)行匹配,對(duì)應(yīng)1的就是該接口所對(duì)應(yīng)的RBH值。
在上面例子中,G3/2對(duì)應(yīng)的RBH值為:1 3 5 7;G3/1對(duì)應(yīng)的是0 2 4 6
這樣我們?cè)俚玫絉BH值之后就能夠用這種方法匹配出對(duì)應(yīng)接口。
1, 檢查load-balancing算法: show etherchannel load-balance
2, 用如下命令查看:
4500#show platform software etherchannel port−channel 1 map ip 192.168.1.1 172.16.1.1
Map port for IP 192.168.1.1, 172.16.1.1 is Gi3/1(Po1)
NOTE: Software forwarded traffic uses Gi3/1(Po1)
Catalyst 3750 系列交換機(jī):
使用如下命令:
test etherchannel load−balance interface port−channel
舉個(gè)例子:
3750(config)#port−channel load−balance src−dst−ip
3750#show etherchannel load−balance
EtherChannel Load−Balancing Configuration:
src−dst−ip
3750#test etherchannel load−balance interface port−channel 1 ip 192.168.1.1 172.16.1.1
Would select Gi3/1 of Po1
如果算法是基于MAC地址的,根據(jù)源目MAC也可以用該命令找到物理端口。