SW流统(示例:源19.168.1.253,目的10.1.2.252)
# 配置ACL规则。
[HUAWEI] acl number 3001
[HUAWEI-acl-adv-3001] rule 5 permit icmp source 19.168.1.253 0 destination 10.1.2.252 0
[HUAWEI-acl-adv-3001] rule 10 permit icmp source 10.1.2.252 0 destination 19.168.1.253 0
[HUAWEI-acl-adv-3001] quit
# 配置流分类。
[HUAWEI] traffic classifier test
[HUAWEI-classifier-test] if-match acl 3001
[HUAWEI-classifier-test] quit
# 配置流行为。
[HUAWEI] traffic behavior test
[HUAWEI-behavior-test] statistic enable
[HUAWEI-behavior-test] quit
# 配置流策略。
[HUAWEI] traffic policy test
[HUAWEI-trafficpolicy-test] classifier test behavior test
[HUAWEI-trafficpolicy-test] quit
应用流策略。
[HUAWEI] interface gigabitethernet0/0/6 //数据通过的物理接口
[HUAWEI-GigabitEthernet0/0/6] traffic-policy test inbound
[HUAWEI-GigabitEthernet0/0/6] quit
[HUAWEI] interface gigabitethernet0/0/6
[HUAWEI-GigabitEthernet0/0/6] traffic-policy test outbound
配置完成后,ping测试
如果需要重新进行流量统计,可执行下面命令清除原有流量统计信息。
reset traffic-policy statistics interface interface-type interface-number
查看对应入方向的流量统计:
display traffic policy statistics interface GigabitEthernet 0/0/6 inbound verbose rule-base
查看对应出方向的流量统计:
display traffic policy statistics interface GigabitEthernet 0/0/6 outbound verbose rule-base