一 交换机流统技术介绍
交换机流量统计的核心作用是帮你精确掌握特定流量在接口上的收发情况,从而快速定位故障、排查丢包或者业务不通问题。
这是最常用的场景。当设备之间ping不通或业务卡顿时,在交换机上配置针对ICMP(ping)报文的流量统计,对比接口入方向和出方向的计数:
如果入方向收到但出方向没发出去,说明报文在交换机上丢了,故障点就在这台设备。
如果接口发出的报文比对端收到的多,说明链路中间丢了包,需要在对端设备上继续配置统计来缩小范围。
二 组网如下
三 流统配置
#
acl advanced 3000
description LiuTong
rule 0 permit ip source 192.168.1.2 0 destination 192.168.2.2 0
rule 5 permit ip source 192.168.2.2 0 destination 192.168.1.2 0
#
traffic classifier 1 operator and
if-match acl 3000
#
traffic behavior 1
accounting packet
#
qos policy 1
classifier 1 behavior 1
#
interface GigabitEthernet1/0/1
qos apply policy 1 inbound
qos apply policy 1 outbound
#
interface GigabitEthernet1/0/2
qos apply policy 1 inbound
qos apply policy 1 outbound
#
流统参数:可以配置基于字节数统计,或者基于包数统计
[HX-behavior-1]accounting ?
byte Accounting in bytes
packet Accounting in packets
[HX-behavior-1]accounting
四 业务测试
<PC1>ping -c 5 192.168.2.2
Ping 192.168.2.2 (192.168.2.2): 56 data bytes, press CTRL+C to break
56 bytes from 192.168.2.2: icmp_seq=0 ttl=254 time=1.090 ms
56 bytes from 192.168.2.2: icmp_seq=1 ttl=254 time=0.727 ms
56 bytes from 192.168.2.2: icmp_seq=2 ttl=254 time=0.674 ms
56 bytes from 192.168.2.2: icmp_seq=3 ttl=254 time=0.651 ms
56 bytes from 192.168.2.2: icmp_seq=4 ttl=254 time=0.873 ms
五 状态查看
[HX]
[HX]dis qos policy interface
Interface: GigabitEthernet1/0/1
Direction: Inbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) :
If-match acl 3000
Behavior: 1
Accounting enable:
5 (Packets)
Interface: GigabitEthernet1/0/1
Direction: Outbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) :
If-match acl 3000
Behavior: 1
Accounting enable:
5 (Packets)
Interface: GigabitEthernet1/0/2
Direction: Inbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) :
If-match acl 3000
Behavior: 1
Accounting enable:
5 (Packets)
Interface: GigabitEthernet1/0/2
Direction: Outbound
Policy: 1
Classifier: 1
Operator: AND
Rule(s) :
If-match acl 3000
Behavior: 1
Accounting enable:
5 (Packets)
[HX]