交换机涉及丢包问题 进行流量统计 配置参考
解决方案
关键配置如下:
#
acl number 3000
rule 0 permit icmp source 192.168.1.2 0 destination192.168.1.3 0
rule 1 permit icmp source 192.168.1.3 0 destination 192.168.1.2 0 //需要统计的流量,源做目的,目的做源.需要正反写两条rule条目
#
traffic classifier 3000 operator and
if-match acl 3000
#
traffic behavior 3000
permit
statistic enable
// 在流行为中 开启流量统计功能 statistic enable
#
traffic policy 3000
classifier 3000 behavior 3000
#
interface gigabitEthernet0/0/1
// 在流量的进入交换机的接口和出交换机的接口上都要双方向调用流策略
traffic-policy 3000 inbound
traffic-policy 3000 outbound
#
interface gigabitEthernet0/0/2
//在流量的进入交换机的接口和出交换机的接口上都要双方向调用流策略
traffic-policy 3000 inbound
traffic-policy 3000 outbound
#
PC1>ping 192.168.1.3 // PC1 ping PC2测试流量统计效果
Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to break
From 192.168.1.3: bytes=32 seq=1 ttl=128 time=31 ms
From 192.168.1.3: bytes=32 seq=2 ttl=128 time=15 ms
From 192.168.1.3: bytes=32 seq=3 ttl=128 time=15 ms
From 192.168.1.3: bytes=32 seq=4 ttl=128 time<1 ms
From 192.168.1.3: bytes=32 seq=5 ttl=128 time=31 ms
--- 192.168.1.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 0/18/31 ms
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/1 inbound
Interface: GigabitEthernet0/0/1
Traffic policy inbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item Packets Bytes
---------------------------------------------------------------------
Matched 10 740
+--Passed 10 740
+--Dropped 0 0
+--Filter 0 0
+--URPF - -
+--CAR 0 0
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/1 outbound
Interface: GigabitEthernet0/0/1
Traffic policy outbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item Packets Bytes
---------------------------------------------------------------------
Matched 10 740
+--Passed 10 740
+--Dropped 0 0
+--Filter 0 0
+--URPF - -
+--CAR 0 0
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/2 inbound
Interface: GigabitEthernet0/0/2
Traffic policy inbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item Packets Bytes
---------------------------------------------------------------------
Matched 10 740
+--Passed 10 740
+--Dropped 0 0
+--Filter 0 0
+--URPF - -
+--CAR 0 0
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/2 outbound
Interface: GigabitEthernet0/0/2
Traffic policy outbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item Packets Bytes
---------------------------------------------------------------------
Matched 10 740
+--Passed 10 740
+--Dropped 0 0
+--Filter 0 0
+--URPF - -
+--CAR 0 0
入接口GigabitEthernet 0/0/1 inbound 方向通过的数据包个数 等于出接口GigabitEthernet 0/0/2 outbound方向通过的数据包个数,表明ping的请求包交换机没有丢包
入接口GigabitEthernet 0/0/1 outbound 方向通过的数据包个数 等于出接口GigabitEthernet 0/0/2 inbound方向通过的数据包个数,表明ping的回包交换机没有丢包
清空接口统计计数:
reset traffic policy statistics interface GigabitEthernet 0/0/2 outbound