- Table of Contents
-
- H3C WX3000 Series Unified Switches Switching Engine Command Reference-6W103
- 00-Preface
- 01-CLI Command
- 02-Login Command
- 03-Configuration File Management Command
- 04-VLAN Command
- 05-Auto Detect Command
- 06-Voice VLAN Command
- 07-GVRP Command
- 08-Basic Port Configuration Command
- 09-Link Aggregation Command
- 10-Port Isolation Command
- 11-Port Security-Port Binding Command
- 12-DLDP Command
- 13-MAC Address Table Management Command
- 14-MSTP Command
- 15-802.1x and System Guard Command
- 16-AAA Command
- 17-MAC Address Authentication Command
- 18-IP Address and Performance Command
- 19-DHCP Command
- 20-ACL Command
- 21-QoS-QoS Profile Command
- 22-Mirroring Command
- 23-ARP Command
- 24-SNMP-RMON Command
- 25-Multicast Command
- 26-NTP Command
- 27-SSH Command
- 28-File System Management Command
- 29-FTP-SFTP-TFTP Command
- 30-Information Center Command
- 31-System Maintenance and Debugging Command
- 32-VLAN-VPN Command
- 33-HWPing Command
- 34-DNS Command
- 35-Smart Link-Monitor Link Command
- 36-PoE-PoE Profile Command
- 37-Routing Protocol Command
- 38-UDP Helper Command
- 39-Index
- Related Documents
-
Title | Size | Download |
---|---|---|
20-ACL Command | 102.29 KB |
Table of Contents
The device supports basic ACLs, advanced ACLs, and Layer 2 ACLs.
ACL Configuration Commands
acl
Syntax
acl number acl-number [ match-order { auto | config } ]
undo acl { all | number acl-number }
View
System view
Parameters
all: Specifies to remove all ACLs.
number acl-number: Specifies the number of an existing access control list (ACL) or an ACL to be defined. ACL number identifies the type of an ACL as follows.
l An ACL number in the range 2000 to 2999 identifies a basic ACL.
l An ACL number in the range 3000 to 3999 identifies an advanced ACL. Note that 3998 and 3999 cannot be configured because they are reserved for cluster management.
l An ACL number in the range 4000 to 4999 identifies a layer 2 ACL.
match-order: Specifies the match order for ACL rules. Following two match orders exist.
l auto: Specifies to match ACL rules according to the depth-first rule.
l config: Specifies to match ACL rules in the order they are defined.
Note that the match-order keyword is not available to Layer 2 ACLs. The match order for layer 2 ACLs can only be config.
Description
Use the acl command to define an ACL and enter the corresponding ACL view.
Use the undo acl command to remove all the rules of the specified ACL or all the ACLs.
By default, ACL rules are matched in the order they are defined.
Only after the rules in an existing ACL are fully removed can you modify the match order of the ACL.
In ACL view, you can use the rule command to add rules to the ACL.
Related commands: rule.
Examples
# Define ACL 2000 and specify “depth-first” as the match order.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] acl number 2000 match-order auto
[device-acl-basic-2000]
description
Syntax
description text
undo description
View
Basic ACL view, advanced ACL view, Layer 2 ACL view
Parameters
text: Description string to be assigned to an ACL, a string of 1 to 127 characters.
Description
Use the description command to assign a description string to an ACL.
Use the undo description to remove the description string of the ACL.
By default, no description string is assigned for an ACL.
Examples
# Assign a description string to ACL 3000.
<device> system-view
[device] acl number 3000
[device-acl-adv-3000] description This acl is used in GEth 1/0/1
# Remove the description string of ACL 3000.
[device-acl-adv-3000] undo description
display acl
Syntax
display acl { all | acl-number }
View
Any view
Parameters
all: Displays all ACLs.
acl-number: Number of the ACL to be displayed, in the range of 2000 to 4999.
Description
Use the display acl command to display the configuration of a specified or all ACLs.
Examples
# Display information about ACL 2000.
<device> display acl 2000
Basic ACL 2000, 1 rule
Acl's step is 1
rule 0 permit
Table 1-1 display acl command output description
Field |
Description |
Basic ACL 2000 |
The displayed information is about the basic ACL 2000. |
1 rule |
The ACL includes one rule. |
Acl's step is 1 |
The step for rules of this ACL is 1. |
display acl remaining entry
Syntax
display acl remaining entry
View
Any view
Parameters
None
Description
Use the display acl remaining entry command to display information about the remaining ACL resources.
According to the output, you can determine the number of resources consumed by a certain type of ACL rules and whether the exhaustion of resources causes the failure to assign ACL rules.
Examples
# Display information about the remaining ACL resources.
<device> display acl remaining entry
Resource Total Reserved Configured Remaining Start End
Type Number Number Number Number Port Name Port Name
--------------------------------------------------------------------------
RULE/MASK 1024 64 1 959 GE1/0/1 GE1/0/24
COUNTER 32 0 0 32 GE1/0/1 GE1/0/24
METER 256 0 0 256 GE1/0/1 GE1/0/24
Table 1-2 display acl remaining entry command output description
Field |
Description |
Resource Type |
Resource type, including: l RULE/MASK: number of rule resources that the device can assign; l CONUTER: number of traffic statistics resources that the device can assign; l METER: number of traffic limit resources that the device can assign. |
Total Number |
Total number of ACL resources |
Reserved Number |
Number of resources reserved for system initialization |
Configured Number |
Number of resources configured for user-defined ACLs |
Remaining Number |
Number of remaining resources |
Start Port Name End Port Name |
Start port number and end port number corresponding to the entry |
display packet-filter
Syntax
display packet-filter { global | interface interface-type interface-number | port-group [ group-id ] | unitid unit-id | vlan [ vlan-id ] }
View
Any view
Parameters
global: Displays information about global packet filtering.
interface interface-type interface-number: Displays information about packet filtering on the port specified by interface-type and interface-number.
port-group group-id: Displays information about packet filtering on the port group specified by group-id
unitid unit-id: Displays information about packet filtering on the unit specified by unit-id. The unit ID can be set only to 1.
vlan vlan-id: Displays information about packet filtering on the VLAN specified by vlan-id.
Description
Use the display packet-filter command to display information about packet filtering.
Examples
# Display information about packet filtering on the device.
<device> display packet-filter unitid 1
GigabitEthernet1/0/1
Inbound:
Acl 2000 rule 0 running
Table 1-3 display packet-filter command output description
Field |
Description |
GigabitEthernet1/0/1 |
Packet filtering is performed on GigabitEthernet1/0/1. |
Inbound |
Packet filtering is performed in the inbound direction. |
Acl 2000 rule 0 |
The rule 0 of ACL 2000 is used. |
running |
The ACL rule is running. |
display time-range
Syntax
display time-range { all | time-name }
View
Any view
Parameters
all: Displays all time ranges.
time-name: Name of a time range, a string of 1 to 32 characters that starts with a to z or A to Z.
Description
Use the display time-range command to display the configuration and status of a time range or all the time ranges. For active time ranges, this command displays “Active”; for inactive time ranges, this command displays “Inactive”.
Related commands: time-range.
Examples
# Display all time ranges.
<device> display time-range all
Current time is 14:36:36 Apr/2/2003 Thursday
Time-range : tr ( Active )
12:00 to 18:00 working-day
Time-range : tr1 ( Inactive )
From 08:30 Feb/5/2003 to 18:00 Feb/19/2003
Table 1-4 display time-range command output description
Field |
Description |
Current time is 14:36:36 Apr/3/2003 Thursday |
Current system time |
Time-range |
Name of the time range |
Active |
The time range is active currently (Inactive means the time range is inactive) |
12:00 to 18:00 working-day |
The periodic time range is from 12:00 to 18:00 on each working day. |
From 08:30 Feb/5/2005 to 18:00 Feb/19/2005 |
The absolute time range is from 08:30 2/5/2005 to 18:00 2-19-2005. |
packet-filter
Syntax
packet-filter inbound acl-rule
undo packet-filter inbound acl-rule
View
System view, Ethernet port view, Port group view
Parameters
inbound: Filters inbound packets.
acl-rule: ACL/ACL rules to be applied. This argument can be one of those listed in Table 1-5.
Table 1-5 Combined application of ACLs
Combination mode |
The acl-rule argument |
Apply all the rules of an ACL that is of IP type (The ACL can be a basic ACL or an advanced ACL.) |
ip-group acl-number |
Apply a rule of an ACL that is of IP type |
ip-group acl-number rule rule-id |
Apply all the rules of a Layer 2 ACL |
link-group acl-number |
Apply a rule of a Layer 2 ACL |
link-group acl-number rule rule-id |
Apply a rule of an ACL that is of IP type and a rule of a Layer 2 ACL |
ip-group acl-number rule rule-id link-group acl-number rule rule-id |
In Table 1-5:
l The ip-group acl-number keyword specifies a basic or an advanced ACL. The acl-number argument ranges from 2000 to 3999.
l The link-group acl-number keyword specifies a Layer 2 ACL. The acl-number argument ranges from 4000 to 4999.
l The rule rule-id keyword specifies a rule of an ACL. The rule argument ranges from 0 to 65534. If you do not specify this argument, all the rules of the ACL are applied.
Description
Use the packet-filter command to assign an ACL globally, to a port, or in a port group to filter inbound packets.
Use the undo packet-filter command to cancel the assignment of an ACL.
Examples
# Assign ACL 2000 to GigabitEthernet 1/0/1 to filter inbound packets.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] interface GigabitEthernet1/0/1
[device-GigabitEthernet1/0/1] packet-filter inbound ip-group 2000
packet-filter vlan
Syntax
packet-filter vlan vlan-id inbound acl-rule
undo packet-filter vlan vlan-id inbound acl-rule
View
System view
Parameters
vlan-id: VLAN ID.
inbound: Specifies to filter packets received by the ports in the VLAN.
acl-rule: ACL rules to be applied, which can be a combination of the rules of multiple ACLs, as described in Table 1-5.
Description
Use the packet-filter vlan command to assign an ACL to filter the inbound packets belonging to a VLAN on all ports
Use the undo packet-filter vlan command to remove an ACL assigned to a VLAN.
Examples
# Assign ACL 2000 to filter the inbound packets belonging to VLAN 10 on all ports.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] packet-filter vlan 10 inbound ip-group 2000
rule (for Basic ACLs)
Syntax
rule [ rule-id ] { deny | permit} [ rule-string ]
undo rule rule-id [ fragment | source | time-range ]*
View
Basic ACL view
Parameters
Parameters of the rule command
rule-id: ACL rule ID, in the range of 0 to 65534.
deny: Drops the matched packets.
permit: Permits the matched packets.
rule-string: ACL rule information, which can be a combination of the parameters described in Table 1-6.
Table 1-6 Parameters for basic IPv4 ACL rules
Parameter |
Function |
Description |
source { sour-addr sour-wildcard | any } |
Specifies a source address. |
The sour-addr sour-wildcard argument specifies a source IP address in dotted decimal notation. Setting the wildcard to a zero indicates a host address. The any keyword indicates any source IP address. |
fragment |
Indicates that the rule applies to fragments. |
— |
time-range time-name |
Specifies the time range in which the rule takes effect. |
time-name: specifies the name of the time range in which the rule is active; a string comprising 1 to 32 characters. |
sour-wildcard is the complement of the wildcard mask of the source subnet mask. For example, you need to input 0.0.255.255 to specify the subnet mask 255.255.0.0.
Parameters of the undo rule command
rule-id: Rule ID, which must the ID of an existing ACL rule. You can obtain the ID of an ACL rule by using the display acl command.
fragment: Removes the settings concerning fragments in the ACL rule.
source: Removes the settings concerning source address in the ACL rule.
time-range: Removes the settings concerning time range in the ACL rule.
Description
Use the rule command to define an ACL rule.
Use the undo rule command to remove an ACL rule or specified settings of an ACL rule.
To remove an ACL rule using the undo rule command, you need to provide the ID of the ACL rule. If no other arguments are specified, the entire ACL rule is removed. Otherwise, only the specified information of the ACL rule is removed.
Note that:
l If you do not specify the rule-id argument when creating an ACL rule, the rule will be numbered automatically. If the ACL has no rules, the rule is numbered 0; otherwise, it is the maximum rule number plus one.
l The content of a modified or created rule cannot be identical with the content of any existing rule; otherwise the rule modification or creation will fail, and the system prompts that the rule already exists.
l With the auto match order specified, the newly created rules will be inserted in the existent ones by depth-first principle, but the numbers of the existent rules are unaltered.
Examples
# Configure ACL 2000 to deny packets whose source IP addresses are 192.168.0.1.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] acl number 2000
[device-acl-basic-2000] rule deny source 192.168.0.1 0
rule (for Advanced ACLs)
Syntax
rule [ rule-id ] { deny | permit } protocol [ rule-string ]
undo rule rule-id [ destination | destination-port | dscp | fragment | icmp-type | precedence | source | source-port | time-range | tos ]*
View
Advanced ACL view
Parameters
Parameters of the rule command
rule-id: ACL rule ID, in the range of 0 to 65534.
deny: Drops the matched packets.
permit: Permits the matched packets.
protocol: Protocol carried by IP. When the protocol is represented by numeral, it ranges from 1 to 255; when the protocol is represented by name, it can be gre, icmp, igmp, ip, ipinip, ospf, tcp, and udp.
rule-string: ACL rule information, which can be a combination of the parameters described in Table 1-7.
Table 1-7 Arguments/keywords available to the rule-string argument
Arguments/Keywords |
Type |
Function |
Description |
source { sour-addr sour-wildcard | any } |
Source address |
Specifies the source address information for the ACL rule |
The sour-addr sour-wildcard arguments specify the source address of the packets, expressed in dotted decimal notation. You can specify the IP address of a host as the source address by providing 0 for the sour-wildcard argument. The any keyword specifies any source address. |
destination { dest-addr dest-wildcard | any } |
Destination address |
Specifies the destination address information for the ACL rule |
The dest-addr dest-wildcard arguments specify the destination address of the packets, expressed in dotted decimal notation. You can specify the IP address of a host as the destination address by providing 0 for the dest-wildcard argument. The any keyword specifies any destination address. |
precedence precedence |
Packet priority |
Specifies an IP precedence. |
The precedence argument can be a number in the range 0 to 7. |
tos tos |
Packet priority |
Specifies a ToS preference. |
The tos argument can be a number in the range 0 to 15. |
dscp dscp |
Packet priority |
Specifies a DSCP priority. |
The dscp argument can be a number in the range 0 to 63. |
fragment |
Fragment information |
Indicates that the rule applies to fragments. |
— |
time-range time-name |
Time range information |
Specifies the time range in which the rule takes effect. |
time-name: specifies the name of the time range in which the rule is active; a string comprising 1 to 32 characters. |
The sour-wildcard/dest-wildcard argument is the complement of the wildcard mask of the source/destination subnet mask. For example, you need to input 0.0.255.255 to specify the subnet mask 255.255.0.0.
If you specify the dscp keyword, you can directly input a value ranging from 0 to 63 or input one of the keywords listed in Table 1-8 as DSCP.
Table 1-8 DSCP values and the corresponding keywords
Keyword |
DSCP value in decimal |
DSCP value in binary |
af11 |
10 |
001010 |
af12 |
12 |
001100 |
af13 |
14 |
001110 |
af21 |
18 |
010010 |
af22 |
20 |
010100 |
af23 |
22 |
010110 |
af31 |
26 |
011010 |
af32 |
28 |
011100 |
af33 |
30 |
011110 |
af41 |
34 |
100010 |
af42 |
36 |
100100 |
af43 |
38 |
100110 |
be |
0 |
000000 |
cs1 |
8 |
001000 |
cs2 |
16 |
010000 |
cs3 |
24 |
011000 |
cs4 |
32 |
100000 |
cs5 |
40 |
101000 |
cs6 |
48 |
110000 |
cs7 |
56 |
111000 |
ef |
46 |
101110 |
If you specify the precedence keyword, you can directly input a value ranging from 0 to 7 or input one of the keywords listed in Table 1-9 as IP precedence.
Table 1-9 IP precedence values and the corresponding keywords
Keyword |
IP Precedence in decimal |
IP Precedence in binary |
routine |
0 |
000 |
priority |
1 |
001 |
immediate |
2 |
010 |
flash |
3 |
011 |
flash-override |
4 |
100 |
critical |
5 |
101 |
internet |
6 |
110 |
network |
7 |
111 |
If you specify the tos keyword, you can directly input a value ranging from 0 to 15 or input one of the keywords listed in Table 1-10 as the ToS value.
Table 1-10 ToS value and the corresponding keywords
Keyword |
ToS in decimal |
ToS in binary |
normal |
0 |
0000 |
min-monetary-cost |
1 |
0001 |
max-reliability |
2 |
0010 |
max-throughput |
4 |
0100 |
min-delay |
8 |
1000 |
If the protocol type is TCP or UDP, you can also define the information listed in Table 1-11.
Table 1-11 TCP/UDP-specific ACL rule information
Parameter |
Type |
Function |
Description |
source-port operator port1 [ port2 ] |
Source port |
Defines the source port information of UDP/TCP packets |
The value of operator can be lt (less than), gt (greater than), eq (equal to), neq (not equal to) or range (within the range of). Only the range operator requires two port numbers as the operands. Other operators require only one port number as the operand. port1 and port2: TCP/UDP port number(s), expressed as port names or port numbers. When expressed as numerals, the value range is 0 to 65535. |
destination-port operator port1 [ port2 ] |
Destination port |
Defines the destination port information of UDP/TCP packets |
|
established |
TCP connection flag |
Specifies that the rule is applicable only to the first SYN segment for establishing a TCP connection |
TCP-specific argument |
If TCP or UDP port number is represented by name, you can also define the information listed in Table 1-12.
Table 1-12 TCP or UDP port values
Type |
Value |
TCP |
CHARgen (19), bgp (179), cmd (514), daytime (13), discard (9), domain (53), echo (7), exec (512), finger (79), ftp (21), ftp-data (20), gopher (70), hostname (101), irc (194), klogin (543), kshell (544), login (513), lpd (515), nntp (119), pop2 (109), pop3 (110), smtp (25), sunrpc (111), tacacs (49), talk (517), telnet (23), time (37), uucp (540), whois (43), www (80) |
UDP |
biff (512), bootpc (68), bootps (67), discard (9), dns (53), dnsix (90), echo (7), mobilip-ag (434), mobilip-mn (435), nameserver (42), netbios-dgm (138), netbios-ns (139), netbios-ssn (139), ntp (123), rip (520), snmp (161), snmptrap (162), sunrpc (111), syslog (514), tacacs-ds (65), talk (517), tftp (69), time (37), who (513), xdmcp (177) |
Note the following when assigning an advanced ACL to the hardware on a device:
l The precedence and tos keywords are not supported.
l When defining ACL rules for TCP/UDP packets, operator (in Table 1-11) can only be “eq”.
If the protocol type is ICMP, you can also define the information listed in Table 1-13.
Table 1-13 ICMP-specific ACL rule information
Parameter |
Type |
Function |
Description |
icmp-type icmp-type icmp-code |
Type and message code information of ICMP packets |
Specifies the type and message code information of ICMP packets in the ACL rule |
icmp-type: ICMP message type, ranging from 0 to 255 icmp-code: ICMP message code, ranging from 0 to 255 |
If the protocol type is ICMP, you can also just input the ICMP message name after the icmp-type keyword. Table 1-14 lists some common ICMP messages.
Name |
ICMP type |
ICMP code |
echo |
Type=8 |
Code=0 |
echo-reply |
Type=0 |
Code=0 |
fragmentneed-DFset |
Type=3 |
Code=4 |
host-redirect |
Type=5 |
Code=1 |
host-tos-redirect |
Type=5 |
Code=3 |
host-unreachable |
Type=3 |
Code=1 |
information-reply |
Type=16 |
Code=0 |
information-request |
Type=15 |
Code=0 |
net-redirect |
Type=5 |
Code=0 |
net-tos-redirect |
Type=5 |
Code=2 |
net-unreachable |
Type=3 |
Code=0 |
parameter-problem |
Type=12 |
Code=0 |
port-unreachable |
Type=3 |
Code=3 |
protocol-unreachable |
Type=3 |
Code=2 |
reassembly-timeout |
Type=11 |
Code=1 |
source-quench |
Type=4 |
Code=0 |
source-route-failed |
Type=3 |
Code=5 |
timestamp-reply |
Type=14 |
Code=0 |
timestamp-request |
Type=13 |
Code=0 |
ttl-exceeded |
Type=11 |
Code=0 |
Parameters of the undo rule command
rule-id: Rule ID, which must the ID of an existing ACL rule. You can obtain the ID of an ACL rule by using the display acl command.
source: Removes the settings concerning the source address in the ACL rule.
source-port: Removes the settings concerning the source port in the ACL rule. This keyword is only available to the ACL rules with their protocol types set to TCP or UDP.
destination: Removes the settings concerning the destination address in the ACL rule.
destination-port: Removes the settings concerning the destination port in the ACL rule. This keyword is only available to the ACL rules with their protocol types set to TCP or UDP.
icmp-type: Removes the settings concerning the ICMP type and message code in the ACL rule. This keyword is only available to the ACL rules with their protocol type set to ICMP.
precedence: Removes the precedence-related settings in the ACL rule.
tos: Removes the ToS-related settings in the ACL rule.
dscp: Removes the DSCP-related settings in the ACL rule.
time-range: Removes the time range settings in the ACL rule.
fragment: Removes the settings concerning fragments in the ACL rule.
Description
Use the rule command to define an ACL rule.
Use the undo rule command to remove an ACL rule or specified settings of an ACL rule.
To remove an ACL rule using the undo rule command, you need to provide the ID of the ACL rule. If no other arguments are specified, the entire ACL rule is removed. Otherwise, only the specified information of the ACL rule is removed.
Note that:
l If you do not specify the rule-id argument when creating an ACL rule, the rule will be numbered automatically. If the ACL has no rules, the rule is numbered 0; otherwise, it is the maximum rule number plus one.
l The content of a modified or created rule cannot be identical with the content of any existing rules; otherwise the rule modification or creation will fail, and the system prompts that the rule already exists.
l If the ACL is created with the auto keyword specified, the newly created rules will be inserted in the existent ones by depth-first principle, but the numbers of the existent rules are unaltered.
Examples
# Configure ACL 3000 to permit the TCP packets sourced from the network 129.9.0.0/16 and destined for the network 202.38.160.0/24 and with the destination port number being 80.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] acl number 3000
[device-acl-adv-3000] rule permit tcp source 129.9.0.0 0.0.255.255 destination 202.38.160.0 0.0.0.255 destination-port eq 80
rule (for Layer 2 ACLs)
Syntax
rule [ rule-id ] { deny | permit } [ rule-string ]
undo rule rule-id
View
Layer 2 ACL view
Parameters
rule-id: ACL rule ID, in the range of 0 to 65534.
deny: Drops the matched packets.
permit: Permits the matched packets.
rule-string: ACL rule information, which can be a combination of the arguments/keywords described in Table 1-15.
Table 1-15 Layer 2 ACL rule information
Parameter |
Type |
Function |
Description |
format-type |
Link layer encapsulation type |
Specifies the link layer encapsulation type in the rule |
This argument can be 802.3/802.2, 802.3, ether_ii, or snap. |
lsap lsap-code lsap-wildcard |
lsap field |
Specifies the lsap field for the ACL rule |
lsap-code: Encapsulation format of data frames, a 16-bit hexadecimal number. lsap-wildcard: Mask of the lsap value, a 16-bit hexadecimal number used to specify the mask bits. |
source { source-mac-addr source-mac-mask | vlan-id }* |
Source MAC address information or source VLAN information |
Specifies the source MAC address range or source VLAN ID for the ACL rule |
source-mac-addr: Source MAC address, in the format of H-H-H. source-mac-mask: Mask of the source MAC address, in the format of H-H-H. vlan-id: Source VLAN ID, in the range of 1 to 4,094. |
dest dest-mac-addr dest-mac-mask |
Destination MAC address information |
Specifies the destination MAC address range for the ACL rule |
dest-mac-addr: Destination MAC address, in the format of H-H-H. dest-mac-mask: Mask of the destination MAC address, in the format of H-H-H. |
cos cos |
Priority |
Specifies the 802.1p priority of the rule |
cos: VLAN priority, in the range of 0 to 7. |
time-range time-name |
Time range information |
Specifies the time range in which the rule takes effect. |
time-name: specifies the name of the time range in which the rule is active; a string comprising 1 to 32 characters. |
type protocol-type protocol-mask |
Protocol type of Ethernet frames |
Specifies the protocol type of Ethernet frames for the ACL rule |
protocol-type: Protocol type. protocol-mask: Protocol type mask. |
As for Layer 2 ACLs to be assigned to the hardware, the device does not support ACL rules with the format-type argument or the lsap keyword specified.
Description
Use the rule command to define an ACL rule.
Use the undo rule command to remove an ACL rule.
To remove an ACL rule using the undo rule command, you need to provide the ID of the ACL rule. You can obtain the ID of an ACL rule by using the display acl command.
Note that:
l You can modify any existent rule of the Layer2 ACL and the unmodified part of the ACL remains.
l If you do not specify the rule-id argument when creating an ACL rule, the rule will be numbered automatically. If the ACL has no rules, the rule is numbered 0; otherwise, it is the maximum rule number plus one.
l The content of a modified or created rule cannot be identical with the content of any existing rules; otherwise the rule modification or creation will fail, and the system prompts that the rule already exists.
Examples
# Configure ACL 4000 to deny packets sourced from the MAC address 000d-88f5-97ed, destined for the MAC address 0011-4301-991e, and with their 802.1p priority being 3.
<device> system-view
[device] acl number 4000
[device-acl-ethernetframe-4000] rule deny cos 3 source 000d-88f5-97ed ffff-ffff-ffff dest 0011-4301-991e ffff-ffff-ffff
rule comment
Syntax
rule rule-id comment text
undo rule rule-id comment
View
Advanced ACL view, Layer 2 ACL view
Parameters
rule-id: ID of the ACL rule, in the range of 0 to 65534.
text: Comment for the ACL rule, a string of 1 to 127 characters.
Description
Use the rule comment command to define a comment for the ACL rule.
Use the undo rule comment command to remove the comment defined for the ACL rule.
By default, an ACL rule has no comment.
Before defining a comment for an ACL rule, make sure that the ACL rule exists.
Examples
# Define the comment “test” for rule 0 of ACL 3000.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] acl number 3000
[device-acl-adv-3000] rule 0 comment test
time-range
Syntax
time-range time-name { start-time to end-time days-of-the-week [ from start-time start-date ] [ to end-time end-date ] | from start-time start-date [ to end-time end-date ] | to end-time end-date }
undo time-range { all | name time-name [ start-time to end-time days-of-the-week [ from start-time start-date ] [ to end-time end-date ] | from start-time start-date [ to end-time end-date ] | to end-time end-date ] }
View
System view
Parameters
all: Removes all the time ranges.
time-name: Name of a time range, a case insensitive string of 1 to 32 characters that starts with a to z or A to Z. To avoid confusion, it cannot be all.
start-time: Start time of a periodic time range, in the form of hh:mm.
end-time: End time of a periodic time range, in the form of hh:mm. The end time must be greater than the start time.
days-of-the-week: Day of the week when the periodic time range is active. You can provide this argument in one of the following forms.
l Numeral (0 to 6)
l Mon, Tue, Wed, Thu, Fri, Sat, and Sun
l Working days (Monday through Friday)
l Off days (Saturday and Sunday)
l Daily, namely everyday of the week
from start-time start-date: Specifies the start date of an absolute time range, in the form of hh:mm MM/DD/YYYY or hh:mm YYYY/MM/DD. The start-time start-date and end-time end-date argument jointly define a period in which the absolute time range takes effect. If the start date is not specified, the time range starts from 1970/01/01 00:00.
to end-time end-date: Specifies the end date of an absolute time range, in the form of hh:mm MM/DD/YYYY or hh:mm YYYY/MM/DD. The start-time start-date and end-time end-date argument jointly define a period in which the absolute time range takes effect. If the end date is not specified, the time range ends at 2100/12/31 23:59.
Description
Use the time-range command to define a time range.
Use the undo time-range command to remove the specified or all time ranges.
Note that:
l If only a periodic time section is defined in a time range, the time range is active only when the system time is within the defined periodic time section. If multiple periodic time sections are defined in a time range, the time range is active only when the system time is within one of the periodic time sections.
l If only an absolute time section is defined in a time range, the time range is active only when the system time is within the defined absolute time section. If multiple absolute time sections are defined in a time range, the time range is active only when the system time is within one of the absolute time sections.
l If both a periodic time section and an absolute time section are defined in a time range, the time range is active only when the periodic time range and the absolute time range are both matched. Assume that a time range defines an absolute time section from 00:00 January 1, 2004 to 23:59 December 31, 2004, and a periodic time section from 12:00 to 14:00 every Wednesday. This time range is active only when the system time is within 12:00 to 14:00 every Wednesday in 2004.
Examples
# Define an absolute time range that is active from 12:00 January 1, 2000 to 12:00 January 1, 2001.
<device> system-view
System View: return to User View with Ctrl+Z.
[device] time-range test from 12:00 1/1/2000 to 12:00 1/1/2001