华为交换机流量统计配置

流量统计作为平常运维工作中排查故障不可或缺的一个手段,今天分享一下流量统计的基本配置吧。

下面就直接开始吧。

1、从用户视图切换到系统视图

<Huawei>system-view

2、创建ACL3333匹配ping请求报文,ACL3334匹配ping响应报文

acl 3333
rule 5 permit icmp source 43.14.129.79 0 destination 43.14.131.254 0
quit
acl 3334
rule 5 permit icmp source 43.14.131.254 0 destination 43.14.129.79 0
quit

3、配置流分类,引用前面配置的ACL规则

traffic classifier test1
if-match acl 3333
quit
traffic classifier test2
if-match acl 3334
quit

4、配置流行为,启用计数功能

traffic behavior test1
statistic enable
quit
traffic behavior test2
statistic enable
quit

5、配置流策略,将流分类和流行为关联

traffic policy test1
classifier test1 behavior test1
quit
traffic policy test2
classifier test2 behavior test2
quit

6、在连接电脑的接口上应用流策略

interface GigabitEthernet 0/0/2
traffic-policy test1 inbound
traffic-policy test2 outbound
quit

7、在连接路由器的接口上应用流策略

[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]traffic-policy test2 inbound
[Huawei-GigabitEthernet0/0/1]traffic-policy test1 outbound
[Huawei-GigabitEthernet0/0/1]quit

二、测试并查看统计结果
(1)用电脑192.168.1.2去ping路由器192.168.1.1。
(2)查看统计结果
查看ping请求:

display traffic policy statistics interface GigabitEthernet 0/0/2 inbound
display traffic policy statistics interface GigabitEthernet 0/0/1 outbound

查看ping响应:

display traffic policy statistics interface GigabitEthernet 0/0/1 inbound
display traffic policy statistics interface GigabitEthernet 0/0/2 outbound

 

 

以上就是流量统计的基本配置啦。有问题欢迎留言。

THE END