本文主要是介绍华为策略流控,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
以下脚本仅做参考,具体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
这篇关于华为策略流控的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!