华为CE6180高级ACL配置

配置思路

1.配置接口IP地址
2.配置ACL
3.配置流分类
4.配置流行为
5.配置流策略
6.在接口上应用流策略

操作步骤

配置接口加入VLAN,并配置VLANIF接口的IP地址
规划10GE1/0/1~10GE1/0/3分别加入VLAN10、20、30,10GE1/0/4加入VLAN100。
VLANIF接口的地址取所在网段的第一个IP地址
<HUAWEI> system-view
[~HUAWEI] sysname Switch
[*HUAWEI] commit
[~Switch] vlan batch 10 20 30 100
[*Switch] interface 10ge 1/0/1
[*Switch-10GE1/0/1] port link-type access
[*Switch-10GE1/0/1] port default vlan 10
[*Switch-10GE1/0/1] commit
[~Switch-10GE1/0/1] quit
[~Switch] interface vlanif 10
[*Switch-Vlanif10] ip address 10.164.1.1 255.255.255.0
[*Switch-Vlanif10] quit

ACL种类

[*CORE-SW]acl number ?

//基本ACL  只根据数据包的源IP地址指定规则 ,定义时间段也属于基本ACL(2000-2999)
  INTEGER<2000-2999>    Basic access-list(add to current using rules)
  INTEGER<23000-23999>  ARP access-list

//高级ACL 可以使用数据包的源IP地址、目的IP地址、IP承载的协议类型(列入TCP/UDP的源端口、目的端口定义规则)
3998与3999是系统我集群管理预留的编号,用户无法使用 (3000-3999)
INTEGER<3000-3999>Advanced access-list(add to current using rules)

 //根据数据包的源MAC地址、目的MAC地址、802.1p优先级、二层协议类型等二层信息制定规则。
用户可以利用高级ACL定义比基本ACL更准确、更丰富、更灵活的规则(4000- 4999)
INTEGER<4000-4999>    Specify a L2 ACL group(add to current using rules)
INTEGER<5000-5999>    User defined access-list

配置ACL

配置VLAN30网段到VLAN50网段的访问规则(permit:允许,deny:拒绝)
[*Switch] acl 3002
[*Switch-acl4-advance-3002] rule 300 deny ip source 172.16.3.0 0.0.0.255 destination 172.16.5.0 0.0.0.255
//自定义ACL访问规则
//rule 1 permit ip source 172.16.3.8 0.0.0.0 destination 172.16.5.11 0.0.0.0
[*Switch-acl4-advance-3002] commit
[~Switch-acl4-advance-3002] quit

ACL匹配顺序

先比较源IP地址范围,源IP地址范围小(反掩码中“0”位的数量多)的规则优先;
系统按照ACL规则编号(rule id)从小到大的顺序进行报文匹配,规则编号越小越容易被匹配。后插入的规则,
如果指定的规则编号更小,那么这条规则可能会被先匹配上。

配置基于ACL的流分类

配置流分类c_market,对匹配ACL 3002的报文进行分类。(c_market: 流分类名称)
[~Switch] traffic classifier c_market
[*Switch-classifier-c_market] if-match acl 3002
[*Switch-classifier-c_market] commit
[~Switch-classifier-c_market] quit

配置流行为

配置流行为b_market,动作为拒绝报文通过(b_market:流行为名称)
[~Switch] traffic behavior b_market
[*Switch-behavior-b_market] deny
[*Switch-behavior-b_market] commit
[~Switch-behavior-b_market] quit

配置流策略

配置流策略p_market,将流分类c_market与流行为b_market关联(p_market:流策略名称)
[~Switch] traffic policy p_market
[*Switch-trafficpolicy-p_market] classifier c_market behavior b_market
[*Switch-trafficpolicy-p_market] commit
[~Switch-trafficpolicy-p_market] quit

应用流策略

将流策略p_market应用到 VLANIF30端口
[~Switch] interface vlanif 30
[~Switch-Vlanif30] traffic-policy p_market inbound
[*Switch-Vlanif30] commit
[~Switch-Vlanif30] quit

删除策略

进入ACL模式,查看策略
rule 1 permit ip source 172.16.3.8 0 destination 172.16.5.11 0
删除: undo rule 1
冷灯看剑,剑上几番功名?炉香无需计苍生,纵一川烟逝,万丈云埋,孤阳还照古陵。
原文地址:https://www.cnblogs.com/longlogs/p/11675077.html