日期:2015-06-02 点击: 关键词:Cisco Catalyst 6500,4500,2960,3750,3750G,3750X,3560 Series S
如何查看某一条流在etherchannel中走哪一条物理link,涉及设备平台:Cisco Catalyst 6500, 4500, 2960, 3750, 3750G,3750X, and 3560 Series Switches.
背景:
Etherchannel load-balance工作是基于所配置的对于不同流量的哈希算法所得到的0-7这8个哈希值的。哈希的结果我们叫做 Result Bundle Hash (RBH)
注意哈希值是根据我们所配置的load-balancing 的算法来确定的。下面是一个例子:
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, 进入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中是不会去显示流量从哪个具体物理接口的,可以使用如下的方法:
在RP的console中敲show interface port−channel etherchannel。 然后再按照下面的方法计算出来是哪个物理端口:
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
在输出中load一栏可以看到两个Portchannel中的接口分别为55 和AA。
我们分别将55和AA转换为2进制后,用下面的方法来确定RBH值对应的物理接口是哪个:
像上面这样,AA对应的2进制是1010 1010;55对应的是0101 0101 。然后再从7-0进行匹配,对应1的就是该接口所对应的RBH值。
在上面例子中,G3/2对应的RBH值为:1 3 5 7;G3/1对应的是0 2 4 6
这样我们再得到RBH值之后就能够用这种方法匹配出对应接口。
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 系列交换机:
使用如下命令:
test etherchannel load−balance interface port−channel
举个例子:
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地址的,根据源目MAC也可以用该命令找到物理端口。