---
title: ACL
slug: aidc/acl
createdAt: 2025-12-01T11:11:09.000Z
---

# <font color="#1d50a2">ACL View</font>

<font color="#1d05a2">Table 1 ACL View</font>

| **Command**                                       | **Purpose**                  |
| ------------------------------------------------- | ---------------------------- |
| **show acl table** \[*table\_name*]               | Display existing ACL tables. |
| **show acl rule** \[*table\_name*] \[*rule\_id*]  | Display existing ACL rules.  |
| **show counters acl** \[table\_name] \[*rule-id*] | Display ACL counters         |
| **clear counters acl**                            | Clear ACL counters           |
| **show time-range** \{**all**                     | *timer-name*}                |

### <font color="#1d50a2">show acl table \[*table\_name*\]</font>

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

**\[Purpose]**
Display existing ACL tables.

**\[Parameters]**

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

**\[View]**
Privileged User View

**\[Use Cases]**

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

###

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

**\[Purpose]**
Display existing ACL rules.

**\[Parameters]**

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

**\[View]**
Privileged User 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
                                             SRC_IP: 10.0.0.2/32
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 \[*table\_name*\] \[*rule-id*\]</font>

**\[Command]**
**show counters acl** \[*table\_name*] \[*rule-id*]

**\[Purpose]**
Display ACL counters.

**\[Parameters]**

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

**\[View]**
Privileged User View

**\[Notes]**
Specify multiple tables or rules separated by commas.

**\[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 counters.

**\[View]**
Privileged User View

**\[Use Cases]**

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

### <font color="#1d50a2">show time-range \{all|*timer-name*\}</font>

**\[Command]**
**show time-range** \{**all**|*timer-name*}

**\[Purpose]**
Display ACL effective time configures.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show time-range all
sonic# show time-range timer-1
```

# <font color="#1d50a2">ACL Config</font>

## <font color="#1d50a2">Control-plane ACL</font>

<font color="#1d05a2">Table 2 Control-plane ACL</font>

| **Command**                                                                                                                                  | **Purpose**                    |
| -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| **access-list** *table\_name* **ctrlplane** *protocol*                                                                                       | Add a control-plane ACL table. |
| **rule** *rule\_id* **packet-action** \{**accept**\|**deny**} \[**source-ip** *sip*\|**source-ipv6** *sipv6*] \[**time-range** *timer-name*] | Add an ACL rule.               |
| **rule default\_drop** \[**interface all**]                                                                                                  | Config a drop ACL rule.        |

### <font color="#1d50a2">access-list *table\_name* ctrlplane *protocol*</font>

**\[Command]**
**access-list** *table\_name* **ctrlplane** *protocol*

**\[Purpose]**
Add a control-plane ACL table.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                                  |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| *table\_name* | ACL table name.                                                                                                                  |
| *protocol*    | Specify one or more control plane protocols, optionally NTP/SNMP/SSH/BGP/TELNET. Specify multiple protocols separated by commas. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no access-list** *table\_name* to delete the ACL table.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list test1 ctrlplane ssh
sonic(config-ctrlplane-acl-test1)#
```

### <font color="#1d50a2">rule *rule\_id* packet-action \{accept|deny\} \[source-ip *sip*|source-ipv6 *sipv6*\] \[time-range *timer-name*\]</font>

**\[Command]**
**rule** *rule\_id* **packet-action** \{**accept|deny**} \[**source-ip** *sip*|**source-ipv6** *sipv6*] \[**time-range** *timer-name*]

**\[Purpose]**
Add an ACL rule.

**\[Parameters]**

| **Parameter** | **Description**                                                                                               |
| ------------- | ------------------------------------------------------------------------------------------------------------- |
| *rule\_id*    | ACL rule id, also indicates the priority, range from 0 to 500. The larger the value, the higher the priority. |
| *sip*         | Source IP, *A.B.C.D*(/M)                                                                                      |
| *sipv6*       | Source IPv6,*&#x20;X\:X\::X\:X*(/M)                                                                           |
| *timer-name*  | ACL time range name                                                                                           |

**\[View]**
ACL table Configuration View

**\[Notes]**
Rules with the same priority is not allowed in one ACL table.
Run command **no rule** *rule-id* to delete the ACL rule.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list test1 ctrlplane SSH
sonic(config-ctrlplane-acl-test1)# rule 100 packet-action deny source-ip 192.168.10.85
sonic(config-ctrlplane-acl-test1)# rule 1 source-ip 192.168.30.138 packet-action deny time-range timer-1
sonic(config-ctrlplane-acl-test1)# show this
!
access-list test1 ctrlplane SSH
 rule 100 packet-action deny source-ip 192.168.10.85
rule 1 source-ip 192.168.30.138 packet-action deny time-range timer-1
```

###

**\[Command]**
**Rule default\_drop** \[**interface all**]

**\[Purpose]**
Add drop rule.

**\[Parameters]**

| **Parameter**     | **Description**                                                                                                              |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **interface all** | Drop all protocol packets of interfaces. Without this parameter, only protocol packets of eth0 port are discarded by default |

**\[View]**
ACL table Configuration View

**\[Notes]**
Run command **no ruledefault\_drop** to delete drop rule.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list test1 ctrlplane SSH
sonic(config-ctrlplane-acl-test1)# rule default_drop interface all
sonic(config-ctrlplane-acl-test1)# show this
!
access-list test1 ctrlplane SSH
 rule default drop interface all
```

## <font color="#1d50a2">Data-plane ACL</font>

<font color="#1d05a2">Table 3 Data-plane ACL</font>

| **Command**                                                                                           | **Purpose**                           |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------- |
| **access-list** *table\_name* **\{l2\|l3\|l3v6\|mirror\|mirrorv6\|flow\_control} \{ingress\|egress}** | Add a data-plane ACL table.           |
| **bind interface** \{\{**ethernet**\|**link-aggregation**} *interface\_name*\|**all**}                | Apply the ACL table to the interface. |
| **rule** *rule\_id* *ACITON RULE* \[**time-range** timer-name]                                        | Create an ACL rule.                   |

### <font color="#1d50a2">access-list *table\_name* \{l2|l3|l3v6|mirror|mirrorv6|flow\_control\} \{ingress|egress\}</font>

**\[Command]**
**access-list** *table\_name* \{**l2**|**l3**|**l3v6**|**mirror**|**mirrorv6**|**flow\_control**} \{**ingress**|**egress**}

**\[Purpose]**
Add a data-plane ACL table.

**\[Parameters]**

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

**\[View]**
Global Configuration View

**\[Notes]**
ACLs of type L2/L3/L3v6 are used for Layer 2/Layer 3/Layer 3 IPv6 traffic forwarding, respectively. Mirror/Mirrorv6 are used to local mirror SPAN and remotely mirror ERSPAN. Flow\_Control are usually used together with Policer module to implement rate limiting for specific flows.
Run command **no access-list** *table\_name* to delete the ACL table.

**\[Use Cases]**

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

### <font color="#1d50a2">bind interface \{\{ethernet|link-aggregation\} *interface\_name*|all\}</font>

**\[Command]**
**bind interface** \{\{**ethernet**|**link-aggregation**} *interface\_name*|**all**}

**\[Purpose]**
Apply the ACL table to the interface.

**\[Parameters]**

| **Parameter**     | **Description**          |
| ----------------- | ------------------------ |
| *interface\_name* | Interface name (eg.0/1)  |
| **all**           | Binds to all interfaces. |

**\[View]**
ACL table Configuration View

**\[Notes]**
ACL table is for ports. When you bind an ACL table to some ports, it means that the ACL table is valid for the traffic on these ports. An ACL table can be bound to multiple ports, and a port can also have multiple ACL tables, which means a "many-to-many" relationship.
Run command **no bind interface** \{\{**ethernet**|**link-aggregation**} *interface\_name*|**all**} to unbind the interface.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list TABLE_1 l3 ingress
sonic(config-l3-acl-table_1)# bind interface ethernet 0/1
sonic(config-l3-acl-table_1)# bind interface all
```

### <font color="#1d50a2">rule *rule\_id* *action rule* \[time-range *timer-name*\]</font>

**\[Command]**
**rule** *rule\_id* **packet-action** \{**drop**|**deny**|**permit**|**trap-to-cpu**|**copy-to-cpu**} *RULE* \[**time-range** *timer-name*]
Drop/deny/forward/trap to CPU/trap to CPU and forward <font color="#1d05a2">(ingress only)</font>.

**rule** *rule\_id* **packet-action** \{**deny**|**permit**|**trap-to-cpu**|**copy-to-cpu**} *RULE* \[**time-range** *timer-name*]
Deny/forward <font color="#1d05a2">(egress only)</font>.

**rule** *rule\_id* **redirect-action** \{\{*ethernet|link-aggregation*} *interface\_name|A.B.C.D|X\:X\::X\:X*} *RULE* \[**time-range** *timer-name*]
Redirect <font color="#1d05a2">(ingress only)</font>.

**rule** *rule\_id* **set-tc** *tc* *RULE* \[**time-range** *timer-name*]
Set COS <font color="#1d05a2">(ingress only)</font>.

**rule** *rule\_id* **set-dscp** *dscp* *RULE* \[**time-range** *timer-name*]
Set DSCP.

**rule** *rule\_id* **set-pcp** *pcp RULE* \[**time-range** *timer-name*]
Set VLAN priority.

**rule** *rule\_id* **traffic-behavior** *traffic\_behavior\_name* *RULE* \[**time-range** *timer-name*]
Limit the speed for a specific stream <font color="#1d05a2">(Flow Control only)</font>.

**rule** *rule\_id* **action mirror-session** *session-id*
Configure traffic mirroring for specific flows.

**\[Purpose]**
Create an ACL rule.

**\[Parameters]**

| **Parameter** | **Description**                                                                                               |
| ------------- | ------------------------------------------------------------------------------------------------------------- |
| *rule\_id*    | ACL rule id, also indicates the priority, range from 0 to 500. The larger the value, the higher the priority. |

Different ACL table types support different match fields:

- <font color="#1d05a2">**L2 ACL Table**</font>

| **Field**                    | **Description**                                                                                                                       |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| **outer-vlan** *outer-vlan*  | range \[1,4094]                                                                                                                       |
| **ethernet-type** *eth-type* | HEX\<0-FFFF>                                                                                                                          |
| **source-mac** *smac*        | *HH\:HH\:HH\:HH\:HH\:HH* or *nn\:nn\:nn\:nn\:nn*:n&#x6E;*/mask*(*nn\:nn\:nn\:nn\:nn\:nn*) <font color="#1d05a2">(ingress only)</font> |
| **destination-mac** *dmac*   | *HH\:HH\:HH\:HH\:HH\:HH* or *nn\:nn\:nn\:nn\:nn*:n&#x6E;*/mask*(*nn\:nn\:nn\:nn\:nn\:nn*) <font color="#1d05a2">(ingress only)</font> |
| **vlan-pri** *vlan-pri*      | range 0-7                                                                                                                             |

- <font color="#1d05a2">**L3 ACL Table**</font>

| **Field**                         | **Description**                                                                |
| --------------------------------- | ------------------------------------------------------------------------------ |
| **vlan-pri** *vlan-pri*           | range 0-7                                                                      |
| **outer-vlan** *outer-vlan*       | range \[1,4094]                                                                |
| **ip-protocol** *ip-protocol*     | range 0-255                                                                    |
| **source-port** *sport*           | range 0-65535                                                                  |
| **destination-port** *dport*      | range 0-65535                                                                  |
| **tcp-flags**    *tcp-flags*      | range 0-63                                                                     |
| **source-ip** *sip*               | *A.B.C.D*(/M)                                                                  |
| **destination-ip** *dip*          | *A.B.C.D*(/M)                                                                  |
| **icmp-type** *icmp-type*         | range 0-16                                                                     |
| **icmp-code** *icmp-code*         | range 0-5                                                                      |
| **ethernet-type** *eth-type*      | HEX\<0-FFFF>(ingress only)                                                     |
| **ecn** *ecn*                     | range 0-3                                                                      |
| **dscp** *dscp*                   | range 0-63                                                                     |
| **ip-precedence** *ip-precedence* | range 0-7                                                                      |
| **ip-type** *ip-type*             | any/ip/non\_ip/ipv4any/non\_ipv4/ipv6any/non\_ipv6/arp/arp\_request/arp\_reply |

- <font color="#1d05a2">**L3v6 ACL Table**</font>

| **Field**                     | **Description**                                                                                             |
| ----------------------------- | ----------------------------------------------------------------------------------------------------------- |
| **ip-protocol** *ip-protocol* | range 0-255 <font color="#1d05a2">(ingress only)</font>                                                     |
| **source-port** *sport*       | range 0-65535 <font color="#1d05a2">(Only supported on CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2)</font> |
| **destination-port** *dport*  | range 0-65535 <font color="#1d05a2">(Only supported on CX308P-48Y-N-V2, CX532P-N-V2 and CX732Q-N-V2)</font> |
| **source-ipv6** *sipv6*       | X\:X\::X\:X(/M) <font color="#1d05a2">(Only match high 64 bit addresses)</font>                             |
| **destination-ipv6** *dipv6*  | X\:X\::X\:X(/M)<font color="#1d05a2"> (Only match high 64 bit addresses)</font>                             |
| **icmpv6-type** *icmpv6-type* | range 1-137 <font color="#1d05a2">(ingress only)</font>                                                     |
| **icmpv6-code** *icmpv6-code* | range 0-4<font color="#1d05a2"> (ingress only)</font>                                                       |
| **ethernet-type** *eth-type*  | HEX \<0-FFFF><font color="#1d05a2"> (ingress only)</font>                                                   |
| **dscp** *dscp*               | range 0-63                                                                                                  |
| **flow-label** *flow-label*   | HEX \<0-FFFF> <font color="#1d05a2">(ingress only)</font>                                                   |

- <font color="#1d05a2">**Mirror ACL Table**</font>

| **Field**                       | **Description**                                                                |
| ------------------------------- | ------------------------------------------------------------------------------ |
| **outer-vlan** *outer-vlan*     | range \[1,4094]                                                                |
| **source-port** *sport*         | range 0-65535                                                                  |
| **destination-port** *dport*    | range 0-65535                                                                  |
| **tcp-flags**    *tcp-flags*    | range 0-63                                                                     |
| **source-ip**    *sip*          | *A.B.C.D*(/M)                                                                  |
| **destination-ip** *dip*        | *A.B.C.D*(/M)                                                                  |
| **icmp-type** *icmp-type*       | range 0-16                                                                     |
| **icmp-code** *icmp-code*       | range 0-5                                                                      |
| **dscp** *dscp*                 | range 0-63                                                                     |
| **ip-type** *ip-type*           | any/ip/non\_ip/ipv4any/non\_ipv4/ipv6any/non\_ipv6/arp/arp\_request/arp\_reply |
| **bth-opcode** bth-opcode       | range 0-255                                                                    |
| **aeth-syndrome** aeth-syndrome | range 0-255                                                                    |

- <font color="#1d05a2">**Mirrorv6 ACL Table**</font>

| **Field**                       | **Description** |
| ------------------------------- | --------------- |
| **source-ipv6** *sipv6*         | X\:X\::X\:X(/M) |
| **destination-ipv6** *dipv6*    | X\:X\::X\:X(/M) |
| **bth-opcode** bth-opcode       | range 0-255     |
| **aeth-syndrome** aeth-syndrome | range 0-255     |

- <font color="#1d05a2">**Flow\_Control ACL Table**</font>

| **Field**                     | **Description**                                                                                                                    |
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| **outer-vlan** *outer-vlan*   | range \[1,4094]                                                                                                                    |
| **ip-protocol** *ip-protocol* | range 0-255                                                                                                                        |
| **source-port** *sport*       | range 0-65535                                                                                                                      |
| **destination-port** *dport*  | range 0-65535                                                                                                                      |
| **source-ip**    *sip*        | A.B.C.D(/M)                                                                                                                        |
| **destination-ip** *dip*      | A.B.C.D(/M)                                                                                                                        |
| **source-mac** *smac*         | *HH\:HH\:HH\:HH\:HH\:HH* or *nn\:nn\:nn\:nn\:nn\:nn/mask(nn\:nn\:nn\:nn\:nn\:nn*) <font color="#1d05a2">(ingress only)</font>      |
| **destination-mac** *dmac*    | *HH\:HH\:HH\:HH\:HH*:HH or *nn\:nn\:nn\:nn\:nn*:n&#x6E;*/mask(nn\:nn\:nn\:nn\:nn\:nn*)<font color="#1d05a2"> (ingress only)</font> |
| **in-ports** *port-list*      | Specify a list of bound interfaces, with multiple interfaces separated by commas.                                                  |

**\[View]**
ACL table Configuration View

**\[Notes]**
An ACL rule can only be added to one table, but a table can have more than one rule, that is, rule and table is a "many-to-one" relationship.
Rules with the same priority is not allowed in one ACL table.
Run command **no rule** *rule-id* to delete the ACL rule.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list TABLE_1 l3 ingress
sonic(config-l3-acl-table_1)# rule 1 source-ip 10.0.0.3/24 packet-action permit
sonic(config-l3-acl-table_1)# rule 1 source-ip 192.168.30.138 set-tc 6 time-range timer-1
```

### <font color="#1d50a2">Policy routing based on ACL</font>

<font color="#1d05a2">Table 4 Policy routing based on ACL</font>

| **Command**                                                                                                    | **Purpose**                           |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| **access-list nexthop-group** *group\_number*                                                                  | Add a next-hop group.                 |
| **ip-address** \{*A.B.C.D\|X\:X\::X\:X*}                                                                       | Add next hops to the next-hop group.  |
| **access-list** *table\_name* \{**l3**\|**l3v6**} **ingress**                                                  | Add an ACL table.                     |
| **bind interface** \{\{**ethernet**\|**link-aggregation**} *interface\_name*\|**all**}                         | Apply the ACL table to the interface. |
| **rule** *rule\_id* **redirect-action nexthop-group** *group\_number* \[*RULE*] \[**time-range** *timer-name*] | Add a policy route based on ACL.      |

### <font color="#1d50a2">access-list nexthop-group *group\_number*</font>

**\[Command]**
**access-list nexthop-group** *group\_number*

**\[Purpose]**
Add a next-hop group.

**\[Parameters]**

| **Parameter**   | **Description**                            |
| --------------- | ------------------------------------------ |
| *group\_number* | Next-hop group number, the range is 1\~12. |

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no access-list nexthop-group** *group\_number* to delete the nexthop-group.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list nexthop-group 1
sonic(config-acl-nexthop-group-1)#
```

### <font color="#1d50a2">ip-address \{*A.B.C.D|X\:X\:\:X\:X*\}</font>

**\[Command]**
**ip-address** \{*A.B.C.D|X\:X\::X\:X*}

**\[Purpose]**
Add next hops to the next-hop group.

**\[Parameters]**

| **Parameter** | **Description** |
| ------------- | --------------- |
| *A.B.C.D*     | IPv4 address.   |
| *X\:X\::X\:X* | IPv6 address.   |

**\[View]**
Next-hop Group Configuration View

**\[Notes]**
The next-hop address is required to be reachable, and the configuration takes effect after **commit**.
Run command **no ip-address** \{*A.B.C.D|X\:X\::X*:X } to delete next hops address.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list nexthop-group 1
sonic(config-acl-nexthop-group-1)# ip-address 1.0.0.1
sonic(config-acl-nexthop-group-1)# ip-address 2.0.0.1
sonic(config-acl-nexthop-group-1)# ip-address 2000::1
sonic(config-acl-nexthop-group-1)# ip-address 2001::1
sonic(config-acl-nexthop-group-1)# commit
sonic(config-acl-nexthop-group-1)# show this
!
access-list nexthop-group 1
 ip-address 1.0.0.1
 ip-address 2.0.0.1
 ip-address 2000::1
 ip-address 2001::1
 commit
```

### <font color="#1d50a2">access-list *table\_name* \{l3|l3v6\} ingress</font>

**\[Command]**
**access-list** *table\_name* \{**l3**|**l3v6**} **ingress**

**\[Purpose]**
Add an ACL table.

**\[Parameters]**

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

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no access-list** *table\_name* to delete the ACL table.

**\[Use Cases]**

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

### <font color="#1d50a2">bind interface \{\{ethernet|link-aggregation\} *interface\_name*|all\}</font>

**\[Command]**
**bind interface** \{\{**ethernet**|**link-aggregation**} *interface\_name*|**all**}

**\[Purpose]**
Apply the ACL table to the interface.

**\[Parameters]**

| **Parameter**     | **Description**          |
| ----------------- | ------------------------ |
| *interface\_name* | Interface name (eg.0/1)  |
| **all**           | Binds to all interfaces. |

**\[View]**
ACL table Configuration View

**\[Notes]**
Run command **no bind interface** \{\{**ethernet**|**link-aggregation**} *interface\_name*|**all**} to unbind the interface.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# access-list test l3 ingress
sonic(config-l3-acl-test)# bind interface ethernet 0/1
sonic(config-l3-acl-test)# rule 10 destination-ip 96.0.0.7 redirect-action nexthop-group 1
```

### <font color="#1d50a2">rule *rule\_id* redirect-action nexthop-group *group\_number* \[*RULE*\] \[time-range *timer-name*\]</font>

**\[Command]**
**rule** *rule\_id* **redirect-action nexthop-group** *group\_number* \[*RULE*] \[**time-range** *timer-name*]

**\[Purpose]**
Add a policy route based on ACL.

**\[Parameters]**

| **Parameter**   | **Description**                                                                                               |
| --------------- | ------------------------------------------------------------------------------------------------------------- |
| *rule\_id*      | ACL rule id, also indicates the priority, range from 0 to 500. The larger the value, the higher the priority. |
| *group\_number* | Next-hop group number, the range is 1\~12.                                                                    |

Different ACL table types support different match fields:

- <font color="#1d05a2">**L3 ACL Table**</font>

| **Field**                     | **Description** |
| ----------------------------- | --------------- |
| **vlan-pri** *vlan-pri*       | range 0-7       |
| **outer-vlan** *outer-vlan*   | range \[1,4094] |
| **ip-protocol** *ip-protocol* | range 0-255     |
| **source-port** *sport*       | range 0-65535   |
| **destination-port** *dport*  | range 0-65535   |
| **tcp-flags**    *tcp-flags*  | HEX\<0-FF>      |
| **source-ip** *sip*           | *A.B.C.D*(/M)   |
| **destination-ip** *dip*      | *A.B.C.D*(/M)   |
| **icmp-type** *icmp-type*     | range 0-16      |
| **icmp-code** *icmp-code*     | range 0-5       |
| **ethernet-type** *eth-type*  | HEX\<0-FFFF>    |
| **ecn** *ecn*                 | range 0-3       |
| **dscp** *dscp*               | range 0-63      |

- <font color="#1d05a2">**L3v6 ACL Table**</font>

| **Field**                     | **Description** |
| ----------------------------- | --------------- |
| **ip-protocol** *ip-protocol* | range 0-255     |
| source-port *sport*           | range 0-65535   |
| **destination-port** *dport*  | range 0-65535   |
| **tcp-flags**    *tcp-flags*  | HEX\<0-FF>      |
| **source-ipv6** *sipv6*       | X\:X\::X\:X(/M) |
| **destination-ipv6** *dipv6*  | X\:X\::X\:X(/M) |
| **icmpv6-type** *icmpv6-type* | range 1-137     |
| **icmpv6-code** *icmpv6-code* | range 0-4       |
| **ethernet-type** *eth-type*  | HEX\<0-FFFF>    |

**\[View]**
ACL table Configuration View

**\[Notes]**
Rules with the same priority is not allowed in one ACL table.
Run command **no rule** *rule-id* to delete the ACL rule.

**\[Use Cases]**

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

## <font color="#1d50a2">Set a time period for ACL</font>

<font color="#1d05a2">Table 5 Set a time period for ACL</font>

| **Command**                                                                          | **Purpose**                                           |
| ------------------------------------------------------------------------------------ | ----------------------------------------------------- |
| **time-range** *timer\_name xx\:xx* **to** *xx\:xx days*                             | Create a time period based on a periodic time range.  |
| **time-range** *timer\_name* **from** *xx\:xx xxxx/xx/xx* **to** *xx\:xx xxxx/xx/xx* | Create a time period based on an absolute time range. |

### <font color="#1d50a2">time-range *timer\_name xx\:xx* to *xx\:xx days*</font>

**\[Command]**
**time-range** *timer\_name* *xx\:xx&#x20;***to** *xx\:xx days*

**\[Purpose]**
Create a time period based on a periodic time range.

**\[Parameters]**

| **Parameter** | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *timer\_name* | Time-range name, the maximum length is 32 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| *xx\:xx*      | 24-hour time, such as 18:49.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| *days*        | The optional values for the weekly effective time are as follows:1）**0-6** ：Corresponds to Sunday through Saturday. It can be configured as follows：**0-6** or **0,1,2,3,4,5,6**2）**Mon/Tue/Wed/Thu/Fri/Sat/Sun**：It can be configured as follows\:Configuration takes effect on Monday of the week：**Mon**Configuration takes effect on Monday and Wednesday of the week：**Mon, Wed**3）**daily**: Take effect on every day4）**off-day**：Take effect on Sun and Sat5）**working-day**：Take effect from Mon to Fri |

**\[View]**
Global Configuration View

**\[Notes]**
Multiple periodic time ranges can be configured on the same timer-name.
Run command **no time-range** *timer\_name* to delete the ACL timer.
Run command **no time-range** *timer\_name xx\:xx* **to** *xx\:xx days* to delete a single time range under the ACL timer.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# time-range timer-1 23:59 to 11:38 0,1
sonic(config)# time-range timer-1 11:40 to 11:45 0-1
sonic(config)# time-range timer-1 11:40 to 11:45 2
sonic(config)# time-range timer-1 11:50 to 11:55 Mon,Wed
sonic(config)# time-range timer-1 12:05 to 12:15 daily
sonic(config)# time-range timer-1 13:05 to 13:15 off-day
sonic(config)# time-range timer-1 14:05 to 14:15 working-day
```

### <font color="#1d50a2">time-range *timer\_name* from *xx\:xx xxxx/xx/xx*  to *xx\:xx xxxx/xx/xx*</font>

**\[Command]**
**time-range** *timer\_name* **from** *xx\:xx xxxx/xx/xx* **to** *xx\:xx xxxx/xx/xx*

**\[Purpose]**
Create a time period based on an absolute time range.

**\[Parameters]**

| **Parameter** | **Description**                                       |
| ------------- | ----------------------------------------------------- |
| timer\_name   | Time-range name, the maximum length is 32 characters. |
| *xx\:xx*      | 24-hour time, such as 18:49.                          |
| xxxx/xx/xx    | Effective date, the format is Y/m/d.                  |

**\[View]**
Global Configuration View

**\[Notes]**
Multiple absolute time ranges can be configured on the same timer-name.
Absolute time range and periodic time range can be configured on the same timer-name. The effective time is the intersection of these two time range configurations
Run command **no time-range** *timer\_name* to delete the ACL timer.
Run command **no time-range from** *xx\:xx xxxx/xx/xx* **to** xx\:x&#x78;*&#x20;xxxx/xx/xx* to delete a single time range under the ACL timer

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# time-range timer-1 from 11:00 2024/10/14 to 11:00 2024/10/20
sonic(config)# time-range timer-1 from 11:00 2024/10/25 to 11:00 2024/10/28
```

