Matched: the ACL exists, and there is a rule to which the packet conforms, no matter the rule is permit or deny.
Mismatched: the ACL does not exist, or there is no rule in the ACL, or the packet does not conform to any rules of the ACL.
First, the device checks whether the ACL exists.
A rule is identified by a rule ID, which is configured by a user or generated by the system according to the ACL increment. All rules in an ACL are arranged in ascending order of rule IDs.
If the rule ID is automatically allocated, there is a certain space between two rule IDs. The size of the space depends on the ACL increment. For example, if the ACL increment is set to 5, the difference between two rule IDs are 5, such as 5, 10, 15, and the rest may be deduced by analogy. If the ACL increment is 2, the rule IDs generated automatically by the system start from 2. In this manner, the user can add a rule before the first rule.
In configuration file, the rules are displayed in ascending order of rule IDs, not in the order of configuration.
If the Configuration mode is used, users can set rule IDs or allow a device to automatically allocate rule IDs based on the increment.
If rule IDs are specified when rules are configured, the rules are inserted at places specified by the rule IDs. For example, three rules with IDs 5, 10, and 15 exist on a device. If a new rule with ID 3 is configured, the rules are displayed in ascending order, 3, 5, 10, and 15. This is the same as inserting a rule before ID 5. If users do not set rule IDs, the device automatically allocates rule IDs based on the increment. For example, if the ACL increment is set to 5, the difference or interval between two rule IDs is 5, such as 5, 10, 15, and the rest may be deduced by analogy.
If the ACL increment is set to 2, the device allocates rule IDs starting from 2. The increment allows users to insert new rules, facilitating rule maintenance. For example, the ACL increment is 5 by default. If a user does not configure a rule ID, the system automatically generates a rule ID 5 as the first rule. If the user intends to add a new rule before rule 5, the user only needs to input a rule ID smaller than 5. After the automatic realignment, the new rule becomes the first rule.
In the Configuration mode, the system matches rules in ascending order of rule IDs. As a result, a latter configured rule may be matched earlier.
If the auto mode is used, the system automatically allocates rule IDs, and places the most precise rule in the front of the ACL based on the depth-first principle. This can be implemented by comparing the address wildcard. The smaller the wildcard, the narrower the specified range.
For example, 172.16.1.1 0.0.0.0 specifies a host with the IP address 172.16.1.1, and 172.16.1.1 0.0.0.255 specifies a network segment with the network segment address ranging from 172.16.1.1 to 172.16.1.255. The former specifies a narrower host range and is placed before the latter.
The detailed operations are as follows:
For example, a wide range of packets are specified for packet filtering. Later, it is required that packets matching a specific feature in the range be allowed to pass. If the auto mode is configured in this case, the administrator only needs to define a specific rule and does not need to re-order the rules because a narrower range is allocated a higher precedence in the auto mode.
ACL Type |
Matching Rules |
---|---|
Interface-based ACL |
Rules with any set are matched last, and other rules are matched in the order they are configured. |
Basic ACL |
|
Advanced ACL |
|
Layer 2 ACL |
|
User ACL (UCL) |
|
MPLS-based ACL |
Rules can only be arranged in Configuration mode. |
The performance for mismatched case depends on the ACL application. For detailed information, see Table 2.
Please attention that in Table 2:
Application Module |
Mismatched All Rules |
No Rule In ACL |
|
---|---|---|---|
Telnet |
deny |
permit |
|
SNMP |
deny |
permit |
|
FTP |
deny |
permit |
|
TFTP |
deny |
permit |
|
Traffic Policy |
permit |
permit |
|
CPU Defend Policy |
Whitelist |
permit |
permit |
Blacklist |
permit |
permit |
|
User-defined Flow |
permit |
permit |
|
Routing Protocol |
Route Policy |
deny |
deny |
Filter Policy |
deny |
deny |
|
Multicast Policy |
static-rp group-policy c-rp group-policy |
permit |
permit |
Multicast boundary policy |
deny |
permit |
|
Other multicast policies |
deny |
deny |
|
NAT |
deny |
deny |
|
BFD |
deny |
deny |
|
IPsec |
deny |
IPsec does not support this kind of ACL. |
|
SSH |
deny |
deny |
|
VTY |
deny |
deny |
The following commands are configured one after another:
rule deny ip dscp 30 destination 1.1.0.0 0.0.255.255 rule permit ip dscp 30 destination 1.1.1.0 0.0.0.255
If the config mode is used, the rules in the ACL are displayed as follows:
acl 3000 rule 5 deny ip dscp 30 destination 1.1.0.0 0.0.255.255 rule 10 permit ip dscp 30 destination 1.1.1.0 0.0.0.255
If the auto mode is used, the rules in the ACL are displayed as follows:
acl 3000 rule 5 permit ip dscp 30 destination 1.1.1.0 0.0.0.255 rule 10 deny ip dscp 30 destination 1.1.0.0 0.0.255.255
If the device receives a packet with DSCP value 30 and destination IP address 1.1.1.1, the packet is dropped when the config mode is used, but the packet is allowed to pass when the auto mode is used.