---
title: NAT Configuration
slug: routing/nat-configuration
createdAt: 2025-12-04T04:06:51.899Z
---

## <font color="#1d50a2">NAT Configuration</font>

### <font color="#1d50a2">show nat config</font>

**\[Command]**
**show nat config**

**\[Purpose]**
Display NAT configuration information

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show nat config
Global Values
Admin Mode : disabled
Global Timeout : 600 secs
TCP Timeout : 86400 secs
UDP Timeout : 300 secs
Static Entries
Nat Type IP Protocol Global IP Global Port Local IP Local Port Twice-NAT Id
---------- ------------- ----------- ------------- ---------- ------------ ---------------
Pool Entries
Pool Name Global IP Range Global Port Range
----------- ----------------- -------------------
NAT Bindings
Binding Name Pool Name Access-List Nat Type Twice-NAT Id
-------------- ----------- ------------- ---------- --------------
NAT Zones
Port Zone
--------- ------
Ethernet8 0
Loopback0 0
Vlan4000 0
```

### <font color="#1d50a2">show nat translations</font>

**\[Command]**
**show nat translations**

**\[Purpose]**
Display NAT translations information

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show nat translations
Static NAT Entries ..................... 2
Static NAPT Entries ..................... 0
Dynamic NAT Entries ..................... 0
Dynamic NAPT Entries ..................... 0
Static Twice NAT Entries ..................... 0
Static Twice NAPT Entries ..................... 0
Dynamic Twice NAT Entries ..................... 0
Dynamic Twice NAPT Entries ..................... 0
Total SNAT/SNAPT Entries ..................... 1
Total DNAT/DNAPT Entries ..................... 1
Total Entries ..................... 2
Protocol Source Destination Translated Source Translated Destination
---------- -------- ------------- ------------------- ------------------------
all --- 192.168.1.1 --- 1.1.1.1
all 1.1.1.1 --- 192.168.1.1 ---
```

### <font color="#1d50a2">show nat translations\_count</font>

**\[Command]**
**show nat translations\_count**

**\[Purpose]**
Display NAT translations counts

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show nat translations_count
Static NAT Entries ..................... 2
Static NAPT Entries ..................... 0
Dynamic NAT Entries ..................... 0
Dynamic NAPT Entries ..................... 0
Static Twice NAT Entries ..................... 0
Static Twice NAPT Entries ..................... 0
Dynamic Twice NAT Entries ..................... 0
Dynamic Twice NAPT Entries ..................... 0
Total SNAT/SNAPT Entries ..................... 1
Total DNAT/DNAPT Entries ..................... 1
Total Entries ..................... 2
```

### <font color="#1d50a2">show nat statistics</font>

**\[Command]**
**show nat statistics**

**\[Purpose]**
Display nat hit statistics

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic# show nat statistics
Protocol Source Destination Packets Bytes
---------- -------- ------------- --------- -------
all --- 192.168.1.1 0 0
all 1.1.1.1 --- 0 0
```

### <font color="#1d50a2">nat-zone *0-3*</font>

**\[Command]**
**nat-zone *0-3***

**\[Purpose]**
Configure nat-zone

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>                                                                           |
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
| *nat-zone*                                 | Interface domain. The default value is 0. When a non-zero value is configured, the NAT conversion function is enabled. |

**\[View]**
Interface view

**\[Use Cases]**

```plaintext
sonic(config-if-8)# nat-zone 1
```

### <font color="#1d50a2">nat enable</font>

**\[Command]**
**nat enable**

**no nat enable**

**\[Purpose]**
Enable nat function

**\[View]**

System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nat enable
```

### <font color="#1d50a2">nat static basic global\_ip local\_ip \{snat|dnat\} tcp|udp|icmp|all \[extendable|normal\] \[comment\]</font>

**\[Command]**
**nat static basic *global\_ip* *local\_ip* \{snat|dnat} *tcp|udp|icmp|all* \[extendable|normal] \[comment]**
**no nat static basic *global\_ip* *local\_ip* *tcp|udp|icmp|all***

**\[Purpose]**
Configure static nat function

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>                                         |
| ------------------------------------------ | ------------------------------------------------------------------------------------ |
| *global\_ip*                               | global ip                                                                            |
| *local\_ip*                                | local ip                                                                             |
| *snat*                                     | For this session, the private network side needs to initiate the establishment first |
| *dnat*                                     | For this session, the public network side needs to initiate the establishment first  |
| *tcp\|udp\|icmp\|all*                      | Configure corresponding conversions for different protocol types                     |
| *extendable*                               | Support reusing private network port numbers                                         |
| *normal*                                   | Normal configuration without involving port number reuse                             |
| *comment*                                  | Add a note (up to 63 characters) for the configured NAT session                      |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nat static basic 1.1.1.1 192.168.1.1 snat tcp test1
```

### <font color="#1d50a2">nat static \{tcp|udp\} global\_ip global\_port local\_ip local\_port \{snat|dnat\} \[extendable|normal\] \[comment\]</font>

**\[Command]**
**nat static \{tcp|udp} *global\_ip* *global\_port* *local\_ip* *local\_port* \{snat|dnat} \[extendable|normal] \[comment]**
**no nat static \{tcp|udp} *global\_ip* *global\_port* *local\_ip* *local\_port***

**\[Purpose]**
Configure static napt function

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font>                                         |
| ------------------------------------------ | ------------------------------------------------------------------------------------ |
| *global\_ip*                               | global ip                                                                            |
| *local\_ip*                                | local ip                                                                             |
| *snat*                                     | For this session, the private network side needs to initiate the establishment first |
| *dnat*                                     | For this session, the public network side needs to initiate the establishment first  |
| *tcp\|udp\|icmp\|all*                      | Configure corresponding conversions for different protocol types                     |
| *extendable*                               | Support reusing private network port numbers                                         |
| *normal*                                   | Normal configuration without involving port number reuse                             |
| *comment*                                  | Add a note (up to 63 characters) for the configured NAT session                      |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nat static tcp 1.1.1.1 2000 192.168.1.1 3000 snat test1
```

### <font color="#1d50a2">nat pool &#x7B;pool\_name\} start\_ip \[end\_ip\]</font>

**\[Command]**
**nat pool &#x7B;pool\_name} *start\_ip* \[end\_ip]**
**no nat pool &#x7B;pool\_name}**

**\[Purpose]**
Configure dynamic address pool

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *pool\_name*                               | address pool name                            |
| *start\_ip*                                | start ip of address pool                     |
| *end\_ip*                                  | end ip of address pool                       |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nat pool test 1.1.1.1 1.1.1.2
```

### <font color="#1d50a2">nat binding &#x7B;binding\_name\} &#x7B;pool\_name\} \[acl\_name\]</font>

**\[Command]**
**nat binding &#x7B;binding\_name} &#x7B;pool\_name} \[acl\_name]**
**no nat binding &#x7B;binding\_name} \[acl\_name]**

**\[Purpose]**
Bind dynamic address pool

**\[Parameter]**

| <font color="#0C121D">**Parameter**</font> | <font color="#0C121D">**Description**</font> |
| ------------------------------------------ | -------------------------------------------- |
| *binding\_name*                            | bind name                                    |
| *pool\_name*                               | dynamic address pool name                    |
| *acl\_name*                                | acl table name                               |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# nat binding bing1 test acl1
```

