An ACL is a set of sequential packet filtering rules. After an ACL is configured on a router, the router permits or denies packets based on the matched rules defined in the ACL. ACLs can be applied to various services, such as routing policies, traffic management, and QoS.
As the name indicates, an Access Control List (ACL) is a list. The list contains matching clauses, which are actually matching rules and used to tell the device to perform action on the packet or not.
An ACL is a set of rules. It identifies a type of packet but does not filter packets. Other ACL-associated functions are used to filter identified packets.
ACL Type |
Function |
ACL Number |
---|---|---|
Interface-based ACL |
Defines rules based on packets' inbound interfaces. |
1000 to 1999 |
Basic ACL |
Defines rules based on packets' source addresses. |
2000 to 2999 |
Advanced ACL |
Rules in an advanced ACL are defined based on packets' source or destination addresses, source or destination port numbers, and protocol types. |
3000 to 3999 |
Layer 2 ACL |
Defines rules based on the Layer 2 information, such as the source MAC address, destination MAC address, or protocol type of Ethernet frames. |
4000 to 4999 |
User ACL (UCL) |
Defines rules based on the source/destination IP address, source/destination service group, source/destination user group, source/destination port number, and protocol type. |
6000 to 9999 |
MPLS-based ACL |
Defines rules based on MPLS packets' EXP values, labels, or TTL values. |
10000 to 10999 |
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. |