- Table of Contents
- Related Documents
-
Title | Size | Download |
---|---|---|
01-ACL Configuration | 150.74 KB |
Rule comments and rule range remarks
Implementing time-based ACL rules
Configuring an IPv4 advanced ACL
Configuring an IPv6 advanced ACL
Configuring an Ethernet frame header ACL
Copying a WLAN, IPv4 basic, IPv4 advanced, or Ethernet frame header ACL
Copying an IPv6 basic or IPv6 advanced ACL
Displaying and maintaining ACLs
IPv4 ACL configuration example
IPv6 ACL configuration example
An access control list (ACL) is a set of rules (or permit or deny statements) for identifying traffic based on criteria such as source IP address, destination IP address, and port number.
Overview
You can use ACLs in QoS, security, routing, and other feature modules for identifying traffic. The packet drop or forwarding decisions vary with the modules that use ACLs.
ACL categories
Category |
ACL number |
IP version |
Match criteria |
WLAN ACLs |
100 to 199 |
IPv4 |
WLAN's SSID |
Basic ACLs |
2000 to 2999 |
IPv4 |
Source IPv4 address |
IPv6 |
Source IPv6 address |
||
Advanced ACLs |
3000 to 3999 |
IPv4 |
Source IPv4 address, destination IPv4 address, packet priority, protocols over IPv4, and other Layer 3 and Layer 4 header fields |
IPv6 |
Source IPv6 address, destination IPv6 address, packet priority, protocols over IPv6, and other Layer 3 and Layer 4 header fields |
||
Ethernet frame header ACLs |
4000 to 4999 |
IPv4 and IPv6 |
Layer 2 header fields, such as source and destination MAC addresses, 802.1p priority, and link layer protocol type |
Numbering and naming ACLs
Each ACL category has a unique range of ACL numbers. When creating an ACL, you must assign it a number. In addition, you can assign the ACL a name for ease of identification. After creating an ACL with a name, you cannot rename it or delete its name.
You cannot assign a name to a WLAN ACL.
For an IPv4 basic or advanced ACLs, its ACL number and name must be unique in IPv4, and for an IPv6 basic or advanced ACL, its ACL number and name must be unique in IPv6.
Match order
The rules in an ACL are sorted in a specific order. When a packet matches a rule, the device stops the match process and performs the action defined in the rule. If an ACL contains overlapping or conflicting rules, the matching result and action to take depend on the rule order.
The following ACL match orders are available:
· config—Sorts ACL rules in ascending order of rule ID. A rule with a lower ID is matched before a rule with a higher ID. If you use this approach, carefully check the rules and their order.
· auto—Sorts ACL rules in depth-first order. Depth-first ordering makes sure any subset of a rule is always matched before the rule. Table 1 lists the sequence of tie breakers that depth-first ordering uses to sort rules for each type of ACL.
The match order of WLAN ACLs can only be config.
Table 1 Sorting ACL rules in depth-first order
ACL category |
Sequence of tie breakers |
IPv4 basic ACL |
1. More 0s in the source IP address wildcard (more 0s means a narrower IP address range) 2. Rule configured earlier |
IPv4 advanced ACL |
1. Specific protocol type rather than IP (IP represents any protocol over IP) 2. More 0s in the source IP address wildcard mask 3. More 0s in the destination IP address wildcard 4. Narrower TCP/UDP service port number range 5. Rule configured earlier |
IPv6 basic ACL |
1. Longer prefix for the source IP address (a longer prefix means a narrower IP address range) 2. Rule configured earlier |
IPv6 advanced ACL |
1. Specific protocol type rather than IP (IP represents any protocol over IPv6) 2. Longer prefix for the source IPv6 address 3. Longer prefix for the destination IPv6 address 4. Narrower TCP/UDP service port number range 5. Rule configured earlier |
Ethernet frame header ACL |
1. More 1s in the source MAC address mask (more 1s means a smaller MAC address) 2. More 1s in the destination MAC address mask 3. Rule configured earlier |
A wildcard mask, also called an inverse mask, is a 32-bit binary and represented in dotted decimal notation. In contrast to a network mask, the 0 bits in a wildcard mask represent "do care" bits, and the 1 bits represent "don't care" bits. If the "do care" bits in an IP address are identical to the "do care" bits in an IP address criterion, the IP address matches the criterion. All "don't care" bits are ignored. The 0s and 1s in a wildcard mask can be noncontiguous. For example, 0.255.0.255 is a valid wildcard mask.
Rule comments and rule range remarks
Add a comment about an ACL rule to make it easy to understand. The rule comment appears below the rule statement.
In addition, add a rule range remark to indicate the start or end of a range of rules created for the same purpose.
Rule numbering
ACL rules can be manually numbered or automatically numbered. This section describes how automatic ACL rule numbering works.
Rule numbering step
If you do not assign an ID to the rule you are creating, the system automatically assigns it a rule ID. The rule numbering step sets the increment by which the system automatically numbers rules. For example, the default ACL rule numbering step is 5. If you do not assign IDs to rules you are creating, they are automatically numbered 0, 5, 10, 15, and so on. The wider the numbering step, the more rules you can insert between two rules.
By introducing a gap between rules rather than contiguously numbering rules, you have the flexibility of inserting rules in an ACL. This feature is important for a config order ACL, where ACL rules are matched in ascending order of rule ID.
Automatic rule numbering and renumbering
The ID automatically assigned to an ACL rule takes the nearest higher multiple of the numbering step to the current highest rule ID, starting with 0.
For example, if the numbering step is 5 (the default), and there are five ACL rules numbered 0, 5, 9, 10, and 12, the newly defined rule is numbered 15. If the ACL does not contain any rule, the first rule is numbered 0.
Whenever the step changes, the rules are renumbered, starting from 0. For example, if there are five rules numbered 5, 10, 13, 15, and 20, changing the step from 5 to 2 causes the rules to be renumbered 0, 2, 4, 6, and 8.
Implementing time-based ACL rules
You can implement ACL rules based on the time of day by applying a time range to them. A time-based ACL rule only takes effect in any time periods specified by the time range.
The following basic types of time range are available:
· Periodic time range—Recurs periodically on a day or days of the week.
· Absolute time range—Represents only a period of time and does not recur.
You can specify a time range in ACL rules before or after you create it. However, the rules using the time range take effect only after you define the time range.
Fragments filtering with ACLs
Traditional packet filtering matches only first fragments of packets, and allows all subsequent non-first fragments to pass through. Attackers can fabricate non-first fragments to attack networks.
To avoid the risks, the H3C ACL implementation does the following:
· Filters all fragments by default, including non-first fragments.
· Allows for matching criteria modification, for example, filters non-first fragments only.
Configuration task list
Task |
Remarks |
Optional. Applicable to IPv4 and IPv6. |
|
Required. Configure at least one task. Applicable to IPv4 and IPv6. |
|
Optional. Applicable to IPv4 and IPv6. |
Configuring a time range
You can create a maximum of 256 time ranges, each having a maximum of 32 periodic statements and 12 absolute statements. If a time range has multiple statements, its active period is calculated as follows:
1. Combining all periodic statements.
2. Combining all absolute statements.
3. Taking the intersection of the two statement sets as the active period of the time range.
To configure a time range:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Configure a time range. |
time-range time-range-name { start-time to end-time days [ from time1 date1 ] [ to time2 date2 ] | from time1 date1 [ to time2 date2 ] | to time2 date2 } |
By default, no time range exists. Repeat this command with the same time range name to create multiple statements for a time range. |
Configuring a WLAN ACL
WLAN ACLs match packets from WLAN clients based on SSIDs of WLANs.
To configure a WLAN ACL:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Create a WLAN ACL and enter its view. |
acl number acl-number |
By default, no ACL exists. WLAN ACLs are numbered in the range of 100 to 199. |
3. Configure a description for the WLAN ACL. |
description text |
Optional. By default, a WLAN ACL has no ACL description. |
4. Set the rule numbering step. |
step step-value |
Optional. The default setting is 5. |
5. Create or edit a rule. |
rule [ rule-id ] { deny | permit } [ ssid ssid-name ] |
By default, a WLAN ACL does not contain any rule. |
6. Add or edit a rule comment. |
rule rule-id comment text |
Optional. By default, no rule comments are configured. |
7. Add or edit a rule range remark. |
rule [ rule-id ] remark text |
Optional. By default, no rule range remarks are configured. |
Configuring a basic ACL
Configuring an IPv4 basic ACL
IPv4 basic ACLs match packets based only on source IP addresses.
To configure an IPv4 basic ACL:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Create an IPv4 basic ACL and enter its view. |
acl number acl-number [ name acl-name ] [ match-order { auto | config } ] |
By default, no ACL exists. IPv4 basic ACLs are numbered in the range of 2000 to 2999. You can use the acl name acl-name command to enter the view of a named ACL. |
3. Configure a description for the IPv4 basic ACL. |
description text |
Optional. By default, an IPv4 basic ACL has no ACL description. |
4. Set the rule numbering step. |
step step-value |
Optional. The default setting is 5. |
5. Create or edit a rule. |
rule [ rule-id ] { deny | permit } [ counting | fragment | logging | source { source-address source-wildcard | any } | time-range time-range-name ] * |
By default, an IPv4 basic ACL does not contain any rule. The logging keyword takes effect only when the module that uses the ACL supports logging. |
6. Add or edit a rule comment. |
rule rule-id comment text |
Optional. By default, no rule comments are configured. |
7. Add or edit a rule range remark. |
rule [ rule-id ] remark text |
Optional. By default, no rule range remarks are configured. |
Configuring an IPv6 basic ACL
IPv6 basic ACLs match packets based only on source IP addresses.
To configure an IPv6 basic ACL:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Create an IPv6 basic ACL view and enter its view. |
acl ipv6 number acl6-number [ name acl6-name ] [ match-order { auto | config } ] |
By default, no ACL exists. IPv6 basic ACLs are numbered in the range of 2000 to 2999. You can use the acl ipv6 name acl6-name command to enter the view of a named ACL. |
3. Configure a description for the IPv6 basic ACL. |
description text |
Optional. By default, an IPv6 basic ACL has no ACL description. |
4. Set the rule numbering step. |
step step-value |
Optional. The default setting is 5. |
5. Create or edit a rule. |
rule [ rule-id ] { deny | permit } [ counting | fragment | logging | routing [ type routing-type ] | source { source-address source-prefix | source-address/source-prefix | any } | time-range time-range-name ] * |
By default, an IPv6 basic ACL does not contain any rule. The logging keyword takes effect only when the module using the ACL supports logging. |
6. Add or edit a rule comment. |
rule rule-id comment text |
Optional. By default, no rule comments are configured. |
7. Add or edit a rule range remark. |
rule [ rule-id ] remark text |
Optional. By default, no rule range remarks are configured. |
Configuring an advanced ACL
Configuring an IPv4 advanced ACL
IPv4 advanced ACLs match packets based on source IP addresses, destination IP addresses, packet priorities, protocols over IP, and other protocol header information, such as TCP/UDP source and destination port numbers, TCP flags, ICMP message types, and ICMP message codes.
Compared to IPv4 basic ACLs, IPv4 advanced ACLs allow more flexible and accurate filtering.
To configure an IPv4 advanced ACL:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Create an IPv4 advanced ACL and enter its view. |
acl number acl-number [ name acl-name ] [ match-order { auto | config } ] |
By default, no ACL exists. IPv4 advanced ACLs are numbered in the range of 3000 to 3999. You can use the acl name acl-name command to enter the view of a named ACL. |
3. Configure a description for the IPv4 advanced ACL. |
description text |
Optional. By default, an IPv4 advanced ACL has no ACL description. |
4. Set the rule numbering step. |
step step-value |
Optional. The default setting is 5. |
5. Create or edit a rule. |
rule [ rule-id ] { deny | permit } protocol [ { { ack ack-value | fin fin-value | psh psh-value | rst rst-value | syn syn-value | urg urg-value } * | established } | counting | destination { dest-address dest-wildcard | any } | destination-port operator port1 [ port2 ] | dscp dscp | fragment | icmp-type { icmp-type [ icmp-code ] | icmp-message } | logging | precedence precedence | reflective | source { source-address source-wildcard | any } | source-port operator port1 [ port2 ] | time-range time-range-name | tos tos ] * |
By default, an IPv4 advanced ACL does not contain any rule. The logging keyword takes effect only when the module using the ACL supports logging. |
6. Add or edit a rule comment. |
rule rule-id comment text |
Optional. By default, no rule comments are configured. |
7. Add or edit a rule range remark. |
rule [ rule-id ] remark text |
Optional. By default, no rule range remarks are configured. |
Configuring an IPv6 advanced ACL
IPv6 advanced ACLs match packets based on the source IPv6 addresses, destination IPv6 addresses, packet priorities, protocols carried over IPv6, and other protocol header fields such as the TCP/UDP source port number, TCP/UDP destination port number, ICMPv6 message type, and ICMPv6 message code.
Compared to IPv6 basic ACLs, IPv6 advanced ACLs allow more flexible and accurate filtering.
To configure an IPv6 advanced ACL:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Create an IPv6 advanced ACL and enter its view. |
acl ipv6 number acl6-number [ name acl6-name ] [ match-order { auto | config } ] |
By default, no ACL exists. IPv6 advanced ACLs are numbered in the range of 3000 to 3999. You can use the acl ipv6 name acl6-name command to enter the view of a named ACL. |
3. Configure a description for the IPv6 advanced ACL. |
description text |
Optional. By default, an IPv6 advanced ACL has no ACL description. |
4. Set the rule numbering step. |
step step-value |
Optional. The default setting is 5. |
5. Create or edit a rule. |
rule [ rule-id ] { deny | permit } protocol [ { { ack ack-value | fin fin-value | psh psh-value | rst rst-value | syn syn-value | urg urg-value } * | established } | counting | destination { dest-address dest-prefix | dest-address/dest-prefix | any } | destination-port operator port1 [ port2 ] | dscp dscp | flow-label flow-label-value | fragment | icmp6-type { icmp6-type icmp6-code | icmp6-message } | logging | routing [ type routing-type ] | source { source-address source-prefix | source-address/source-prefix | any } | source-port operator port1 [ port2 ] | time-range time-range-name ] * |
By default IPv6 advanced ACL does not contain any rule. The logging keyword takes effect only when the module using the ACL supports logging. |
6. Add or edit a rule comment. |
rule rule-id comment text |
Optional. By default, no rule comments are configured. |
7. Add or edit a rule range remark. |
rule [ rule-id ] remark text |
Optional. By default, no rule range remarks are configured. |
Configuring an Ethernet frame header ACL
Ethernet frame header ACLs, also called "Layer 2 ACLs," match packets based on Layer 2 protocol header fields, such as source MAC address, destination MAC address, 802.1p priority (VLAN priority), and link layer protocol type.
To configure an Ethernet frame header ACL:
Step |
Command |
Remarks |
1. Enter system view. |
system-view |
N/A |
2. Create an Ethernet frame header ACL and enter its view. |
acl number acl-number [ name acl-name ] [ match-order { auto | config } ] |
By default, no ACL exists. Ethernet frame header ACLs are numbered in the range of 4000 to 4999. You can use the acl name acl-name command to enter the view of a named Ethernet frame header ACL. |
3. Configure a description for the Ethernet frame header ACL. |
description text |
Optional. By default, an Ethernet frame header ACL has no ACL description. |
4. Set the rule numbering step. |
step step-value |
Optional. The default setting is 5. |
5. Create or edit a rule. |
rule [ rule-id ] { deny | permit } [ cos vlan-pri | counting | dest-mac dest-address dest-mask | { lsap lsap-type lsap-type-mask | type protocol-type protocol-type-mask } | source-mac source-address source-mask | time-range time-range-name ] * |
By default, an Ethernet frame header ACL does not contain any rule. |
6. Add or edit a rule comment. |
rule rule-id comment text |
Optional. By default, no rule comments are configured. |
7. Add or edit a rule range remark. |
rule [ rule-id ] remark text |
Optional. By default, no rule range remarks are configured. |
Copying an ACL
You can create an ACL by copying an existing ACL (source ACL). The new ACL (destination ACL) has the same properties and content as the source ACL, but not the same ACL number and name.
To successfully copy an ACL, make sure:
· The destination ACL number is from the same category as the source ACL number.
· The source ACL already exists, but the destination ACL does not.
Copying a WLAN, IPv4 basic, IPv4 advanced, or Ethernet frame header ACL
Step |
Command |
1. Enter system view. |
system-view |
2. Copy an existing WLAN, IPv4 basic, IPv4 advanced, or Ethernet frame header ACL to create a new ACL. |
acl copy { source-acl-number | name source-acl-name } to { dest-acl-number | name dest-acl-name } |
Copying an IPv6 basic or IPv6 advanced ACL
Step |
Command |
1. Enter system view. |
system-view |
2. Copy an existing IPv6 basic or IPv6 advanced ACL to create a new ACL. |
acl ipv6 copy { source-acl6-number | name source-acl6-name } to { dest-acl6-number | name dest-acl6-name } |
Displaying and maintaining ACLs
Task |
Command |
Remarks |
Display configuration and match statistics for WLAN, IPv4 basic, IPv4 advanced, and Ethernet frame header ACLs. |
display acl { acl-number | all | name acl-name } [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display configuration and match statistics for IPv6 basic and IPv6 advanced ACLs. |
display acl ipv6 { acl6-number | all | name acl6-name } [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Display the configuration and status of one or all time ranges. |
display time-range { time-range-name | all } [ | { begin | exclude | include } regular-expression ] |
Available in any view. |
Clear statistics for one or all WLAN, IPv4 basic, IPv4 advanced, and Ethernet frame header ACLs. |
reset acl counter { acl-number | all | name acl-name } |
Available in user view. |
Clear statistics for one or all IPv6 basic and advanced ACLs. |
reset acl ipv6 counter { acl6-number | all | name acl6-name } |
Available in user view. |
ACL configuration examples
IPv4 ACL configuration example
Network requirements
A company interconnects its departments through AP. Configure an ACL to:
· Permit access from the President's office at any time to the salary server.
· Deny access from any other department to the salary server during working hours (from 8:00 to 18:00) on working days.
Figure 1 Network diagram
Configuration procedure
# Create a periodic time range from 8:00 to 18:00 on working days.
<AP> system-view
[AP] time-range trname 8:00 to 18:00 working-day
# Create an IPv4 advanced ACL numbered 3000.
[AP] acl number 3000
# Configure a rule in the ACL to permits access from the President's office to the salary server.
[AP-acl-adv-3000] rule 1 permit ip source 129.111.1.2 0.0.0.0 destination 129.110.1.2 0.0.0.0
[AP-acl-adv-3000] quit
# Create an IPv4 advanced ACL numbered 3001.
[AP] acl number 3001
# Configure a rule to deny access from any other department to the salary server.
[AP-acl-adv-3001] rule 1 permit ip source any destination 129.110.1.2 0.0.0.0 time-range trname
[AP-acl-adv-3001] quit
# Apply IPv4 ACL 3000 and ACL 3001.
[AP] traffic classifier access1
[AP-classifier-access1] if-match acl 3000
[AP-classifier-access1] quit
[AP] traffic behavior access1
[AP-behavior-access1] filter permit
[AP-behavior-access1] quit
[AP] traffic classifier access2
[AP-classifier-access2] if-match acl 3001
[AP-classifier-access2] quit
[AP] traffic behavior access2
[AP-behavior-access2] filter deny
[AP-behavior-access2] quit
[AP] qos policy access
[AP-qospolicy-access] classifier access1 behavior access1
[AP-qospolicy-access] classifier access2 behavior access2
[AP-qospolicy-access] quit
[AP] interface wlan-bss1
[AP-WLAN-BSS1] qos apply policy access inbound
IPv6 ACL configuration example
Network requirements
Filter incoming packets on interface WLAN-BSS 1 to deny all IPv6 packets but those with source addresses in the range of 4050::9000 to 4050::90FF.
Configuration procedure
# Create a basic IPv6 ACL numbered 2000, and enter its view.
<AP> system-view
[AP] acl ipv6 number 2000
# Create a rule to allow packets from IPv6 address 4050::9000 to 4050::90FF.
[AP-acl6-basic-2000] rule 1 permit source 4050::9000/120
[AP-acl6-basic-2000] quit
# Create a basic IPv6 ACL numbered 2001, and enter its view.
[AP] acl ipv6 number 2001
# Configure a rule to deny access from other IPv6 addresses.
[AP-acl6-basic-2001] rule 1 deny source any
[AP-acl6-basic-2001] quit
# Apply ACL 2000 and ACL 2001.
[AP] traffic classifier access1
[AP-classifier-access1] if-match acl ipv6 2000
[AP-classifier-access1] quit
[AP] traffic behavior access1
[AP-behavior-access1] filter permit
[AP-behavior-access1] quit
[AP] traffic classifier access2
[AP-classifier-access2] if-match acl ipv6 2001
[AP-classifier-access2] quit
[AP] traffic behavior access2
[AP-behavior-access2] filter deny
[AP-behavior-access2] quit
[AP] qos policy access
[AP-qospolicy-access] classifier access1 behavior access1
[AP-qospolicy-access] classifier access2 behavior access2
[AP-qospolicy-access] quit
[AP] interface wlan-bss1
[AP-WLAN-BSS1] qos apply policy access inbound
[AP-WLAN-BSS1] quit