---
title: ACL Configuration
slug: enterprise-v5p2/6z-Q-acl-configuration
description: security configuration
createdAt: 2025-11-14T03:58:40.258Z
---

### <font color="#1d50a2">show acl table</font>

**\[Command]**
**show acl table \[** *table\_name* **]**

**\[Purpose]**
Show existing ACL tables

**\[Parameter]**

| **Parameter** | **Description**        |
| ------------- | ---------------------- |
| *table\_name* | Specify the table name |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show acl table
Name        Type     Binding   Description  Stage
------- ----------- --------- ------------- -------
TABLE_2      L3      Ethernet8 TABLE_2      ingress
```

### <font color="#1d50a2">show acl rule</font>

**\[Command]**
**show acl rule \[** *table\_name* **] \[** *rule\_id* **]**

**\[Purpose]**
Show existing ACL rules

**\[Parameter]**

| **Parameter** | **Description**        |
| ------------- | ---------------------- |
| *table\_name* | Specify the table name |
| *rule\_id*    | Specify the rule name  |

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show acl rule
Table     Rule         Priority  Action  Match
------- ------------ ---------- -------- -----------------------
DATAACL  RULE_1        9999        DROP   SRC_IP: 10.0.0.2/32
DATAACL  RULE_2        9998        DROP   DST_IP: 192.168.0.16/32
DATAACL  RULE_3        9997        DROP   L4_SRC_PORT: 4661
DATAACL  RULE_4        9996        DROP   IP_PROTOCOL: 126
DATAACL  RULE_13       9987        DROP   IP_PROTOCOL: 1

sonic# show acl rule TABLE_1 RULE_1
Table   Rule        Priority  Action  Match
------- ------ ---------- -------- --------------------
TABLE_1 RULE_1      100       DROP    SRC_IP: 200.0.0.2/24
```

### <font color="#1d50a2">show counters acl</font>

**\[Command]**
**show counters acl \[** *acl\_table\_name* **] \[** *rule\_id* **]**

**\[Purpose]**
Show ACL hit count

**\[Parameter]**

| **Parameter**      | **Description** |
| ------------------ | --------------- |
| *acl\_table\_name* | ACL Table Name  |
| *rule\_id*         | rule id         |

**\[View]**
System view

**\[Notes]**
Allows multiple tables and rules to be entered, either as individual tables or as table + rule.
Table and table are separated by ",", rule and rule are separated by ","; table and rule are separated by spaces.

**\[Use Cases]**

```plaintext
sonic# show counters acl TABLE_1,TABLE_2
RULE NAME   TABLE NAME     PRIO    PACKETS COUNT  BYTES COUNT
----------- ------------ ------ --------------- -------------
RULE_1      TABLE_1         100     N/A            N/A
rule_2      TABLE_2          2      N/A            N/A
rule_1      TABLE_2          1      N/A            N/A
```

### <font color="#1d50a2">clear counters acl</font>

**\[Command]**
**clear counters acl**

**\[Purpose]**
Clear ACL hit count

**\[Use Cases]**

```plaintext
sonic# clear counters acl
```

### <font color="#1d50a2">access-list</font>

**\[Command]**
**access-list \{** *table\_type* **} \{** *table\_name* **} \{** *table\_stage* **}**
**no access-list \{** *table\_name* **}**

**\[Purpose]**
Create ACL table and enter ACL view

**\[Parameter]**

| **Parameter**  | **Description**                                        |
| -------------- | ------------------------------------------------------ |
| *table\_type*  | ACL table type, optional L3, L3v6, CTRLPLANE           |
| *table\_name*  | ACL Table Name                                         |
| *table\_stage* | Specify the inbound/outbound direction, ingress/egress |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list l3 TABLE_1 ingress
```

### <font color="#1d50a2">rule</font>

**\[Command]**
**rule \{rule\_id** *rule\_id* **} \[\{packet-action \{deny|permit|trap-to-cpu|copy-to-cpu}|redirect-action}]  \[src-mac** *src\_mac* **]  \[ethernet-type** *ethernet\_type* **] \[vlan-pri** *vlan\_pri* **]  \[src-ip** *src\_ip* **]  \[dst-ip** *dst\_ip* **]  \[icmp-type** *icmp\_type* **]  \[icmp-code** *icmp\_code* **]  \[icmp-name** *icmp\_name* **]  \[src-port** *src\_port* **]  \[dst-port** *dst\_port* **]  \[ip-type** *ip\_type* **]**
**no rule \{** *rule\_id* **}**

**\[Purpose]**
Add ACL rules

**\[Parameter]**

| **Parameter**      | **Description**                                                                                                                                                                                                                                                |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *rule\_id*         | Rule ID, value range: 0-500; simultaneously indicates rule priority (higher numbers indicate higher priority), values must be unique                                                                                                                           |
| **packet\_action** | Packet processing actions for matched rules:<br />**deny**- Discard<br />**permit**- Allow passage<br />**trap-to-cpu** - Forward to CPU for processing<br />**copy-to-cpu** - Allow passage while simultaneously copying the packet to the CPU for processing |
| *ethernet\_type*   | Ethertype, format: hexadecimal number                                                                                                                                                                                                                          |
| *vlan\_pri*        | VLAN priority, value range: 0-7                                                                                                                                                                                                                                |
| *src\_ip*          | Source IP address, format: A.B.C.D/M                                                                                                                                                                                                                           |
| *dst\_ip*          | Destination IP address, format: A.B.C.D/M                                                                                                                                                                                                                      |
| *icmp\_type*       | ICMP message type, value range: 0-16                                                                                                                                                                                                                           |
| *icmp\_code*       | ICMP message code, value range: 0-5                                                                                                                                                                                                                            |
| *icmp\_name*       | ICMP message name                                                                                                                                                                                                                                              |
| *src\_port*        | Source L4 port                                                                                                                                                                                                                                                 |
| *dst\_port*        | Destination L4 port                                                                                                                                                                                                                                            |
| *ip\_type*         | Ip type                                                                                                                                                                                                                                                        |

**\[View]**
ACL view

**\[Notes]**
Multiple ACL rules can exist per table.
*rule\_id* The higher the value, the higher the priority, the same table does not allow the configuration of the same priority rules.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list l3 TABLE_1 ingress
sonic(config-l3-acl-table_1)# rule 1 source-ip 10.0.0.3/24 packet-action permit
```

### <font color="#1d50a2">acl </font>

**\[Command]**

**acl&#x20;***acl\_name*****
**no acl&#x20;***acl\_name*

**\[Purpose]**

Bind ACL table on Interface

**\[Parameter]**

| **Parameter**  | **Description** |
| -------------- | --------------- |
| acl\_name					 | ACL table name  |

**\[View]**

System Configuration View,Interface Configuration View,VLANIF View,LAG View

**\[Comment]**

The ACL table is bound to ports. After binding to a port, it means that the ACL table takes effect on the traffic on these ports. One ACL table can be bound to multiple ports, and one port can also have multiple ACL tables, representing a "many-to-many" relationship.
The ACL table is bound in the global View, meaning it takes effect on all physical interfaces of the device's panels.

**\[Use Cases]**

```text
sonic# configure terminal
sonic(config)# acl test

sonic(config)# interface ethernet 1
sonic(config-if-1)# acl test1
```

