01-02 ACL Configuration
01-02 ACL Configuration
Ethernet Switches
Configuration Guide - Security 2 ACL Configuration
2 ACL Configuration
Definition
Access Control Lists (ACLs) filter packets based on an ordered set of rules that
define the packet filtering conditions, such as the source address, destination
address, and port number of packets.
An ACL is a packet filter, while ACL rules are the filter elements. When receiving a
packet, a device checks the packet against ACL rules. If a match is found, the
device forwards or discards the packet according to the policy used by a service
module where the ACL is applied.
ACLs take effect only after they are applied to specific service modules, such as
Telnet, FTP, and routing. A simple use case is to apply an ACL to a traffic policy or
simplified traffic policy. This enables the device to deliver ACL rules globally, in a
VLAN, or on an interface to filter packets to be forwarded. The service modules
use different actions and mechanisms to process the packets matching ACLs. For
details, see 2.2.7 Default ACL Actions and Mechanisms of Different Service
Modules.
Purpose
ACLs accurately identify and control packets on a network to manage network
access behaviors, prevent network attacks, and improve bandwidth use efficiency.
In this way, ACLs ensure security and high service quality on networks.
For financial data security, an enterprise requires that the finance server be
accessible to the president office but block access from users in the R&D
department. To achieve this, on Interface 1 of the switch, apply an ACL on the
inbound direction so that the packets from the R&D department to the finance
server are denied on the interface. On Interface 2, apply no ACL so that the
interface can successfully forward the packets destined the finance server.
Additionally, to protect the enterprise intranet against viruses from the Internet,
apply an ACL on the inbound direction of Interface 3 on the switch.
Related Information
Support Community
● ACL Application
● Basic Knowledge About ACL
● ACL Matching
ACL Structure
Figure 2-2 shows the structure of an ACL.
ACL rule IDs range from 0 to 4294967294. Packets are matched against
ACL rules in ascending order of the rule ID. The device stops matching a
packet as long as a match is found.
– Action: indicates how packets are processed, including permit and deny.
– Matching condition: indicates criteria that packet must meet to match a
rule. ACLs support a diverse array of matching conditions. In addition to
the source IP address and time range in Figure 2-2, other matching
conditions include Layer 2 Ethernet frame header information (source
MAC, destination MAC, and Ethernet protocol type), Layer 3 packet
information (destination IP address and protocol type), and Layer 4
packet information (TCP or UDP port number). For details about ACL
matching conditions, see 2.2.2 ACLs Supported by Switches and
Common Matching Conditions.
ACL Implementation
ACLs can be implemented in hardware or software.
● Software-based ACL: filters the interactive protocol packets destined for the
local device, which must be sent to the CPU, for example, FTP, TFTP, Telnet,
SNMP, HTTP, routing, and multicast protocol packets.
● Hardware-based ACL: filters all packets by delivering ACL resources. Such
ACLs include the ACL referenced by a traffic policy or simplified traffic policy,
user group ACL, and ACL for adding outer VLAN tags to the packets received
on interfaces.
ICMP 1
TCP 6
UDP 17
GRE 47
IGMP 2
IPinIP 4
OSPF 89
The value ip indicates any IP layer protocol. The protocol number ranges from
1 to 255.
For example, to forbid user access on an interface susceptible to attacks, you
can specify the protocol type as IP to discard all IP traffic on the interface.
rule deny ip //Reject IP packets.
In this rule, the wildcard mask 0.0.0.255 indicates that only the bits of the
binary bytes in the first three groups of an IP address are checked. Packets are
permitted only if the first 24 bits in the source IP address are the same as the
first 24 bits in the specified IP address, which are 192.168.1 in this example.
That is, only the packets sent from the IP address segment 192.168.1.0/24 are
permitted. Table 2-3 illustrates how the wild mask is used to determine an
address range.
Table 2-5 illustrates how a MAC address and a wildcard mask determine an
address range.
Table 2-5 Determining address ranges by MAC addresses and wildcard masks
To prevent fragment packet attacks, you can specify the keyword fragment in
an ACL rule to block non-initial fragments.
Table 2-7 describes how ACLs process non-fragment packets, initial
fragments, and non-initial fragments.
Matching Mechanism
A device stops matching packets against ACL rules as long as a match is found, as
detailed in Figure 2-3.
According to the preceding matching process, after packets are filtered by ACL
rules, the following two results may be generated:
● The packets match a rule in an ACL.
● No ACL exists, the ACL contains no rule, or packets do not match any rule in
an ACL.
Whether packets are permitted or denied is determined by actions specified in ACL
rules and service modules that have ACLs applied. Different service modules
process the packets that are filtered by ACL rules in different ways. For example,
the Telnet module directly forwards the packets matching a permit rule, whereas
the traffic policy module discards the packets matching a permit rule if the
configured behavior in the traffic policy is deny. For details about ACL processing
on each service module, see 2.2.7 Default ACL Actions and Mechanisms of
Different Service Modules.
Matching Order
An ACL consists of multiple rules, which may overlap or conflict. For example, an
ACL contains two rules:
rule deny ip destination 10.1.0.0 0.0.255.255 //Packets destined for an IP address on the network segment
10.1.0.0/16 are denied.
rule permit ip destination 10.1.1.0 0.0.0.255 //Packets destined for an IP address on the network segment
10.1.1.0/24 are permitted, which is smaller than the network segment 10.1.0.0/16.
If the system first matches a packet destined for the IP address 10.1.1.1 against
the deny rule, the packet is discarded. However, if the system matches the packet
against the permit rule first, the packet is forwarded.
Therefore, if ACL rules overlap or conflict, the matching order decides the
matching result.
The device can match packets against ACLs in configuration (config) or automatic
order (auto). The default order is config.
Config order
The system matches packets against ACL rules in ascending order of rule IDs. That
is, the rule with the smallest ID takes effect first.
● If a smaller rule ID is manually specified for a rule, the rule takes effect earlier
than those with larger ruler IDs.
● If no ID is manually specified for a rule, the system allocates an ID to the rule.
This rule ID is the largest in the ACL and has the minimum multiple of the
increment. Therefore, this rule is the last one that functions.
Auto order
The system arranges ACL rules based on their precision degree (depth first
principle), and checks packets against the rules in descending order of precision. A
rule with the highest precision defines strictest conditions, and has the highest
priority. Table 2-8 describes how the auto order is applied to each type of ACL.
User ACL 1. Protocol type. IP-based protocols make a rule prior to other rules.
and User 2. Source IP address range. If all source IP addresses are IP network
ACL6 segments, the rule with a smaller source IP address range (with
more 0 bits in wildcard mask) is prioritized. If not all the source
IP addresses are IP network segments, the rule in which the
source IP address range is an IP network segment takes
precedence over that in which the source IP address is a UCL
group.
3. Destination IP address range. If all destination IP addresses are IP
network segments, the rule with a smaller destination IP address
range (with more 0 bits in wildcard mask) is prioritized. If not all
the destination IP addresses are IP network segments, the rule in
which the destination IP address range is an IP network segment
takes precedence over that in which the destination IP address
range is a UCL group.
4. Layer 4 port number (TCP/UDP) range. A smaller Layer 4 port
number indicates a higher rule priority.
5. Rule ID. A smaller rule ID indicates a higher rule priority.
For details about the ACL matching conditions mentioned in Table 2-8, see 2.2.2
ACLs Supported by Switches and Common Matching Conditions.
If you add a rule to an ACL in auto matching mode, the system automatically
identifies the rule priority and assigns a rule ID accordingly.
For example, two rules are added to advanced ACL 3001 in auto mode:
rule deny ip destination 10.1.0.0 0.0.255.255 //Reject the packets destined for network segment 10.1.0.0/16.
rule permit ip destination 10.1.1.0 0.0.0.255 //Permit the packets destined for network segment
10.1.1.0/24, which has a smaller range than 10.1.0.0/16.
The two rules specify the identical protocol range and source IP address range but
do not specify VPN instances. According to the auto matching order in Table 2-8,
the system compares the destination IP address ranges in the rules. The
destination IP address range specified in the permit rule is smaller than that
specified in the deny rule, so the permit rule has a higher precision. The system
then allocates a smaller ID to the permit rule. Therefore, the system enables the
two rules in ACL 3001 to function in the following order:
#
acl number 3001 match-order auto
rule 5 permit ip destination 10.1.1.0 0.0.0.255
rule 10 deny ip destination 10.1.0.0 0.0.255.255
#
A rule rule deny ip destination 10.1.1.1 0 is added to ACL 3001. (This rule has a
higher priority than the previous two rules because the destination IP address is a
host address.) The system reassigns IDs to the rules according to the rule
priorities. The new order is as follows:
#
acl number 3001 match-order auto
rule 5 deny ip destination 10.1.1.1 0
Compared with the config mode, the auto mode is more complex. However, the
auto mode is advantageous in some scenarios. For example, to ensure network
security, the administrator has configured an ACL in auto mode to discard all IP
packets on untrusted network segments. When more services are deployed on the
network, some IP packets on these network segments need to be allowed. The
auto matching mode allows the administrator to directly add new rules to the
ACL, without the need to rearrange the rules.
Background
Time ranges define when the permit or deny rules in an ACL are in effect, for
example, during a specified period of time or on specified days of the week. This
allows network administrators to configure different policies during different time
ranges for network optimization.
If time range 3 is modified as from 2014-1-1 19:00 to 2014-12-31 21:00, the time
range test is ineffective.
What Is an Increment
An increment is automatically allocated by the system to determine difference in
to neighboring rule IDs.
Basic ACL6s and advanced ACL6s do not allow for the increment configuration,
and use the fixed increment of 5.
For example, an ACL contains rule 5, rule 10, and rule 15, with an increment of 5.
rule 5 deny source 10.1.1.1 0 //Reject the packets from source IP address 10.1.1.1.
rule 10 deny source 10.1.1.2 0 //Reject the packets from source IP address 10.1.1.2.
rule 15 permit source 10.1.1.0 0.0.0.255 //Reject the packets from source IP address segment 10.1.1.0/24.
It is required that a rule that packets from the source IP address 10.1.1.3 be
denied. The system stops matching packets once a match is found. Therefore, you
need to define a new rule before rule 15 that will deny packets from the source IP
address 10.1.1.3. In this way, rule 15 with a larger range will not filter these
packets. The increment of 5 allows you to easily insert the new rule. However, if
the increment is set to 1 (that is, rules are automatically arranged as rule 1, 2,
3...), you may have to first delete existing rules, define a new one, and then re-
configure the deleted ones, which brings a heavy workload.
rule 5 deny source 10.1.1.1 0 //Reject the packets from source IP address 10.1.1.1.
rule 10 deny source 10.1.1.2 0 //Reject the packets from source IP address 10.1.1.2.
rule 11 deny source 10.1.1.3 0 //Reject the packets from source IP address 10.1.1.3.
rule 15 permit source 10.1.1.0 0.0.0.255 //Reject the packets from source IP address segment 10.1.1.0.
1. The rules in an ACL may overlap. If packets match the rules with loose
conditions, the subsequent other ACL rules do not take effect. In this case,
packets may fail to be checked against the rules with strict conditions.
Therefore, the rules with strict conditions must be arranged in front lines and
those with loose conditions must be arranged towards the end.
2. The ACL configuration guidelines vary according to the default ACL actions
taken by the service modules (for details, see 2.2.7 Default ACL Actions and
Mechanisms of Different Service Modules). For example, if a service module
with the default action of permit must deny the packets from some IP
addresses, you can configure deny rules only for these IP addresses, and a
permit rule for any IP address is not required as the last rule. The converse is
true for a service module whose default action is deny. Table 2-9 describes
the ACL configuration guidelines.
NOTE
The following rules are for reference only. The command line syntax shall prevail when you
configure ACL rules.
rule permit/deny a/rule permit/deny b: permits or denies the specified packets based on
the conditions a and b. The parameter b indicates a larger range than the parameter a,
that is, b includes a.
– Example 5: Apply an ACL to FTP to prevent users from accessing the FTP
server from 00:00-08:00 every Saturday.
The default ACL action of the FTP module is deny, and a few packets are
denied and most packets are permitted. Therefore, you need to configure
rule deny a first, and then rule permit b.
#
time-range t1 00:00 to 08:00 Sat
time-range t2 00:00 to 23:59 daily
#
acl number 2000
rule 5 deny time-range t1
rule 10 permit time-range t2
#
Login control The device controls access Telnet, STelnet, FTP, SFTP,
permission of users. Only HTTP, SNMP
authorized users can log in to
the device, and other users
cannot log in without
permission. This ensures
network security.
For example, only the
administrator is allowed to log
in to the device. You can apply
an ACL to the Telnet service
and specify the hosts that can
log in to the device or the hosts
that cannot log in.
Route filtering ACLs can be applied to various BGP, IS-IS, OSPF, OSPFv3, RIP,
dynamic routing protocols to RIPng, multicast protocol
filter advertised and received
routes and multicast groups.
For example, you can apply an
ACL to a routing policy to filter
routing information and
prevent the device from
sending routes of a network
segment to the neighboring
router.
Table 2-11 Default ACL actions and mechanisms of different service modules
Default Telnet STelnet HTTP FTP TFTP
ACL
Actions
and
Mechanis
ms
Packets deny (login deny (login deny (login deny (login deny (login
Match the not not not not not
deny Rule allowed) allowed) allowed) allowed) allowed)
Packets Do deny (login deny (login deny (login deny (login deny (login
Not Match not not not not not
Any Rule in allowed) allowed) allowed) allowed) allowed)
an ACL
Table 2-12 Default ACL actions and mechanisms of different service modules
Default SFTP SNMP Traffic Simplified Local
ACL Policy Traffic Attack
Actions Policy Defense
and Policy
Mechanis (Blacklist)
ms
Table 2-13 Default ACL actions and mechanisms of different service modules
Default ACL Route Policy Filter Policy igmp- igmp-
Actions and snooping snooping
Mechanisms ssm-policy group-policy
ACL Is Not deny (routing permit (route deny (not deny (not
Created policy does advertisement added to SSM added to
not take or reception is group address multicast
effect) allowed) range, and group)
only the
temporary
group
addresses
232.0.0.0-232.
255.255.255
are in the
SSM group
address
range)
Licensing Requirements
ACL is a basic feature of a switch and is not under license control.
NOTE
For details about software mappings, visit Hardware Query Tool and search for the desired
product model.
Feature Limitations
Only the following products and versions support the user ACLs:
● S5720-HI, S5720-EI, S6720-EI, S6720S-EI, S5720I-SI, S5730-HI, S5731-H,
S5731S-H, S5731-S, S5731S-S, S6720-HI, S5732-H, S6730-H, S6730S-H,
S2730S-S, S5735-L-I, S5735-L1, S5735S-L1, S300, S500, S6720S-S, S5735S-H,
S5736-S, S6730-S, and S6730S-S: all versions
● S2720-EI, S5710-X-LI, S5720-LI, S5735-L, S5735S-L, S5735S-L-M, S5720S-LI,
S5720-SI, S5735-S, S5735S-S, S5735-S-I, S5720S-SI, S5730-SI, S5730S-EI,
S6720-LI, S6720S-LI, S6720-SI, and S6720S-SI: V200R012C00 and later
versions
To configure the ACL resource allocation mode for the S5720-HI, S2720-EI, S5720I-
SI, S5720-LI, S5720S-LI, S5735S-H, S5736-S, and S6720S-S, run the assign
resource-template acl-mode command.
ACL support is the same for a stack as for a standalone device. The ACL
configuration on the active switches is propagated to all standby and slave
switches in the stack.
Context
By default, an ACL is always effective after it is applied to a service module. To
make the ACL rules work only in a certain period, you can define a time range and
associate it with the ACL rules. In this way, services can be controlled through a
time-based ACL. For example, by configuring ACLs with specified time ranges, an
enterprise can forbid employees to access the Internet during work hours and limit
bandwidth for bandwidth-consuming services such as P2P and downloading
services during peak hours to avoid network congestion.
Time ranges associated with ACL rules are classified into:
● Periodic time range: defined by week. That is, ACL rules can take effect at an
interval of one week. For example, if the time range of ACL rules is 8:00-12:00
on Monday, the ACL rules take effect at 8:00-12:00 on every Monday.
● Absolute time range: defined by a period of time, in the format of from
YYYY/MM/DD HH:MM to YYYY/MM/DD HH:MM. That is, ACL rules take effect
only during this period.
NOTE
If the system time of a device is not synchronized with the network time, the ACL rules cannot
take effect in the associated time range. To make ACL rules take effect on a device, configure
the Network Time Protocol (NTP) on the device to automatically synchronize the system time
with the network time. NTP ensures clock consistency on all devices on a network. For details on
how to configure NTP, see Configuring Basic NTP Functions in "NTP Configuration" in the S300,
S500, S2700, S5700, and S6700 V200R021C00 Configuration Guide - Device Management.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Run time-range time-name { start-time to end-time { days } &<1-7> | from time1
date1 [ to time2 date2 ] }
A time range is created.
You can specify multiple time ranges for time-name. The device obtains the
intersection of the configured periodic or absolute time ranges.
----End
Follow-up Procedure
After a time range is created, you need to create an ACL and configure the ACL
rules to be associated with the time range. For the configuration of an ACL, see
2.7 Configuring an ACL.
Configuration Examples
Deleting a time range
Before deleting a time range, you must delete the ACL rules associated with the
time range or delete the ACL to which the ACL rules belong.
For example, ACL 2001 contains rule 5 and is associated with time range time1.
#
time-range time1 from 00:00 2014/1/1 to 23:59 2014/12/31
#
acl number 2001
rule 5 permit time-range time1
#
Prerequisites
If you need to configure a time-based ACL, create a time range and associate the
time range with the ACL rules. For details, see 2.6 (Optional) Creating a Time
Range in Which an ACL Takes Effect.
Context
A basic ACL defines rules to filter IPv4 packets based on information such as
source IP addresses, fragment information, and time ranges.
To filter packets based only on source IP addresses, you can configure a basic ACL.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create a basic ACL. You can create a numbered or named ACL.
● Run the acl [ number ] acl-number [ match-order { auto | config } ]
command to create a numbered basic ACL (2000-2999) and enter the basic
ACL view.
● Run the acl name acl-name { basic | acl-number } [ match-order { auto |
config } ] command to create a named basic ACL and enter the basic ACL
view.
By default, no ACL exists on the device.
If the parameter match-order is not specified when you create an ACL, the
default matching order config is used. For details about the ACL matching order,
see 2.2.3 ACL Matching.
The default step of a created ACL is 5. If the default step cannot meet your ACL
configuration requirements, you can change the step value. For details about the
step, see 2.2.5 ACL Increment; for configuration of the step, see 2.11.1 Adjusting
the Increment of ACL Rules.
Step 3 (Optional) Run description text
A description is configured for the ACL.
By default, an ACL has no description.
The ACL description helps you understand and remember the functions or purpose
of an ACL.
Step 4 Run rule [ rule-id ] { deny | permit } [ source { source-address source-wildcard |
any } | fragment | logging | time-range time-name | { vpn-instance vpn-
instance-name | public } ] *
Rules are configured in the basic ACL.
In this example, only one permit or deny rule is configured. In actual
configuration, you can configure multiple rules and decide the matching order of
the rules according to service requirements.
For details about the time range, source IP address and its wildcard mask, and IP
fragment information, see 2.2.2 ACLs Supported by Switches and Common
Matching Conditions. Configuring rules for a basic ACL provides a rule
configuration example.
Step 5 (Optional) Run rule rule-id description description
A description is configured for the ACL rules.
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring rules for a basic ACL
● Configuring a packet filtering rule based on the source IP address (host
address)
To allow packets from a host to pass, add a rule to an ACL. For example, to
allow packets from the host at 192.168.1.3 to pass, create the following rule
in ACL 2001.
<HUAWEI> system-view
[HUAWEI] acl 2001
[HUAWEI-acl-basic-2001] rule permit source 192.168.1.3 0
● Configuring a packet filtering rule based on the source network segment
To allow packets from a host to pass and reject packets from other hosts on
the same network segment, configure rules in an ACL. For example, to allow
packets from the host at 192.168.1.3 to pass and reject packets from other
hosts on the network segment 192.168.1.0/24, configure the following rules in
ACL 2001 and set the description of ACL 2001 to "Permit only 192.168.1.3
through."
<HUAWEI> system-view
[HUAWEI] acl 2001
[HUAWEI-acl-basic-2001] rule permit source 192.168.1.3 0
[HUAWEI-acl-basic-2001] rule deny source 192.168.1.0 0.0.0.255
[HUAWEI-acl-basic-2001] description permit only 192.168.1.3 through
● Configuring a time-based ACL rule
Create a time range working-time (for example, 8:00-18:00 on Monday
through Friday) and configure a rule in ACL work-acl. The rule rejects the
packets from the network segment 192.168.1.0/24 within the specified time
range working-time.
<HUAWEI> system-view
[HUAWEI] time-range working-time 8:00 to 18:00 working-day
[HUAWEI] acl name work-acl basic
[HUAWEI-acl-basic-work-acl] rule deny source 192.168.1.0 0.0.0.255 time-range working-time
● Configuring a packet filtering rule based on the source network segment
and IP fragment information
To reject non-initial fragments from a network segment, configure a rule in
an ACL. For example, to reject non-initial fragments from the network
segment 192.168.1.0/24, configure the following rule in ACL 2001.
<HUAWEI> system-view
[HUAWEI] acl 2001
[HUAWEI-acl-basic-2001] rule deny source 192.168.1.0 0.0.0.255 fragment
Prerequisites
If you need to configure a time-based ACL, create a time range and associate the
time range with the ACL rules. For details, see 2.6 (Optional) Creating a Time
Range in Which an ACL Takes Effect.
Context
Advanced ACLs give you greater flexibility and functionality than basic ACLs,
allowing you to filter packets more accurately. For example, with advanced ACLs,
you can define rules to filter IPv4 packets based on a range of criteria, including
source IP addresses, destination IP addresses, IP protocol types, TCP source/
destination port numbers, UDP source/destination port numbers, fragment
information, and time ranges.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create an advanced ACL. You can create a numbered or named ACL.
● Run the acl [ number ] acl-number [ match-order { auto | config } ]
command to create a numbered advanced ACL (3000-3999) and enter the
advanced ACL view.
● Run the acl name acl-name { advance | acl-number } [ match-order { auto |
config } ] command to create a named advanced ACL and enter the
advanced ACL view.
By default, no ACL exists on the device.
If the parameter match-order is not specified when you create an ACL, the
default matching order config is used. For details about the ACL matching order,
see 2.2.3 ACL Matching.
The default step of a created ACL is 5. If the default step cannot meet your ACL
configuration requirements, you can change the step value. For details about the
step, see 2.2.5 ACL Increment; for configuration of the step, see 2.11.1 Adjusting
the Increment of ACL Rules.
Step 3 (Optional) Run description text
A description is configured for the ACL.
By default, an ACL has no description.
The ACL description helps you understand and remember the functions or purpose
of an ACL.
Step 4 Configure rules for the advanced ACL.
You can configure advanced ACL rules according to the protocols carried by IP. The
parameters vary according to the protocol types.
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring rules for an advanced ACL
● Configuring a packet filtering rule for ICMP protocol packets based on
the source IP address (host address) and destination network segment
To allow ICMP packets from a host that are destined for a network segment
to pass, configure a rule in an ACL. For example, to allow ICMP packets from
the host at 192.168.1.3 that are destined for the network segment
192.168.2.0/24 to pass, configure the following rule in ACL 3001.
<HUAWEI> system-view
[HUAWEI] acl 3001
[HUAWEI-acl-adv-3001] rule permit icmp source 192.168.1.3 0 destination 192.168.2.0 0.0.0.255
● Configuring a packet filtering rule for TCP protocol packets based on the
TCP destination port number, source IP address (host address), and
destination network segment
To prohibit Telnet connections between a specified host and the hosts on a
network segment, configure a rule in an advanced ACL. For example, to
prohibit Telnet connections between the host at 192.168.1.3 and hosts on the
network segment 192.168.2.0/24, configure the following rule in the advanced
ACL deny-telnet.
<HUAWEI> system-view
[HUAWEI] acl name deny-telnet
[HUAWEI-acl-adv-deny-telnet] rule deny tcp destination-port eq telnet source 192.168.1.3 0
destination 192.168.2.0 0.0.0.255
To prohibit the specified hosts from accessing web pages (HTTP is used to
access web pages, and TCP port number is 80), configure rules in an advanced
● Configuring a packet filtering rule for TCP packets based on the source
network segment and TCP flags
To implement unidirectional access control on a network segment, configure
rules in an ACL. For example, to implement unidirectional access control on
the network segment 192.168.2.0/24, configure the following rules in ACL
3002. In the following rules, the hosts on 192.168.2.0/24 can only respond to
TCP handshake packets, but cannot send TCP handshake packets. Set the
descriptions of the ACL rules to "Allow the ACK TCP packets through", "Allow
the RST TCP packets through", and "Do not Allow the other TCP packet
through."
To meet the preceding requirement, configure two permit rules to allow the
packets with the ACK or RST field being 1 from 192.168.2.0/24 to pass, and
then configure a deny rule to reject other TCP packets from this network
segment.
<HUAWEI> system-view
[HUAWEI] acl 3002
[HUAWEI-acl-adv-3002] rule permit tcp source 192.168.2.0 0.0.0.255 tcp-flag ack
[HUAWEI-acl-adv-3002] display this // If you do not specify an ID for a created rule, you can view
the rule ID allocated by the system, and configure a description for the rule by specifying the rule ID.
#
acl number 3002
rule 5 permit tcp source 192.168.2.0 0.0.0.255 tcp-flag ack // The rule ID allocated by the
system is 5.
#
return
[HUAWEI-acl-adv-3002] rule 5 description Allow the ACK TCP packets through
[HUAWEI-acl-adv-3002] rule permit tcp source 192.168.2.0 0.0.0.255 tcp-flag rst
[HUAWEI-acl-adv-3002] display this
#
acl number 3002
rule 5 permit tcp source 192.168.2.0 0.0.0.255 tcp-flag ack
rule 5 description Allow the ACK TCP packets through
rule 10 permit tcp source 192.168.2.0 0.0.0.255 tcp-flag rst // The rule ID allocated by the system
is 10.
#
return
[HUAWEI-acl-adv-3002] rule 10 description Allow the RST TCP packets through
[HUAWEI-acl-adv-3002] rule deny tcp source 192.168.2.0 0.0.0.255
[HUAWEI-acl-adv-3002] display this
#
acl number 3002
rule 5 permit tcp source 192.168.2.0 0.0.0.255 tcp-flag ack
rule 5 description Allow the ACK TCP packets through
rule 10 permit tcp source 192.168.2.0 0.0.0.255 tcp-flag rst
rule 10 description Allow the RST TCP packets through
rule 15 deny tcp source 192.168.2.0 0.0.0.255 // The rule ID allocated by the system is 15.
#
return
[HUAWEI-acl-adv-3002] rule 15 description Do not Allow the other TCP packet through
You can specify the parameter established to allow the packets with the ACK
or RST field being 1 sent from 192.168.2.0/24 to pass and configure a deny
rule to reject other TCP packets from this subnet.
<HUAWEI> system-view
[HUAWEI] acl 3002
Prerequisites
If you need to configure a time-based ACL, create a time range and associate the
time range with the ACL rules. For details, see 2.6 (Optional) Creating a Time
Range in Which an ACL Takes Effect.
Context
A Layer 2 ACL defines rules to filter traffic based on Ethernet frame information,
such as source MAC addresses, destination MAC addresses, VLAN IDs, and Layer 2
protocol types.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create a Layer 2 ACL. You can create a numbered or named ACL.
● Run the acl [ number ] acl-number [ match-order { auto | config } ]
command to create a numbered Layer 2 ACL (4000-4999) and enter the Layer
2 ACL view.
● Run the acl name acl-name { link | acl-number } [ match-order { auto |
config } ] command to create a named Layer 2 ACL and enter the Layer 2
ACL view.
By default, no ACL exists on the device.
If the parameter match-order is not specified when you create an ACL, the
default matching order config is used. For details about the ACL matching order,
see 2.2.3 ACL Matching.
The default step of a created ACL is 5. If the default step cannot meet your ACL
configuration requirements, you can change the step value. For details about the
step, see 2.2.5 ACL Increment; for configuration of the step, see 2.11.1 Adjusting
the Increment of ACL Rules.
The ACL description helps you understand and remember the functions or purpose
of an ACL.
Step 4 Run rule [ rule-id ] { permit | deny } [ [ ether-ii | 802.3 | snap ] | l2-protocol
type-value [ type-mask ] | destination-mac dest-mac-address [ dest-mac-mask ] |
source-mac source-mac-address [ source-mac-mask ] | vlan-id vlan-id [ vlan-id-
mask ] | 8021p 802.1p-value | cvlan-id cvlan-id [ cvlan-id-mask ] | cvlan-8021p
802.1p-value | double-tag | time-range time-name ] *
NOTE
For details about the time range, source/destination MAC addresses and their
wildcard masks, VLAN IDs and their masks, see 2.2.2 ACLs Supported by
Switches and Common Matching Conditions. Configuring rules for a Layer 2
ACL provides a rule configuration example.
The ACL rule description helps you understand and remember the functions or
purpose of an ACL rule.
You can configure descriptions for only the existing rules on the device. That is,
you cannot configure a description for a rule before creating it.
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring rules for a Layer 2 ACL
● Configuring packet filtering rules based on the source MAC address,
destination MAC address, and Layer 2 protocol types
To allow ARP packets with the specified destination and source MAC
addresses, and Layer 2 protocol type to pass, configure a rule in a Layer 2
ACL. For example, to allow ARP packets with the destination MAC address of
0000-0000-0001, source MAC address of 0000-0000-0002, and Layer 2
protocol type of 0x0806 to pass, configure the following rule in ACL 4001.
<HUAWEI> system-view
[HUAWEI] acl 4001
[HUAWEI-acl-L2-4001] rule permit destination-mac 0000-0000-0001 source-mac 0000-0000-0002
l2-protocol 0x0806
To reject PPPoE packets with the specified Layer 2 protocol type, configure a
rule in a Layer 2 ACL. To reject PPPoE packets with the Layer 2 protocol type
of 0x8863, configure the following rule in ACL 4001.
<HUAWEI> system-view
[HUAWEI] acl 4001
[HUAWEI-acl-L2-4001] rule deny l2-protocol 0x8863
Prerequisites
If you need to configure a time-based ACL, create a time range and associate the
time range with the ACL rules. For details, see 2.6 (Optional) Creating a Time
Range in Which an ACL Takes Effect.
Context
A user-defined ACL defines rules based on packet headers, offsets, character string
masks, and user-defined character strings. With such a user-defined ACL
configured, the system performs an AND operation on the packet bytes from a
certain position behind the packet header and the character string mask,
compares the extracted character string against the user-defined character string,
and then filters IPv4 and IPv6 packets.
User-defined ACLs are more accurate and flexible than basic ACLs, advanced ACLs,
and Layer 2 ACLs, as well as providing more functions. For example, a user-
defined ACL can be configured to filter ARP packets based on source IP addresses
and ARP packet types.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Configure a user-defined ACL. You can create a numbered or named ACL.
● Run the acl [ number ] acl-number [ match-order { auto | config } ]
command to create a numbered user-defined ACL (5000-5999) and enter the
user-defined ACL view.
● Run the acl name acl-name { user | acl-number } [ match-order { auto |
config } ] command to create a named user-defined ACL and enter the user-
defined ACL view.
By default, no ACL exists on the device.
If the parameter match-order is not specified when you create an ACL, the
default matching order config is used. For details about the ACL matching order,
see 2.2.3 ACL Matching.
The default step of a created ACL is 5. If the default step cannot meet your ACL
configuration requirements, you can change the step value. For details about the
step, see 2.2.5 ACL Increment; for configuration of the step, see 2.11.1 Adjusting
the Increment of ACL Rules.
Step 3 (Optional) Run description text
A description is configured for the ACL.
By default, an ACL has no description.
The ACL description helps you understand and remember the functions or purpose
of an ACL.
Step 4 Run rule [ rule-id ] { deny | permit } [ [ l2-head | ipv4-head | ipv6-head | l4-
head ] { rule-string rule-mask offset } &<1-8> | time-range time-name ] *
Rules are configured in the user-defined ACL.
NOTE
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring a user-defined ACL rule
● Configuring packet filtering rules based on Layer 2 headers, offsets,
character string masks, and user-defined character strings
To reject ARP packets from the specified host, configure a rule in a user-
defined ACL. For example, to reject ARP packets from the host at 192.168.0.2,
configure the following rule in ACL 5001.
In the following rule:
– 0x00000806 indicates the ARP protocol.
– 0x0000ffff is the character string mask.
– 10 indicates the protocol type field offset in the ARP packets (without
VLAN ID).
– c0a80002 is the hexadecimal format of 192.168.0.2.
– 26 and 30 respectively indicate the offsets of the higher 2 bytes and
lower 2 bytes in the source IP addresses in ARP packets (without VLAN
ID). The source IP address in an ARP packet begins at the 28th byte in the
Layer 2 header and occupies 4 bytes. The Layer 2 header offset defined in
a user-defined ACL must be 4n + 2 (n is an integer). Therefore, the source
IP address is divided into two segments for matching. The lower 2 bytes
among the four bytes behind offset 26 (4 x 6 + 2) and the higher 2 bytes
among the 4 bytes behind offset 30 (4 x 7 + 2) are matched separately.
To filter ARP packets carrying VLAN IDs, add 4 to each of the following
offsets.
Figure 2-4 Source IP address field offset in the Layer 2 header of an ARP
packet
<HUAWEI> system-view
[HUAWEI] acl 5001
[HUAWEI-acl-user-5001] rule deny l2-head 0x00000806 0x0000ffff 10 0x0000c0a8 0x0000ffff 26
0x00020000 0xffff0000 30
NOTE
When specifying an ACL rule to match offset bytes in the Layer 2 header on the
S5735S-H or S5736-S, add a tag first if the ACL rule will be applied on a GE electrical
interface through which packets having no tag pass.
● Configuring a time-based ACL rule
For details, see Configuring a time-based ACL rule in Configuring a Basic
ACL.
Context
A user ACL defines rules to filter IPv4 packets based on the source IP addresses or
source User Control List (UCL) groups, destination IP addresses or destination UCL
groups, IP protocol types, ICMP types, TCP source/destination port numbers, UDP
source/destination port numbers, and time ranges.
To filter packets based on UCL groups, configure a user ACL.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create a user ACL. You can create a numbered or named ACL.
● Run the acl [ number ] acl-number [ match-order { auto | config } ]
command to create a numbered user ACL (6000-9999) and enter the user
ACL view.
● Run the acl name acl-name { ucl | acl-number } [ match-order { auto |
config } ] command to create a named user ACL and enter the user ACL view.
By default, no ACL exists on the device.
If the parameter match-order is not specified when you create an ACL, the
default matching order config is used. For details about the ACL matching order,
see 2.2.3 ACL Matching.
The default step of a created ACL is 5. If the default step cannot meet your ACL
configuration requirements, you can change the step value. For details about the
step, see 2.2.5 ACL Increment; for configuration of the step, see 2.11.1 Adjusting
the Increment of ACL Rules.
The ACL description helps you understand and remember the functions or purpose
of an ACL.
You can configure the user ACL rules according to the protocol types of IP packets.
The parameters vary according to the protocol types.
NOTE
The ACL rule description helps you understand and remember the functions or
purpose of an ACL rule.
You can configure descriptions for only the existing rules on the device. That is,
you cannot configure a description for a rule before creating it.
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring user ACL rules
● Configuring a packet filtering ACL rule based on the source UCL group
and destination IP address
Configure a rule in ACL 6000 to reject all the IP packets sent from the hosts in
source UCL group group1 to the network segment 192.168.1.0/24.
<HUAWEI> system-view
[HUAWEI] ucl-group 1 name group1
[HUAWEI] acl 6000
[HUAWEI-acl-ucl-6000] rule deny ip source ucl-group name group1 destination 192.168.1.0
0.0.0.255
Prerequisites
If you need to configure a time-based ACL6, create a time range and associate the
time range with the ACL6 rules. For details, see 2.6 (Optional) Creating a Time
Range in Which an ACL Takes Effect.
Context
A basic ACL6 defines rules to filter IPv6 packets based on information such as
source IPv6 addresses, fragment information, and time ranges.
To filter packets based only on source IPv6 addresses, you can configure a basic
ACL6.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create a basic ACL6. You can create a numbered or named ACL.
● Run the acl ipv6 [ number ] acl6-number [ match-order { auto | config } ]
command to create a numbered basic ACL6 (2000-2999) and enter the basic
ACL6 view.
● Run the acl ipv6 name acl6-name { basic | acl6-number } [ match-order
{ auto | config } ] command to create a named basic ACL6 and enter the
basic ACL6 view.
By default, no ACL6 exists on the device.
If the parameter match-order is not specified when you create an ACL6, the
default matching order config is used. The matching order of an ACL6 is the same
as that of an ACL. For details, see 2.2.3 ACL Matching.
Step 3 (Optional) Run description text
A description is configured for the ACL6.
By default, an ACL6 has no description.
The ACL6 description helps you understand and remember the functions or
purpose of an ACL6.
Step 4 Run rule [ rule-id ] { deny | permit } [ fragment | logging | source { source-ipv6-
address prefix-length | source-ipv6-address/prefix-length | source-ipv6-address
postfix postfix-length | source-ipv6-address wildcard | any } | time-range time-
name | { vpn-instance vpn-instance-name | public } ] *
Rules are configured in the basic ACL6.
In this example, only one permit or deny rule is configured. In actual
configuration, you can configure multiple rules and decide the matching order of
the rules according to service requirements.
Configuring rules for the basic ACL6 provides a rule configuration example.
Step 5 (Optional) Run rule rule-id description description
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring rules for a basic ACL6
● Configuring a packet filtering rule based on the source IPv6 address (host
address)
Configure a rule in ACL6 2001 to allow packets from the host at fc00:1::1/128
to pass.
<HUAWEI> system-view
[HUAWEI] acl ipv6 2001
[HUAWEI-acl6-basic-2001] rule permit source fc00:1::1 128
Prerequisites
If you need to configure a time-based ACL6, create a time range and associate the
time range with the ACL6 rules. For details, see 2.6 (Optional) Creating a Time
Range in Which an ACL Takes Effect.
Context
An advanced ACL6 defines rules to filter IPv6 packets based on source IPv6
addresses, destination IPv6 addresses, IPv6 protocol types, TCP source/destination
port numbers, UDP source/destination port numbers, fragment information, and
time ranges.
Compared with a basic ACL6, an advanced ACL6 is more accurate and flexible, and
provides more functions. For example, to filter packets based on source and
destination IPv6 addresses, configure an advanced ACL6.
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create an advanced ACL6. You can create a numbered or named ACL.
● Run the acl ipv6 [ number ] acl6-number [ match-order { auto | config } ]
command to create a numbered advanced ACL6 (3000-3999) and enter the
advanced ACL6 view.
● Run the acl ipv6 name acl6-name { advance | acl6-number } [ match-order
{ auto | config } ] command to create a named advanced ACL6 and enter the
advanced ACL6 view.
By default, no ACL6 exists on the device.
If the parameter match-order is not specified when you create an ACL6, the
default matching order config is used. The matching order of an ACL6 is the same
as that of an ACL. For details, see 2.2.3 ACL Matching.
Step 3 (Optional) Run description text
A description is configured for the ACL6.
By default, an ACL6 has no description.
The ACL6 description helps you understand and remember the functions or
purpose of an ACL6.
Step 4 Configure rules for the advanced ACL6.
You can configure advanced ACL6 rules according to the protocols carried by IP.
The parameters vary according to the protocol types.
● When the protocol type is TCP, the command format is:
rule [ rule-id ] { deny | permit } { tcp | protocol-number } [ destination
{ destination-ipv6-address prefix-length | destination-ipv6-address/prefix-
length | destination-ipv6-address postfix postfix-length | destination-ipv6-
address wildcard | any } | destination-port { eq port | gt port | lt port | range
port-start port-end } | { { precedence precedence | tos tos } * | dscp dscp } |
routing [ routing-type routing-type ] | { fragment | first-fragment } |
logging | source { source-ipv6-address prefix-length | source-ipv6-address/
prefix-length | source-ipv6-address postfix postfix-length | source-ipv6-
address wildcard | any } | source-port { eq port | gt port | lt port | range port-
start port-end } | tcp-flag { ack | established | fin | psh | rst | syn | urg } * |
time-range time-name | { vpn-instance vpn-instance-name | public } ] *
NOTE
– The vpn-instance and public parameter is supported only when a software-based ACL
is applied to the S5720I-SI, S5735-S, S5735S-S, S5735-S-I, S5735S-H, S5736-S, S5731-H,
S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720S-EI, S6720S-S, S6730-H,
S6730S-H, S6730-S, or S6730S-S. For usage scenarios of software-based ACLs, see "ACL
Implementations" in the S300, S500, S2700, S5700, and S6700 V200R021C00
Configuration Guide - Security ACL Configuration - 2.2.1 ACL Fundamentals.
– If the ACL rules configured on the S5731-H, S5731S-H, S5731-S, S5731S-S, S5732-H,
S6730-H, S6730S-H, S6730-S, and S6730S-S are hardware-based ACLs, tcp-flag is not
supported.
– Only the S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720S-EI, S6730-
H, S6730S-H, S6730-S, and S6730S-S support routing [ routing-type routing-type ].
– Only the S2720-EI, S5720-LI, S5720S-LI, S5720I-SI, S5735S-H, S5736-S, S5731-H, S5731-
S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720S-EI, S6720S-S, S6730-H, S6730S-H,
S6730-S, S6730S-S, S2730S-S, S5735-L-I, S5735-L1,S300, S5735-L, S5735S-L, S5735S-L1,
S5735S-L-M, S5735-S, S500, S5735S-S, and S5735-S-I support dscp, precedence, and
tos.
– Only the S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S2730S-S, S5735-L-I, S5735-
L1,S300, S5735-L, S5735S-L, S5735S-L1, S5735S-L-M, S5735-S, S500, S5735S-S, S5735-
S-I, S6720-EI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support
destination and first-fragment. For the S2730S-S, S5735-L-I, S5735-L1,S300, S5735-L,
S5735S-L, S5735S-L1, S5735S-L-M, S5735-S, S500, S5735S-S, and S5735-S-I, an ACL
containing the first-fragment can only be used in the inbound direction.
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring rules for an advanced ACL6
● Configuring a packet filtering rule for ICMPv6 protocol packets based on
the source IPv6 address (host address) and destination IPv6 network
segment
Configure a rule in ACL6 3001 to allow the ICMPv6 packets from the host at
fc00:1::1 and destined for the network segment fc00:2::/64 to pass.
<HUAWEI> system-view
[HUAWEI] acl ipv6 3001
[HUAWEI-acl6-adv-3001] rule permit icmpv6 source fc00:1::1 128 destination fc00:2:: 64
● Configuring a packet filtering rule for TCP protocol packets based on the
TCP destination port number, source IPv6 address (host address), and
destination IPv6 address segment
Configure a rule in the advanced ACL6 deny-telnet to forbid Telnet
connections between the host at fc00:1::3 and hosts on the network segment
fc00:2::/64.
<HUAWEI> system-view
[HUAWEI] acl ipv6 name deny-telnet
[HUAWEI-acl6-adv-deny-telnet] rule deny tcp destination-port eq telnet source fc00:1::3 128
destination fc00:2:: 64
Configure a rule in the advanced ACL6 no-web to forbid hosts at fc00:1::3 and
fc00:1::4 from accessing web pages (HTTP is used to access web pages, and
the TCP port number is 80).
<HUAWEI> system-view
[HUAWEI] acl ipv6 name no-web
[HUAWEI-acl6-adv-no-web] rule deny tcp destination-port eq 80 source fc00:1::3 128
[HUAWEI-acl6-adv-no-web] rule deny tcp destination-port eq 80 source fc00:1::4 128
● Configuring a time-based ACL6 rule
For details, see Configuring a time-based ACL rule in Configuring a Basic
ACL.
● Configuring a packet filtering rule based on the source network segment
and IP fragment information
For details, see Configuring a packet filtering rule based on the IP
fragment information and source IP address segment in Configuring a
Basic ACL.
Context
A user ACL6 defines rules to filter IPv6 packets based on the source IPv6 addresses
or source User Control List (UCL) groups, destination IPv6 addresses, IPv6 protocol
Procedure
Step 1 Run system-view
The system view is displayed.
Step 2 Create a user ACL6. You can create a numbered or named ACL6.
● Run the acl ipv6 [ number ] acl6-number [ match-order { auto | config } ]
command to create a numbered user ACL6 (6000-9999) and enter the user
ACL6 view.
● Run the acl ipv6 name acl6-name { ucl | acl6-number } [ match-order { auto
| config } ] command to create a named user ACL6 and enter the user ACL6
view.
By default, no ACL6 exists on the device.
If the parameter match-order is not specified when you create an ACL6, the
default matching order config is used. The matching order of an ACL6 is the same
as that of an ACL. For details, see 2.2.3 ACL Matching.
Step 3 (Optional) Run description text
A description is configured for the ACL6.
By default, an ACL6 has no description.
The ACL6 description helps you understand and remember the functions or
purpose of an ACL6.
Step 4 Configure user ACL6 rules.
You can configure the user ACL6 rules according to the protocol types of IPv6
packets. The parameters vary according to the protocol types.
● When the protocol type is ICMPv6, the command format is:
rule [ rule-id ] { permit | deny } { icmpv6 | protocol-number } [ source
{ { source-ipv6-address prefix-length | source-ipv6-address/prefix-length |
source-ipv6-address postfix postfix-length | source-ipv6-address wildcard |
any } | { ucl-group { name source-ucl-group-name | source-ucl-group-
index } } } * | destination { destination-ipv6-address prefix-length |
destination-ipv6-address/prefix-length | destination-ipv6-address postfix
postfix-length | destination-ipv6-address wildcard | any } | icmp6-type
{ icmp6-type [ icmp6-code ] | icmp6-name } | vpn-instance vpn-instance-
name | time-range time-name ] *
● When the protocol type is TCP, the command format is:
rule [ rule-id ] { deny | permit } { tcp | protocol-number } [ source { { source-
ipv6-address prefix-length | source-ipv6-address/prefix-length | source-ipv6-
address postfix postfix-length | source-ipv6-address wildcard | any } | { ucl-
group { source-ucl-group-index | name source-ucl-group-name } } } * |
destination { destination-ipv6-address prefix-length | destination-ipv6-
address/prefix-length | destination-ipv6-address postfix postfix-length |
----End
Follow-up Procedure
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect. For supported service modules and
configurations, see 2.8 Applying an ACL.
Configuration Examples
Configuring user ACL6 rules
● Configuring a packet filtering ACL6 rule based on the source UCL group
and destination IPv6 address
Configure a rule in ACL6 6000 to reject all the IPv6 packets sent from the
hosts in source UCL group group1 to the network segment fc00:1::/64.
<HUAWEI> system-view
[HUAWEI] ucl-group 1 name group1
[HUAWEI] acl ipv6 6000
[HUAWEI-acl6-ucl-6000] rule deny ipv6 source ucl-group name group1 destination fc00:1:: 64
Procedure
● Run the display acl { acl-number | name acl-name | all } command to check
the ACL configuration.
● Run the display acl ipv6 { acl6-number | name acl6-name | all } command to
check the ACL6 configuration.
● Run the display time-range { all | time-name } command to view the time
range configuration.
----End
Context
After an ACL is configured, it must be applied to a service module so that the ACL
rules can be delivered and take effect.
In most cases, an ACL is applied to a traffic policy or simplified traffic policy. This
enables the device to deliver ACL rules globally, in a VLAN, or on an interface to
filter packets to be forwarded. An ACL can be applied to service modules such as
Telnet, FTP, and routing.
Login in "Web
System Login
Configuration"
in the S300,
S500, S2700,
S5700, and
S6700
V200R021C00
Configuration
Guide - Basic
Configuration.
● SNMP: See
(Optional)
Restricting
Management
Rights of the
NMS (SNMPv1
and SNMPv2c)
and (Optional)
Restricting
Management
Rights of the
NMS
(SNMPv3) in
"SNMP
Configuration"
in the S300,
S500, S2700,
S5700, and
S6700
V200R021C00
Configuration
Guide -
Network
Management
and
Monitoring.
Configuring
OSPF to Filter
the Routes to
Be Advertised
in "OSPF
Configuration"
in the S300,
S500, S2700,
S5700, and
S6700
V200R021C00
Configuration
Guide - IP
Unicast
routing.
● RIP: See
Configuring
RIP to Import
Routes and
Configuring
RIP to Filter
Received
Routes in "RIP
Configuration"
in the S300,
S500, S2700,
S5700, and
S6700
V200R021C00
Configuration
Guide - IP
Unicast
routing.
● Multicast: See
Filtering IGMP
Messages
Based on
Source IP
Addresses in
"IGMP
Configuration",
Configuring a
Multicast
Group Policy
and (Optional)
Configuring an
SSM Group
Policy in "IGMP
Snooping
Configuration"
in the S300,
S500, S2700,
S5700, and
S6700
V200R021C00
Configuration
Guide - IP
Multicast.
Procedure
Step 1 Run system-view
Step 3 Based on the ACL type, configure new rules and delete unnecessary rules.
NOTE
When you update ACL rules, the device delivers the old and new rules together, and then
deletes the old rules. Therefore, sufficient ACL resources are required on the device for
successful rule update. For example, if three rules are configured in ACL3001, to add
another rule, ensure that there are at least four ACL resources available.
----End
Procedure
Step 1 Run system-view
Step 2 Perform either of the following operations based on the site requirements:
● Run undo acl { [ number ] acl-number | all }
Or run undo acl name acl-name
An ACL is deleted.
● Run undo acl ipv6 { all | [ number ] acl6-number }
Or undo acl ipv6 name acl6-name
An ACL6 is deleted.
NOTE
An ACL or ACL6 can be deleted even when they are referenced by service modules (except
when a simplified traffic references the specified rule in the ACL or ACL6). Therefore, ensure
that an ACL or ACL6 is not referenced by service modules before deleting it.
----End
Context
During routine maintenance, you may need to add rules to an ACL to meet new
service requirements. If the default increment 5 is used, you can insert only four
rules between neighboring rules (for example, rules 6, 7, 8, and 9 can be inserted
between rules 5 and 10). To insert more than four rules between neighboring
rules, increase the increment to a value greater than 6 so that the system
reallocates IDs to the rules.
Procedure
Step 1 Run the system-view command to enter the system view.
----End
Context
If you are notified that an ACL fails to be applied, this may be due to the system
having insufficient available ACL resources.
You can view ACL resource usage in the system to check whether the ACL
resources are exhausted.
Procedure
● Run the display acl resource [ slot slot-id ] command in any view to check
information about ACL resources.
If the value of Rule Free or Free is not 0, there are available ACL resources in
the system.
----End
Context
Many services use ACL rules to control packets. These ACL rules occupy ACL
resources. The ACL resources on the device are limited. If the number of occupied
ACL resources reaches the upper limit, new services cannot be delivered. However,
the device running and the services that have ACLs applied are not affected.
To optimize ACL resources, you need to know how ACL rules occupy ACL
resources. Generally, the number of occupied ACL resources is calculated as
follows:
Number of occupied ACL resources = Number of ACL rules x ACL application scope
(Number of interfaces or Number of VLANs or 1 if the ACL is applied globally) x
ACL application direction (1 for inbound and 1 for outbound, and 2 for inbound
and outbound)
For example, if 1K ACL rules are configured in an ACL using the if-match acl { acl-
number | acl-name } command and the traffic policy that references the ACL is
applied to the outbound direction of 8 interfaces, then totally 8K (1K rules x 8
interfaces x 1 direction) ACL resources are occupied.
Actually, the number of ACL rules configured on the device is different from the
actual number of ACL resources occupied. The calculation method varies
depending on factors such as the hardware chip and the type of service to which
an ACL is applied.
Procedure
In the preceding traffic policy example, if the device supports a maximum of 7K
downstream ACL resources, the service cannot be configured. You can use any of
the following methods to optimize ACL resource usage so that the service can be
successfully configured:
In addition, rules 801 through 831 use TCP destination ports 80 through 110
as the matching conditions. Therefore, you can specify the keyword range to
combine rules 801 through 831 into the following rule:
#
acl number 3009
...
rule 801 deny tcp destination-port range 80 110
...
#
After combination, rules 801 through 831 are reduced to 462 rules. The
number of occupied ACL resources is reduced to 3696 (462 rules x 8
interfaces), which is lower than the upper limit of ACL resources.
Context
ACL resources are occupied by ACL or ACL6 services, Meter resources are occupied
by traffic rate limiting services, and Counter resources are occupied by traffic
statistics service. You can configure the ACL, Meter or Counter resource usage
threshold at which an alarm will be generated.
When the ACL, Meter or Counter resource usage is higher than or equal to the
threshold, the device generates an alarm. When the ACL, Meter or Counter
resource usage is lower than or equal to the lower threshold, the device generates
a clear alarm.
Procedure
Step 1 Run the system-view command to enter the system view.
By default, the lower alarm threshold percentage is 70, and the upper alarm
threshold percentage is 80.
----End
Context
The default ACL resource allocation mode is Normal. In Normal mode, the ACL
does not support matching of destination IPv6 addresses. If matching destination
IPv6 address is required, switch the ACL resource allocation mode to NAC.
NOTE
Only the S2720-EI, S5720I-SI, S5720-LI, S5720S-LI, S5735S-H, S5736-S, and S6720S-S
support this command.
Procedure
Step 1 (Optional) Run the display system resource-template [ slot slot-id ] command
to display information about the system resource template.
Step 2 Run the system-view command to enter the system view.
Step 3 Run the assign resource-template acl-mode { nac | normal } [ slot slot-id ]
command to configure the ACL resource allocation mode.
The default ACL resource allocation mode is Normal.
NOTE
After configuring the ACL resource allocation mode, save the configuration, and restart the
device for the configuration to take effect.
----End
NOTICE
The deleted ACL or ACL6 statistics cannot be restored. Exercise caution when you
run the command.
Procedure
● Run the reset acl counter { name acl-name | acl-number | all } command in
the user view to clear ACL statistics.
● Run the reset acl ipv6 counter { name acl6-name | acl6-number | all }
command in the user view to clear ACL6 statistics.
----End
Networking Requirements
As shown in Figure 2-6, the Switch functions as an FTP server. The requirements
are as follows:
● All the users on subnet 1 (172.16.105.0/24) are allowed to access the FTP
server anytime.
● All the users on subnet 2 (172.16.107.0/24) are allowed to access the FTP
server only during the specified period of time.
● Other users are not allowed to access the FTP server.
Reachable routes exist between the Switch and subnets. You need to configure the
Switch to limit user access to the FTP server.
Configuration Roadmap
The following configurations are performed on the Switch. The configuration
roadmap is as follows:
1. Configure time ranges and ACLs so that the device can filter user packets to
control FTP access rights of different users.
2. Configure basic FTP functions.
3. Apply the ACL to the FTP module to make the ACL take effect.
Procedure
Step 1 Configure time ranges.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] time-range ftp-access from 0:0 2014/1/1 to 23:59 2014/12/31
[Switch] time-range ftp-access 14:00 to 18:00 off-day
Step 4 Apply the ACL to the FTP server for access permission control.
[Switch] ftp acl 2001
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
FTP server enable
FTP server-source -i vlanif 10
FTP acl 2001
#
time-range ftp-access 14:00 to 18:00 off-day
time-range ftp-access from 00:00 2014/1/1 to 23:59 2014/12/31
#
acl number 2001
rule 5 permit source 172.16.105.0 0.0.0.255
rule 10 permit source 172.16.107.0 0.0.0.255 time-range ftp-access
rule 15 deny
#
aaa
local-user test password irreversible-cipher $1a$a/sUWg/.p1*))=~SWzIRS0N",`&aS%'7X).m=o[PkQcv"!!
TTQOI~Z)C'1<9$
local-user test privilege level 15
local-user test ftp-directory flash:
local-user test service-type ftp
#
return
Networking Requirements
As shown in Figure 2-7, the PC and device are reachable to each other. Users
require that the device be remotely configured and easily managed. To meet the
requirement, configure AAA authentication for Telnet users on the server and
configure a security policy to allow only users meeting the policy to log in to the
device.
Configuration Roadmap
The configuration roadmap is as follows:
1. Log in to the device using Telnet to remotely maintain the device.
2. Configure the administrator user name and password, and configure an AAA
authentication policy to ensure that only users passing the authentication can
log in to the device.
3. Configure a security policy to ensure that only users meeting the policy can
log in to the device.
Procedure
Step 1 Enable the server function.
<HUAWEI> system-view
[HUAWEI] sysname Telnet_Server
[Telnet_Server] telnet server-source -i Vlanif 10 //Assume that the client uses the IP address
10.137.217.177 to connect to the server, and the interface using this IP address is Vlanif 10.
[Telnet_Server] telnet server enable
[Telnet_Server] aaa
[Telnet_Server-aaa] local-user admin1234 password irreversible-cipher Helloworld@6789
[Telnet_Server-aaa] local-user admin1234 service-type telnet
[Telnet_Server-aaa] local-user admin1234 privilege level 3
[Telnet_Server-aaa] quit
Press Enter, and enter the configured user name and password in the login
window. If authentication succeeds, the CLI is displayed, indicating that you have
successfully logged in to the device. (The following information is only for
reference.)
Login authentication
Username:admin1234
Password:
Info: The max number of VTY users is 8, and the number
of current VTY users on line is 2.
The current login time is 2012-08-06 18:33:18+00:00.
<Telnet_Server>
----End
Configuration File
Telnet_Server configuration file
#
sysname Telnet_Server
#
telnet server enable
telnet server-source -i Vlanif 10
#
acl number 2001
rule 5 permit source 10.1.1.1 0
#
aaa
local-user admin1234 password irreversible-cipher $1a$aVW8S=aP=B<OWi1Bu'^R[=_!~oR*85r_nNY+kA(I}
[TiLiVGR-i/'DFGAI-O$
local-user admin1234 privilege level 3
local-user admin1234 service-type telnet
#
user-interface maximum-vty 15
user-interface vty 0 14
acl 2001 inbound
authentication-mode aaa
history-command max-size 20
idle-timeout 20 0
screen-length 0
protocol inbound telnet
#
return
Networking Requirements
As shown in Figure 2-8, two NMSs are available on the network to monitor
network devices. The network size is small and the network has a high security
level. Therefore, the administrator requires that only the trusted NMS (NMS2)
manage network devices and the Switch use SNMPv1 to communicate with the
NMS. Unauthorized NMSs cannot manage the Switch. According to service
requirements, the administrator allows the NMS to manage the objects on the
Switch except RMON, and the administrator needs to locate and rectify faults
quickly through the NMS.
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure the SNMP version on the Switch to SNMPv1.
2. Configure the ACL, MIB view, and community name to control the access
rights of NMSs. NMS2 can only manage the objects on the Switch except
RMON, and NMS1 cannot manage the Switch.
3. Configure the trap host for the Switch to deliver traps generated on the
Switch to NMS2. To help quickly identify faults according to trap messages
and reduce useless traps, configure the Switch to send only the traps of the
modules enabled by default.
4. Configure NMS2.
Procedure
Step 1 Configure an IP address for an interface of the Switch to provide a reachable route
between the NMS and the Switch.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan 100
[Switch-vlan100] quit
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type hybrid
[Switch-GigabitEthernet0/0/1] port hybrid pvid vlan 100
Step 2 Configure the interface can receive and respond to NMS request packets on the
Switch.
[Switch] snmp-agent protocol source-interface vlanif 100
# Configure an ACL that allows NMS2 to manage the Switch and prevents NMS1
from managing the Switch.
[Switch] acl 2001
[Switch-acl-basic-2001] rule 5 permit source 10.1.1.2 0.0.0.0
[Switch-acl-basic-2001] rule 6 deny source 10.1.1.1 0.0.0.0
[Switch-acl-basic-2001] quit
# Configure the MIB view to allow NMS2 to manage all MIB objects on the Switch
except RMON objects.
[Switch] snmp-agent mib-view excluded allextrmon 1.3.6.1.2.1.16
# Configure a community name and reference the ACL and MIB view for the
community.
[Switch] snmp-agent community write adminnms2 mib-view allextrmon acl 2001
You must set a read-write community name for an NMS running SNMPv1. For
details about the NMS configuration, see the manual of the NMS.
NOTE
The authentication parameter configuration on the NMS must be the same as that on the
Switch. Otherwise, the NMS cannot manage the Switch. If only the write community name
is configured on the device, the read and write community names on the NMS must be the
same as the write community name configured on the device.
After completing the configuration, run the following commands to verify that the
configurations have taken effect.
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 100
#
acl number 2001
rule 5 permit source 10.1.1.2 0
rule 6 deny source 10.1.1.1 0
#
interface Vlanif100
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type hybrid
port hybrid pvid vlan 100
port hybrid untagged vlan 100
#
snmp-agent
snmp-agent local-engineid 800007DB03360102101100
snmp-agent community write cipher %^%#.T|&Whvyf$<Gd"I,wXi5SP_6~Nakk6<<+3H:N-h@aJ6d,l0md
%HCeAY8~>X=>xV\JKNAL=124r839v<*%^%# mib-view allextrmon acl 2001
snmp-agent sys-info version v1 v3
snmp-agent target-host trap address udp-domain 10.1.1.2 params securityname cipher %^%#uq/!
YZfvW4*vf[~C|.:Cl}UqS(vXd#wwqR~5M(rU%%^%#
snmp-agent mib-view excluded allextrmon rmon
snmp-agent protocol source-interface Vlanif100
#
return
Networking Requirements
Figure 2-9 shows how on an OSPF network, SwitchA receives routes from the
Internet and provides these routes for the OSPF network. A user wants devices on
the OSPF network to access only the network segments 172.16.17.0/24,
172.16.18.0/24, and 172.16.19.0/24, and SwitchC to access only the network
segment 172.16.18.0/24.
Figure 2-9 Networking diagram for filtering the received and advertised routes
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure an ACL on SwitchA so that SwitchA advertises only the routes
172.16.17.0/24, 172.16.18.0/24, and 172.16.19.0/24 to SwitchB. In this case,
the OSPF network can access only 172.16.17.0/24, 172.16.18.0/24, and
172.16.19.0/24.
2. Configure an ACL on SwitchC so that SwitchC receives only the route
172.16.18.0/24. In this case, the network connected to SwitchC can access
only the network segment 172.16.18.0/24.
Procedure
Step 1 Add interfaces to VLANs.
# Configure SwitchA. Ensure that the configurations of SwitchB and SwitchC are
the same as the configuration of SwitchA.
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type trunk
[SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SwitchA-GigabitEthernet0/0/1] quit
# Configure SwitchA.
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# Configure SwitchB.
[SwitchB] ospf
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# Configure SwitchC.
[SwitchC] ospf
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
Step 4 Configure five static routes on SwitchA and import these routes into OSPF.
[SwitchA] ip route-static 172.16.16.0 24 NULL 0
[SwitchA] ip route-static 172.16.17.0 24 NULL 0
[SwitchA] ip route-static 172.16.18.0 24 NULL 0
[SwitchA] ip route-static 172.16.19.0 24 NULL 0
[SwitchA] ip route-static 172.16.20.0 24 NULL 0
[SwitchA] ospf
[SwitchA-ospf-1] import-route static
[SwitchA-ospf-1] quit
# Check the IP routing table on SwitchB. You can see that the five static routes are
imported into OSPF.
[SwitchB] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
# Configure a route advertisement policy on SwitchA and associate ACL 2002 with
the policy to filter routes.
[SwitchA] ospf
[SwitchA-ospf-1] filter-policy 2002 export static
[SwitchA-ospf-1] quit
# View the IP routing table on SwitchB. SwitchB has received only the three routes
defined in ACL 2002.
[SwitchB] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 9 Routes : 9
# Configure a route receiving policy on SwitchC and associate ACL 2003 with the
policy to filter routes.
[SwitchC] ospf
[SwitchC-ospf-1] filter-policy 2003 import
[SwitchC-ospf-1] quit
# View the IP routing table on SwitchC. SwitchC has received only the route
defined in ACL 2003.
[SwitchC] display ip routing-table
Route Flags: R - relay, D - download to fib, T - to vpn-instance
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 5 Routes : 5
----End
Configuration Files
● Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 10
#
acl number 2002
rule 5 permit source 172.16.17.0 0.0.0.255
rule 10 permit source 172.16.18.0 0.0.0.255
rule 15 permit source 172.16.19.0 0.0.0.255
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
ospf 1
filter-policy 2002 export static
import-route static
area 0.0.0.0
network 192.168.1.0 0.0.0.255
#
ip route-static 172.16.16.0 255.255.255.0 NULL0
ip route-static 172.16.17.0 255.255.255.0 NULL0
ip route-static 172.16.18.0 255.255.255.0 NULL0
ip route-static 172.16.19.0 255.255.255.0 NULL0
ip route-static 172.16.20.0 255.255.255.0 NULL0
#
return
● Configuration file of SwitchB
#
sysname SwitchB
#
vlan batch 10 20
#
interface Vlanif10
ip address 192.168.1.2 255.255.255.0
#
interface Vlanif20
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
return
● Configuration file of SwitchC
#
sysname SwitchC
#
vlan batch 20
#
acl number 2003
rule 5 permit source 172.16.18.0 0.0.0.255
#
interface Vlanif20
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
ospf 1
filter-policy 2003 import
area 0.0.0.0
network 192.168.2.0 0.0.0.255
#
return
Networking Requirements
As shown in Figure 2-10, the departments of an enterprise are connected through
the Switch. To facilitate network management, the administrator allocates the IP
addresses on two network segments to the R&D and marketing departments,
respectively. In addition, the administrator adds the two departments to different
VLANs for broadcast domain isolation. The Switch needs to restrict mutual access
between two network segments to ensure information security.
Figure 2-10 Using advanced ACLs to restrict mutual access between network
segments
Configuration Roadmap
The following configurations are performed on the Switch. The configuration
roadmap is as follows:
Procedure
Step 1 Configure VLANs and IP addresses for interfaces to ensure network connections.
# Create VLAN 10 and VLAN 20.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 10 20
# Configure GE0/0/1 and GE0/0/2 on the Switch as trunk interfaces, and add the
two interfaces to VLAN 10 and VLAN 20, respectively.
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[Switch-GigabitEthernet0/0/1] quit
[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] port link-type trunk
[Switch-GigabitEthernet0/0/2] port trunk allow-pass vlan 20
[Switch-GigabitEthernet0/0/2] quit
# Define the traffic policy, and associate the traffic classifier and traffic behavior
with the traffic policy.
[Switch] traffic policy tp1
[Switch-trafficpolicy-tp1] classifier tc1 behavior tb1
[Switch-trafficpolicy-tp1] quit
# The two network segments where the R&D and marketing departments reside
cannot access each other.
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 10 20
#
acl number 3001
rule 5 deny ip source 10.1.1.0 0.0.0.255 destination 10.1.2.0 0.0.0.255
#
traffic classifier tc1 operator or
if-match acl 3001
#
traffic behavior tb1
deny
#
traffic policy tp1 match-order config
classifier tc1 behavior tb1
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
traffic-policy tp1 inbound
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
return
Related Content
Videos
Configure ACL
Configuration Roadmap
1. Configure an advanced ACL and ACL-based traffic classifier to restrict ICMP
and TCP services so that unidirectional access from the president's office to
the employee's office can be implemented.
– TCP service: permits SYN and ACK packets from the employee's office to
the president's office, that is, responds to TCP connections initiated by the
president's office; denies SYN request packets from the employee's office
to the president's office to prevent the employee's office from initiating
TCP connections.
– ICMP service: denies echo request packets from the employee's office to
the president's office to prevent the employee's office from initiating ping
connectivity tests.
NOTE
Procedure
Step 1 Configure IP addresses for interfaces and add the interfaces to VLANs.
# Create VLAN 10 and VLAN 20.
<HUAWEI> system-view
[HUAWEI] sysname SwitchC
[SwitchC] vlan batch 10 20
# Configure GE0/0/1 and GE0/0/2 on the SwitchC as trunk interfaces and add
them to VLAN 10 and VLAN 20, respectively.
[SwitchC] interface gigabitethernet 0/0/1
[SwitchC-GigabitEthernet0/0/1] port link-type trunk
[SwitchC-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[SwitchC-GigabitEthernet0/0/1] quit
[SwitchC] interface gigabitethernet 0/0/2
[SwitchC-GigabitEthernet0/0/2] port link-type trunk
[SwitchC-GigabitEthernet0/0/2] port trunk allow-pass vlan 20
[SwitchC-GigabitEthernet0/0/2] quit
[SwitchC-acl-adv-3001] rule deny icmp source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 icmp-
type echo
[SwitchC-acl-adv-3001] quit
# Configure the traffic classifier tc1 to classify packets that match ACL 3001.
[SwitchC] traffic classifier tc1
[SwitchC-classifier-tc1] if-match acl 3001
[SwitchC-classifier-tc1] quit
# Define a traffic policy, and associate the traffic classifier and traffic behavior
with the traffic policy.
[SwitchC] traffic policy tp1
[SwitchC-trafficpolicy-tp1] classifier tc1 behavior tb1
[SwitchC-trafficpolicy-tp1] quit
# The president's office can access the employee's office, but the employee's office
cannot access the president's office.
----End
Configuration Files
SwitchC configuration file
#
sysname SwitchC
#
vlan batch 10 20
#
acl number 3001
rule 5 permit tcp source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 tcp-flag ack syn
rule 10 deny tcp source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 tcp-flag syn
rule 15 deny icmp source 10.1.2.0 0.0.0.255 destination 10.1.1.0 0.0.0.255 icmp-type echo
#
traffic classifier tc1 operator or
if-match acl 3001
#
traffic behavior tb1
permit
#
traffic policy tp1 match-order config
classifier tc1 behavior tb1
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
traffic-policy tp1 inbound
#
return
Related Content
Videos
Configure ACL
Networking Requirements
As shown in Figure 2-12, the departments of an enterprise are connected through
the Switch. The R&D and marketing departments cannot access the salary query
server at 10.164.9.9 in work hours (08:00 to 17:30), whereas the president office
can access the server at anytime.
Figure 2-12 Using advanced ACLs to control access to the specified server in the
specified time range
Configuration Roadmap
The following configurations are performed on the Switch. The configuration
roadmap is as follows:
1. Configure the time range, advanced ACL, and ACL-based traffic classifier to
filter packets from users to the server in the specified time range. In this way,
you can restrict the access of different users to the server in the specified time
range.
2. Configure a traffic behavior to discard the packets matching the ACL.
3. Configure and apply a traffic policy to make the ACL and traffic behavior take
effect.
Procedure
Step 1 Add interfaces to VLANs and assign IP addresses to the VLANIF interfaces.
# Add GE0/0/1 throughGE0/0/3 to VLANs 10, 20, and 30, respectively, add
GE0/0/4 to VLAN 100, and assign IP addresses to these VLANIF interfaces. The
configurations on GE0/0/1 and VLANIF 10 are used as an example here. The
configurations on GE0/0/2, GE0/0/3, and GE0/0/4 are similar to those on GE0/0/1,
and the configurations on VLANIF 20, VLANIF 30, and VLANIF 100 are similar to
those on VLANIF 10.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 10 20 30 100
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[Switch-GigabitEthernet0/0/1] quit
[Switch] interface vlanif 10
[Switch-Vlanif10] ip address 10.164.1.1 255.255.255.0
[Switch-Vlanif10] quit
# Configure an ACL for the R&D department to access the salary query server.
[Switch] acl 3003
[Switch-acl-adv-3003] rule deny ip source 10.164.3.0 0.0.0.255 destination 10.164.9.9 0.0.0.0 time-range
satime
[Switch-acl-adv-3003] quit
# Configure the traffic classifier c_rd to classify the packets that match ACL 3003.
[Switch] traffic classifier c_rd
[Switch-classifier-c_rd] if-match acl 3003
[Switch-classifier-c_rd] quit
# Configure the traffic policy p_rd, and associate the traffic classifier c_rd and the
traffic behavior b_rd with the traffic policy.
# Packets from the marketing department are received by GE0/0/2, so apply the
traffic policy p_market to the inbound direction of GE0/0/2.
[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] traffic-policy p_market inbound
[Switch-GigabitEthernet0/0/2] quit
# Packets from the R&D department are received by GE0/0/3, so apply the traffic
policy p_rd to the inbound direction of GE0/0/3.
[Switch] interface gigabitethernet 0/0/3
[Switch-GigabitEthernet0/0/3] traffic-policy p_rd inbound
[Switch-GigabitEthernet0/0/3] quit
Classifier: c_rd
Operator: OR
Rule(s) : if-match acl 3003
Policy: p_rd
Classifier: c_rd
Operator: OR
Behavior: b_rd
Deny
# The R&D and marketing departments cannot access the salary query server
during work hours (08:00 to 17:30).
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 10 20 30 100
#
time-range satime 08:00 to 17:30 working-day
#
acl number 3002
rule 5 deny ip source 10.164.2.0 0.0.0.255 destination 10.164.9.9 0 time-range satime
acl number 3003
rule 5 deny ip source 10.164.3.0 0.0.0.255 destination 10.164.9.9 0 time-range satime
#
traffic classifier c_market operator or
if-match acl 3002
traffic classifier c_rd operator or
if-match acl 3003
#
traffic behavior b_market
deny
traffic behavior b_rd
deny
#
traffic policy p_market match-order config
classifier c_market behavior b_market
traffic policy p_rd match-order config
classifier c_rd behavior b_rd
#
interface Vlanif10
ip address 10.164.1.1 255.255.255.0
#
interface Vlanif20
ip address 10.164.2.1 255.255.255.0
#
interface Vlanif30
Networking Requirements
As shown in Figure 2-13, the Switch that functions as the gateway is connected to
the users' PCs. The administrator wants to block network access of PC1 after
detecting that PC1 (00e0-f201-0101) is unauthorized.
Figure 2-13 Using Layer 2 ACLs to block network access of the specified users
Configuration Roadmap
The following configurations are performed on the Switch. The configuration
roadmap is as follows:
1. Configure a Layer 2 ACL and an ACL-based traffic classifier to discard packets
from the MAC address 00e0-f201-0101 (preventing the user with this MAC
address from accessing the network).
Procedure
Step 1 Configure an ACL.
# Configure a Layer 2 ACL to meet the preceding requirement.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] acl 4000
[Switch-acl-L2-4000] rule deny source-mac 00e0-f201-0101 ffff-ffff-ffff
[Switch-acl-L2-4000] quit
# The user with the MAC address 00e0-f201-0101 cannot access the Internet.
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
acl number 4000
rule 5 deny source-mac 00e0-f201-0101
#
traffic classifier tc1 operator or
if-match acl 4000
#
traffic behavior tb1
deny
#
traffic policy tp1 match-order config
classifier tc1 behavior tb1
#
interface GigabitEthernet0/0/2
traffic-policy tp1 inbound
#
return
Networking Requirements
Voice, video, and data services are transmitted in VLAN 120, VLAN 110, and VLAN
100 respectively.
Configuration Roadmap
The configuration roadmap is as follows:
1. Create VLANs and configure interfaces so that users can access the Internet
through the Switch.
2. Configure ACLs on the Switch to match services from different VLANs.
3. Configure ACL-based traffic policing on the Switch to rate-limit packets.
Procedure
Step 1 Create VLANs and configure interfaces.
# Create VLAN 100, VLAN 110, and VLAN 120 on the Switch.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 100 110 120
# Configure GE0/0/1 and GE0/0/2 as trunk interfaces, and add GE0/0/1 and
GE0/0/2 to VLAN 100, VLAN 110, and VLAN 120.
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 110 120
[Switch-GigabitEthernet0/0/1] quit
[Switch] interface gigabitethernet 0/0/2
[Switch-GigabitEthernet0/0/2] port link-type trunk
[Switch-GigabitEthernet0/0/2] port trunk allow-pass vlan 100 110 120
[Switch-GigabitEthernet0/0/2] quit
ACL 4001
rule 1 permit vlan-id 120
ACTIONS:
limit cir 2000 ,cbs 250000
pir 10000 ,pbs 1250000
green : pass
yellow : pass
red : drop
-----------------------------------------------------------
ACL 4002
rule 1 permit vlan-id 110
ACTIONS:
limit cir 4000 ,cbs 500000
pir 10000 ,pbs 1250000
green : pass
yellow : pass
red : drop
-----------------------------------------------------------
ACL 4003
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 100 110 120
#
acl number 4001
rule 1 permit vlan-id 120
acl number 4002
rule 1 permit vlan-id 110
acl number 4003
rule 1 permit vlan-id 100
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 100 110 120
traffic-limit inbound acl 4001 cir 2000 pir 10000 cbs 250000 pbs 1250000
traffic-limit inbound acl 4002 cir 4000 pir 10000 cbs 500000 pbs 1250000
traffic-limit inbound acl 4003 cir 4000 pir 10000 cbs 500000 pbs 1250000
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 100 110 120
#
return
Networking Requirements
As shown in Figure 2-15, users are connected to the Switch through GE0/0/1. The
Switch needs to discard certain packets (with four bytes following the 14th byte in
the Layer 2 header being 0x0180C200) sent by users.
Configuration Roadmap
The following configurations are performed on the Switch. The configuration
roadmap is as follows:
Procedure
Step 1 Configure an ACL.
# Configure the traffic classifier tc1 to classify packets that match ACL 5000.
[Switch] traffic classifier tc1
[Switch-classifier-tc1] if-match acl 5000
[Switch-classifier-tc1] quit
# Define the traffic policy, and associate the traffic classifier and traffic behavior
with the traffic policy.
[Switch] traffic policy tp1
[Switch-trafficpolicy-tp1] classifier tc1 behavior tb1
[Switch-trafficpolicy-tp1] quit
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
acl number 5000
rule 5 deny 0x0180c200 0xffffffff 14
#
traffic classifier tc1 operator or
if-match acl 5000
#
traffic behavior tb1
deny
#
traffic policy tp1 match-order config
classifier tc1 behavior tb1
#
interface GigabitEthernet0/0/1
traffic-policy tp1 inbound
#
return
Networking Requirements
As shown in Figure 2-16, a large number of terminals in an office area of an
enterprise connect to the enterprise internal network through the switch. Some
departments have multiple branches in different locations, so the terminals of the
same department cannot use the IP addresses of the same network segment.
The administrator requires that the switch authenticate the terminals (including
computers and printers) of every department, to prevent unauthorized access. In
addition, due to the differentiated responsibilities, the administrator wants to
grant different network access rights to the users of different department,
avoiding secret information leak caused by mutual access between users.
The following requirements must be met:
● The marketing department cannot access the IT department.
● The R&D department cannot access the IT department.
Figure 2-16 Using user ACLs to control network access rights of enterprise's
internal users based on groups
Configuration Roadmap
The configuration roadmap is as follows:
NOTE
This example only provides the configurations on the Switch. The configurations on the LAN
switch and RADIUS server are not provided here.
Procedure
Step 1 Configure VLANs and IP addresses for interfaces to ensure network connections.
# Create VLAN 10, VLAN 20, VLAN 30, and VLAN 40.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] vlan batch 10 20 30 40
# Create VLANIF 10, VLANIF 20, VLANIF 30, and VLANIF 40, and assign IP
addresses to these VLANIF interfaces so that reachable routes can be set up
between the terminals, Switch, and enterprise internal servers.
[Switch] interface vlanif 10
[Switch-Vlanif10] ip address 192.168.1.1 24
[Switch-Vlanif10] quit
[Switch] interface vlanif 20
[Switch-Vlanif20] ip address 192.168.2.1 24
[Switch-Vlanif20] quit
[Switch] interface vlanif 30
[Switch-Vlanif30] ip address 192.168.3.1 24
[Switch-Vlanif30] quit
Step 2 Create and configure a RADIUS server template, an AAA scheme, and an
authentication domain.
# Create and configure the RADIUS server template rd1.
[Switch] radius-server template rd1
[Switch-radius-rd1] radius-server authentication 192.168.4.30 1812
[Switch-radius-rd1] radius-server shared-key cipher test@123
[Switch-radius-rd1] radius-server retransmit 2
[Switch-radius-rd1] quit
# Create the AAA scheme abc and set the authentication mode to RADIUS.
[Switch] aaa
[Switch-aaa] authentication-scheme abc
[Switch-aaa-authen-abc] authentication-mode radius
[Switch-aaa-authen-abc] quit
# Create the authentication domain abc11, and bind the AAA scheme abc and the
RADIUS server template rd1 to the authentication domain.
[Switch-aaa] domain abc11
[Switch-aaa-domain-abc11] authentication-scheme abc
[Switch-aaa-domain-abc11] radius-server rd1
[Switch-aaa-domain-abc11] quit
[Switch-aaa] quit
NOTE
By default, the NAC mode is unified mode, so this step can be skipped.
After the common mode and unified mode are switched, you must restart the device to make
each function take effect in the new mode.
[Switch] authentication unified-mode
By default, an 802.1X access profile uses the EAP authentication mode. Ensure that the RADIUS
server supports EAP; otherwise, the server cannot process 802.1X authentication request packets.
[Switch] dot1x-access-profile name d1
[Switch-dot1x-access-profile-d1] quit
Step 4 Create a UCL group, associate the user ACL with the UCL group, and apply the
user ACL to filter packets.
# Create UCL groups group_m and group_r. Add the marketing department to
group_m and R&D department to group_r.
[Switch] ucl-group 1 name group_m
[Switch] ucl-group 2 name group_r
NOTE
Information about user groups of the marketing and R&D departments must have been
configured on the RADIUS server.
# Create user ACL 6001 and configure ACL rules. Configure rule 5 to prevent the
marketing department from accessing the IT department; configure rule 10 to
prevent the R&D department from accessing the IT department.
[Switch] acl 6001
[Switch-acl-ucl-6001] rule 5 deny ip source ucl-group name group_m destination 192.168.3.0 0.0.0.255
[Switch-acl-ucl-6001] rule 10 deny ip source ucl-group name group_r destination 192.168.3.0 0.0.0.255
[Switch-acl-ucl-6001] quit
# Configure user ACL-based packet filtering to make the user ACL take effect.
[Switch] traffic-filter inbound acl 6001
Step 5 Configure service schemes service-scheme1 and service-scheme2, and apply the
service schemes to UCL groups group_m and group_r to control the network
access right of each department based on groups.
[Switch] aaa
[Switch-aaa] service-scheme service-scheme1
[Switch-aaa-service-service-scheme1] ucl-group name group_m
[Switch-aaa-service-service-scheme1] quit
[Switch-aaa] service-scheme service-scheme2
[Switch-aaa-service-service-scheme2] ucl-group name group_r
[Switch-aaa-service-service-scheme2] quit
[Switch-aaa] quit
[Switch] quit
NOTE
After the preceding steps are complete, configure the RADIUS server to associate the service
schemes with users.
# Run the display acl all command to view information about the user ACL.
<Switch> display acl all
Total nonempty ACL number is 1
# Run the display ucl-group all command to view information about all UCL
groups.
<Switch> display ucl-group all
ID UCL group name
--------------------------------------------------------------------------------
1 group_m
2 group_r
--------------------------------------------------------------------------------
Total : 2
# The marketing department cannot access the IT department and the R&D
department cannot access the IT department.
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
vlan batch 10 20 30 40
#
authentication-profile name p1
dot1x-access-profile d1
mac-access-profile m1
authentication dot1x-mac-bypass
ucl-group 1 name group_m
ucl-group 2 name group_r
#
radius-server template rd1
radius-server shared-key cipher %^%#zH_B2{mN=177WZ2z+G|5)c'OKD[VaPNYP4>&6uC~%^%#
radius-server authentication 192.168.4.30 1812 weight 80
radius-server retransmit 2
#
acl number 6001
rule 5 deny ip source ucl-group name group_m destination 192.168.3.0 0.0.0.255 rule
10 deny ip source ucl-group name group_r destination 192.168.3.0 0.0.0.255
#
aaa
authentication-scheme abc
authentication-mode radius
service-scheme service-scheme1
ucl-group name group_m
service-scheme service-scheme2
ucl-group name group_r
domain abc11
authentication-scheme abc
radius-server rd1
#
interface Vlanif10
ip address 192.168.1.1 255.255.255.0
#
interface Vlanif20
ip address 192.168.2.1 255.255.255.0
#
interface Vlanif30
ip address 192.168.3.1 255.255.255.0
#
interface Vlanif40
ip address 192.168.4.29 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
authentication-profile p1
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20
authentication-profile p1
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 30
authentication-profile p1
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 40
#
traffic-filter inbound acl 6001
#
dot1x-access-profile name d1
#
mac-access-profile name m1
mac-authen username fixed A-123 password cipher %^%#(!XnF'#X^Sc=[&,fH38!
OKNNEjez>NO`Z*NJK*s4%^%#
#
return
Networking Requirements
As shown in Figure 2-17, users are connected to the Switch through GE0/0/1. The
Switch needs to block certain types of IPv6 packets from users in which the source
IPv6 address is fc01::2/64 and the destination IPv6 address is fc01::1/64.
Figure 2-17 Using advanced ACL6s to filter certain types of IPv6 packets
Configuration Roadmap
The following configurations are performed on the Switch. The configuration
roadmap is as follows:
1. Configure an advanced ACL6 and an ACL6-based traffic classifier to filter the
IPv6 packets in which the source IPv6 address is the host address fc01::2/64
and the destination IPv6 address is fc01::1/64.
2. Configure a traffic behavior to discard the packets matching the ACL6.
3. Configure and apply a traffic policy to make the ACL6 and traffic behavior
take effect.
Procedure
Step 1 Enable the IPv6 forwarding capability, add an interface to a VLAN, and assign an
IPv6 address to the VLANIF interface.
<HUAWEI> system-view
[HUAWEI] sysname Switch
[Switch] ipv6
[Switch] vlan batch 10
[Switch] interface gigabitethernet 0/0/1
[Switch-GigabitEthernet0/0/1] port link-type trunk
[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[Switch-GigabitEthernet0/0/1] quit
[Switch] interface vlanif 10
[Switch-Vlanif10] ipv6 enable
[Switch-Vlanif10] ipv6 address fc01::1 64
[Switch-Vlanif10] quit
Classifier: class1
Operator: OR
Rule(s) : if-match ipv6 acl 3001
# If PC1 cannot access the network, run the display traffic policy statistics
interface gigabitethernet 0/0/1 inbound command on the Switch. The command
output shows that the number of matched packets is the same as the number of
discarded packets. This indicates that packets matching ACL 3001 are all
discarded.
----End
Configuration Files
Switch configuration file
#
sysname Switch
#
ipv6
#
vlan batch 10
#
acl ipv6 number 3001
rule 0 deny ipv6 source FC01::/64 destination FC01::/64
#
traffic classifier class1 operator or
if-match ipv6 acl 3001
#
traffic behavior behav1
deny
statistic enable
#
traffic policy policy1 match-order config
classifier class1 behavior behav1
#
interface Vlanif10
ipv6 enable
ipv6 address FC01::1/64
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
traffic-policy policy1 inbound
#
return
Fault Description
A traffic policy has been configured on a device to redirect packets. To redirect the
packets from a certain IP address, the administrator adds a rule to the ACL used
by the traffic policy following the ACL configuration guidelines. The new rule uses
this source IP address as the matching condition. However, the IP address wildcard
mask in the rule is incorrectly configured. As a result, BGP packets cannot be sent
to the CPU, and most services are interrupted.
Procedure
Step 1 Run the display this command in the ACL view to check the new rule.
The traffic policy using this ACL has been applied to a large number of interfaces,
so all BGP packets received by these interfaces are redirected to other interfaces,
but not sent to the CPU. The device times out to process protocol packets and
most services are interrupted.
Step 2 Run the rule command in the ACL view to modify the IP address wildcard mask in
the new rule.
Services are recovered, and packets from the source IP address of 10.1.1.3 are
redirected correctly.
----End
Fault Description
An ACL is configured on the device to restrict destination addresses accessible to
users; however, the DNS server address is blocked in the ACL. As a result, the
query packets sent from users to the DNS server are discarded. The domain names
cannot be resolved, so users cannot access the Internet.
Procedure
Step 1 Run the display acl command in the system view to check ACL rules.
The following rule is included:
rule 100 deny ip destination 10.102.192.0 0.0.0.255 //Reject the packets from network segment
10.102.192.0/24.
The DNS server address configured on user PCs is 10.102.192.68, which belongs to
the network segment 10.102.192.0/24. Therefore, packets sent from users to the
DNS server are discarded. The domain names cannot be resolved, so users cannot
access the Internet.
Step 2 Run the rule command in the ACL view to add a rule to permit the DNS server
address.
rule 99 permit ip destination 10.102.192.68 0.0.0.0 //Permit the packets destined for the DNS server.
rule 100 deny ip destination 10.102.192.0 0.0.0.255 //Reject the packets destined for network segment
10.102.192.0/24.
After rule 99 is added, the packets sent from users to the DNS server match rule
99 and pass. The domain names can be resolved, and users can access the
Internet.
----End
Fault Description
The system time on the device is incorrect, making the time-based ACL ineffective.
Procedure
Step 1 Run the display acl command in the system view to check ACL rules.
A rule based on the time range is included:
rule 10 deny ip source 10.1.1.1 0 time-range time1 //Reject the packets from 10.1.1.1 in the time range
time1.
Step 2 Run the display time-range { all | time-name } command in the system view to
check the configuration of the time range time1.
The following information is displayed:
Current time is 14:53:17 8-16-2013 Friday
The time range time1 starts at 00:00 on January 1, 2014 and ends at 23:59 on
December 31, 2014, while the system time is 14:53:17 on August 16, 2013, which
is not the actual date (August 16, 2014) and is not within the time range time1.
Therefore, the ACL associated with time1 does not take effect, and packets from
10.1.1.1 are not discarded.
Fault Description
As shown in Figure 2-18, the departments of an enterprise are connected through
the Switch. GE0/0/4 on the Switch is connected to the salary query server. The
enterprise allows only the president office to access the salary query server, but
prevents other departments (such as R&D and marketing departments) from
accessing the salary query server. Therefore, the administrator configures an ACL
and a traffic policy that uses the ACL on the Switch, and applies the traffic policy
to the inbound direction of GE0/0/4. The traffic policy is applied to an incorrect
direction, so access control does not take effect.
Procedure
Step 1 Run the display traffic policy interface [ interface-type interface-number ]
command in any view to check the traffic policy configuration on the interface.
The traffic policy p1 has been applied to the inbound direction of GE0/0/4.
Interface: GigabitEthernet0/0/4
Direction: Inbound
Policy: p1
......
Interface: GigabitEthernet0/0/4
Direction: Inbound
Policy: p1
Classifier: c1
Operator: OR
Rule(s) :
if-match acl 3001
Behavior: b1
Deny
-----------------------------------------------------------
Step 3 Run the display this command in the view of advanced ACL 3001 to check the
ACL rule configuration.
The source IP address is the network segment where the president office resides,
and the destination IP address is the salary query server's address. The ACL rules
meet the packet filtering requirement, so the ACL configuration is correct.
As shown in Step 2, the traffic policy is applied to the inbound direction of the
interface. However, packets from each department do not enter the Switch
through GE0/0/4 but through other interfaces, and the packets are sent out
through GE0/0/4. (The Switch searches for a route after receiving the packets, and
sends the packets out through GE0/0/4.)
Therefore, when the traffic policy using the ACL is applied to the inbound direction
of GE0/0/4, access control does not take effect. To make access control effective,
apply the traffic policy to the outbound direction or apply the traffic policy
globally, to the VLANs of the departments, or to the inbound direction of each
interface connecting to each department.
----End
The permit/deny rules in an ACL and a behavior in the traffic policy are used as
follows.
NOTE
The traffic policy module permits packets by default. If you only want to block mutual
access between network segments, you only need to define the characteristics of the
packets to be denied in the ACL. If you add rule permit at the bottom of the ACL, the
packets that do not match previous rules will match the last rule. In addition, if the traffic
behavior is set to deny, the device discards all packets matching rule permit. As a result, all
services are interrupted.
NOTE
The following commands are only for you reference. You should comply with the command line
syntax of the version running on your device.
● Method 1: Apply a traffic policy to a VLAN.
a. Configure a traffic classifier.
i. Run the traffic classifier classifier-name [ operator { and | or } ]
[ precedence precedence-value ] command in the system view to
enter the traffic classifier view.
ii. Run the if-match acl { acl-number | acl-name } command to apply
an ACL to the traffic classifier.
b. Configure a traffic behavior.
Run the traffic behavior behavior-name command in the system view to
create a traffic behavior and enter the traffic behavior view.
c. Configure a traffic action.
There are two actions for packet filtering: deny and permit. For other
traffic actions, see Configuration Guide - QoS of the corresponding
product version.
d. Configure a traffic policy.
i. Run the traffic policy policy-name [ match-order { auto | config } ]
command in the system view to create a traffic policy and enter the
traffic policy view.
ii. Run the classifier classifier-name behavior behavior-name
command to configure a traffic behavior for the specified traffic
classifier in the traffic policy. That is, bind the traffic behavior to the
classifier.
NOTE
The following commands are only for you reference. You should comply with the command line
syntax of the version running on your device.
Since V200R009, traffic policy can be applied to VLANIF interfaces only on the S5731-H, S5731-
S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and
S6730S-S.
● Method 1: Apply a traffic policy to an interface.
a. Configure a traffic classifier.
i. Run the traffic classifier classifier-name [ operator { and | or } ]
[ precedence precedence-value ] command in the system view to
enter the traffic classifier view.
2.14.4 How Can I Check the Order in Which ACL Rules Take
Effect?
Run the display acl { acl-number | name acl-name | all } or display acl ipv6
{ acl6-number | name acl6-name | all } command in any view or the display this
command in the ACL view to check the order in which ACL rules take effect, as
shown in Table 2-18.
ACL in config mode The rules with smaller IDs take effect
earlier than the rules with larger IDs.
ACL in auto mode The rules with smaller IDs take effect
earlier than the rules with larger IDs.
ACL6 in config mode The rules with smaller IDs take effect
earlier than the rules with larger IDs.
NOTE
When multiple traffic policies using ACLs are applied to a device, if a packet matches the ACL
rules in different traffic policies, the matching order of the ACL rules depends on the processing
mechanism of the traffic policy module. For details, see Configuration Guide - QoS of the
corresponding product version.
the ICMP packet. The device cannot use ACLs to block ping packets from
hosts.
To filter the protocol packets to be sent to the CPU, you can apply an ACL to the
blacklist configured in the local attack defense policy. The configuration procedure
is as follows:
1. Run the cpu-defend policy policy-name command in the system view to
create an attack defense policy.
2. Run the blacklist blacklist-id acl acl-number command to create a blacklist.
3. Run the cpu-defend-policy policy-name [ global ] command in the system
view or run the cpu-defend-policy policy-name command in the slot view to
apply the attack defense policy.
● IPSec
a. When permit is used in the ACL rule, the system uses IPSec policies to
protect traffic matching the ACL rule, and then forwards the traffic.
b. When deny is used in the ACL rule, the system will not use IPSec policies
to protect traffic matching the ACL rule, and directly forward the traffic.
c. When an ACL does not contain rules, the IPSec policy referencing the ACL
does not take effect. That is, the system forwards the packets passing the
interface without performing any operation.
● Firewall
a. When permit is used in the ACL rule:
▪ When the ACL is applied to the inbound traffic, the system forwards
the packets matching the ACL rule sent from the low-priority zone to
the high-priority zone.
▪ When the ACL is applied to the inbound traffic, the system discards
the packets matching the ACL rule sent from the low-priority zone to
the high-priority zone.
▪ When the ACL is applied to the outbound traffic, the system discards
the packets matching the ACL rule sent from the high-priority zone
to the low-priority zone.
c. When an ACL does not contain rules:
▪ When the ACL is applied to the inbound traffic, the ACL does not
take effect, and the system discards all packets sent from the low-
priority zone to the high-priority zone.
▪ When the ACL is applied to the outbound traffic, the ACL does not
take effect, and the system discards all packets sent from the high-
priority zone to the low-priority zone.
● NAT
a. When permit is used in the ACL rule, the system uses the address pool to
translate addresses for the packets of which the source IP address is
specified in the ACL rule.
b. When deny is used in the ACL rule or the ACL does not contain rules, the
NAT policy referencing the ACL does not take effect. That is, the system
searches routes for packets, but does not translate addresses.
● Telnet
a. When permit is used in the ACL rule:
▪ If the ACL is applied in the outbound direction, the local device can
access other devices that match the ACL rule.
▪ If the ACL is applied in the inbound direction, any other devices can
access the local device.
▪ If the ACL is applied in the outbound direction, the local device can
access any other devices.
● HTTP
a. The device with the specified source IP address can establish an HTTP
connection with the local device only when permit is used in the ACL
rule.
b. When deny is used in the ACL rule, other devices cannot establish HTTP
connections with the local device.
c. When the ACL rule is configured but packets from other devices do not
match the rule, other devices cannot establish HTTP connections with the
local device.
d. When the ACL contains no rule, any other devices can establish HTTP
connections with the local device.
● FTP
a. The device with the specified source IP address can establish an FTP
connection with the local device only when permit is used in the ACL
rule.
b. When deny is used in the ACL rule, other devices cannot establish FTP
connections with the local device.
c. When the ACL rule is configured but packets from other devices do not
match the rule, other devices cannot establish FTP connections with the
local device.
d. When the ACL contains no rule, any other devices can establish FTP
connections with the local device.
● TFTP
a. The device with the specified source IP address can establish a TFTP
connection with the local device only when permit is used in the ACL
rule.
b. When deny is used in the ACL rule, the local device cannot establish TFTP
connections with other devices.
c. When the ACL rule is configured but packets from other devices do not
match the rule, other devices cannot establish TFTP connections with the
local device.
d. When the ACL contains no rule, the local device can establish TFTP
connections with any other devices.
● SNMP
a. When permit is used in the ACL rule, an NMS with a specified source IP
address can access the local device.
b. When deny is used in the ACL rule, the local device rejects access from
other NMS.
c. When the ACL does not contain rules, the local device access from any
other NMS.
● NTP
a. When permit is used in the ACL rule, the ntp-service access command
takes effect.
b. When deny is used in the ACL rule, the ntp-service access command
does not take effect.
c. When the ACL does not contain rules, the ntp-service access command
does not take effect.