以下脚本仅做参考,具体IP地址和接口请按照现场实际情况写入。
[Huawei]acl 3001
[Huawei-acl-adv-3001]rule permit ip source 192.168.1.10 0.0.0.0 destination 192.168.2.10 0.0.0.0 //匹配需要做测试的源和目标地址
[Huawei-acl-adv-3001]rule permit ip source 192.168.2.10 0.0.0.0 destination 192.168.1.10 0.0.0.0 //将源和目的反过来
[Huawei-acl-adv-3001]q
[Huawei]
[Huawei]traffic classifier c2 //创建流分类
[Huawei-classifier-c2]if-match acl 3001 //在流分类中挂入ACL
[Huawei-classifier-c2]q
[Huawei]
[Huawei]traffic behavior b2 //创建流行为
[Huawei-behavior-b2]statistic enable //在流动作中开启流量统计功能
[Huawei-behavior-b2]q
[Huawei]
[Huawei]traffic policy p2 //创建流策略
[Huawei-trafficpolicy-p2]classifier c2 behavior b2 //将之前创建的流分类和流行为进行捆绑
[Huawei-trafficpolicy-p2]q
[Huawei]
[Huawei]interface g 0/0/10 //进流量的接口
[Huawei-GigabitEthernet0/0/10]traffic-policyp2inbound
[Huawei-GigabitEthernet0/0/10]traffic-policyp2 outbound
[Huawei-GigabitEthernet0/0/10]q
[Huawei]
[Huawei]int g 0/0/20 //出流量的接口
[Huawei-GigabitEthernet0/0/20]traffic-policyp2 inbound
[Huawei-GigabitEthernet0/0/20]traffic-policyp2 outbound
[Huawei-GigabitEthernet0/0/20]q
[Huawei]
写好以上配置后,先清空一次计数信息,以保证接口流统计数归零。
<Huawei>reset traffic policy statistics interface GigabitEthernet 0/0/10 inbound
<Huawei>reset traffic policy statistics interface GigabitEthernet 0/0/10 outbound清空接口计数
<Huawei>reset traffic policy statistics interface GigabitEthernet 0/0/20 inbound
<Huawei>reset traffic policy statistics interface GigabitEthernet 0/0/20 outbound清空接口计数
开始ping或者通信,查看测试结果:
display traffic policy statistics interface GigabitEthernet 0/0/10 inbound
display traffic policy statistics interface GigabitEthernet 0/0/10 outbound
display traffic policy statistics interface GigabitEthernet 0/0/20 inbound
display traffic policy statistics interface GigabitEthernet 0/0/20 outbound
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 华为策略流控
发表评论 取消回复