一、ACL基本配置
1、ACL规则生效时间段配置(需要先配置设备的时间,建议用ntp同步时间)
某些引用ACL的业务或功能需要限制在一定的时间范围内生效,比如,在流量高峰期时启动设备的QoS功能。用户可以为ACL创建生效时间段,通过在规则中引用时间段信息限制ACL生效的时间范围,从而达到该业务或功能在一定的时间范围内生效的目的。
[Huawei]time-range
test ?
Starting time
from
The beginning point of the time range
[Huawei]time-range
test 8:00 ?
to The
ending point of periodic time-range
[Huawei]time-range
test 8:00 t
[Huawei]time-range
test 8:00 to ?
Ending Time
[Huawei]time-range test 8:00 to 18:05 ?
<0-6> Day of the
week(0 is Sunday)
Fri Friday #星期五
Mon Monday #星期一
Sat Saturday #星期六
Sun Sunday #星期天
Thu Thursday #星期四
Tue Tuesday #星期二
Wed Wednesday #星期三
daily Every day of the week #每天
off-day Saturday and Sunday #星期六和星期日
working-day Monday to Friday #工作日每一天
[Huawei]time-range test from 8:00 2016/1/17
to 18:00 2016/11/17
使用同一time-name可以配置多条不同的时间段,以达到这样的效果:各周期时间段之间以及各绝对时间段之间分别取并集之后,再取二者的交集作为最终生效的时间范围。
例如,时间段“test”配置了三个生效时段:
从2016年1月1日00:00起到2016年12月31日23:59生效,这是一个绝对时间段。
在周一到周五每天8:00到18:00生效,这是一个周期时间段。
在周六、周日下午14:00到18:00生效,这是一个周期时间段。
则时间段“test”最终描述的时间范围为:2016年的周一到周五每天8:00到18:00以及周六和周日下午14:00到18:00。
由于网络延迟等原因,可能造成网络上设备时间不同步,建议配置NTP(Network Time Protocol),以保证网络上时间的一致。
2、ACL类型配置
2.1、数字型acl配置
[Huawei]acl
2000 match-order ?
auto
Auto order #自动顺序(默认)
config
Config order
或
[Huawei]acl
number 2000 match-order ?
auto
Auto order
config
Config order
2.2、命名型acl配置
[Huawei]acl
name test ?
advance
Specify an advanced named ACL #设置高级acl
basic
Specify a basic named ACL
match-order
Set ACL's match order
number
Specify a number for the named ACL
[Huawei]acl
name test ad
[Huawei]acl
name test advance ?
match-order
Set ACL's match order
number
Specify a number for the named ACL
[Huawei]acl name test number ?
INTEGER<2000-2999> Number of the basic named ACL
INTEGER<42768-75535> Number
of the advanced named ACL
2.3、ACL类型配置
[Huawei]acl ?
INTEGER<1000-1999>
Interface access-list(add to current using rules) #接口访问列表acl
INTEGER<10000-10999> Apply
MPLS ACL #应用MPLS ACL
INTEGER<2000-2999> Basic
access-list (add to current using rules) #基本acl
INTEGER<3000-3999>
Advanced access-list(add to current using rules) #高级acl
INTEGER<4000-4999> MAC
address access-list(add to current using rules) #二层acl
ipv6 ACL IPv6 #基本acl6和高级acl6配置
name Specify a
named ACL
number Specify a
numbered ACL
2.4、ACL描述设置(可选)
[Huawei-acl-basic-2600]description ?
TEXT
2.5、ACL步长设置(可选)
[Huawei-acl-basic-test]step ?
INTEGER<1-20> Specify value
of step
二、ACL类型规则配置
1、基本ACL规则配置
基本ACL编号acl-number的范围是2000~2999。
基本ACL可以根据报文自身的源IP地址、分片标记和时间段信息对IPv4报文进行分类。
[Huawei-acl-basic-test]rule 1 ?
deny Specify matched packet
deny
permit Specify matched packet
permit
[Huawei-acl-basic-test]rule 1 deny ?
fragment-type Specify the
fragment type of packet #分组片段类型
source Specify source
address
time-range Specify a special
time
vpn-instance Specify a VPN-Instance
[Huawei-acl-basic-test]rule 1 deny source ?
X.X.X.X Address of source
any Any source
[Huawei-acl-basic-test]rule 1 deny source
192.168.1.1 ?
0 Wildcard bits : 0.0.0.0 (
a host )
X.X.X.X Wildcard of source
[Huawei-acl-basic-test]rule 1 deny source
192.168.1.1 0 ?
fragment-type Specify the
fragment type of packet #对分组片段类型有效
time-range Specify a special
time #引用生效时间
vpn-instance Specify a
VPN-Instance #用于vpn
[Huawei-acl-basic-2600]description ? #配置规则描述
TEXT ACL description (no more than 127 characters)
在ACL中配置首条规则时,如果未指定参数rule-id,设备使用步长值作为规则的起始编号。后续配置规则如仍未指定参数rule-id,设备则使用最后一个规则的rule-id的下一个步长的整数倍数值作为规则编号。
例如ACL中包含规则rule 5和rule 7,ACL的步长为5,则系统分配给新配置的未指定rule-id的规则的编号为10。
当用户指定参数time-range引入ACL规则生效时间段时,如果time-name不存在,该规则将无法绑定该生效时间段。
如果不指定参数vpn-instance
vpn-instance-name,设备会对公网和私网的报文均进行匹配。
设备在收到报文时,会按照匹配顺序将报文与ACL规则进行逐条匹配,一旦匹配上规则组内的某条规则,则停止匹配动作。之后,设备将依据匹配的规则对报文执行相应的动作。