NAT Configuration
此内容尚不支持你的语言。
show nat config
Section titled “show nat config”[Command] show nat config
[Purpose] Display NAT configuration information
[View] System view
[Use Cases]
sonic# show nat configGlobal ValuesAdmin Mode : disabledGlobal Timeout : 600 secsTCP Timeout : 86400 secsUDP Timeout : 300 secsStatic EntriesNat Type IP Protocol Global IP Global Port Local IP Local Port Twice-NAT Id---------- ------------- ----------- ------------- ---------- ------------ ---------------Pool EntriesPool Name Global IP Range Global Port Range----------- ----------------- -------------------NAT BindingsBinding Name Pool Name Access-List Nat Type Twice-NAT Id-------------- ----------- ------------- ---------- --------------NAT ZonesPort Zone--------- ------Ethernet8 0Loopback0 0Vlan4000 0show nat translations
Section titled “show nat translations”[Command] show nat translations
[Purpose] Display NAT translations information
[View] System view
[Use Cases]
sonic# show nat translationsStatic NAT Entries ..................... 2Static NAPT Entries ..................... 0Dynamic NAT Entries ..................... 0Dynamic NAPT Entries ..................... 0Static Twice NAT Entries ..................... 0Static Twice NAPT Entries ..................... 0Dynamic Twice NAT Entries ..................... 0Dynamic Twice NAPT Entries ..................... 0Total SNAT/SNAPT Entries ..................... 1Total DNAT/DNAPT Entries ..................... 1Total Entries ..................... 2Protocol Source Destination Translated Source Translated Destination---------- -------- ------------- ------------------- ------------------------all --- 192.168.1.1 --- 1.1.1.1all 1.1.1.1 --- 192.168.1.1 ---show nat translations_count
Section titled “show nat translations_count”[Command] show nat translations_count
[Purpose] Display NAT translations counts
[View] System view
[Use Cases]
sonic# show nat translations_countStatic NAT Entries ..................... 2Static NAPT Entries ..................... 0Dynamic NAT Entries ..................... 0Dynamic NAPT Entries ..................... 0Static Twice NAT Entries ..................... 0Static Twice NAPT Entries ..................... 0Dynamic Twice NAT Entries ..................... 0Dynamic Twice NAPT Entries ..................... 0Total SNAT/SNAPT Entries ..................... 1Total DNAT/DNAPT Entries ..................... 1Total Entries ..................... 2show nat statistics
Section titled “show nat statistics”[Command] show nat statistics
[Purpose] Display nat hit statistics
[View] System configuration view
[Use Cases]
sonic# show nat statisticsProtocol Source Destination Packets Bytes---------- -------- ------------- --------- -------all --- 192.168.1.1 0 0all 1.1.1.1 --- 0 0nat-zone
Section titled “nat-zone”[Command] nat-zone0-3
[Purpose] Configure nat-zone
[Parameter]
| Parameter | Description |
|---|---|
| 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]
sonic(config-if-8)# nat-zone 1nat enable
Section titled “nat enable”[Command] nat enable
no nat enable
[Purpose] Enable nat function
[View]
System configuration view
[Use Cases]
sonic(config)# nat enablenat static basic global_ip local_ip {snat|dnat} tcp|udp|icmp|all [extendable|normal] [comment]
Section titled “nat static basic global_ip local_ip {snat|dnat} tcp|udp|icmp|all [extendable|normal] [comment]”[Command] nat static basicglobal_ip local_ip**{snat|dnat}tcp|udp|icmp|all[extendable|normal] [comment]** no nat static basicglobal_ip local_ip tcp|udp|icmp|all
[Purpose] Configure static nat function
[Parameter]
| Parameter | Description |
|---|---|
| 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]
sonic(config)# nat static basic 1.1.1.1 192.168.1.1 snat tcp test1nat static {tcp|udp} global_ip global_port local_ip local_port {snat|dnat} [extendable|normal] [comment]
Section titled “nat static {tcp|udp} global_ip global_port local_ip local_port {snat|dnat} [extendable|normal] [comment]”[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]
| Parameter | Description |
|---|---|
| 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]
sonic(config)# nat static tcp 1.1.1.1 2000 192.168.1.1 3000 snat test1nat pool {pool_name} start_ip [end_ip]
Section titled “nat pool {pool_name} start_ip [end_ip]”[Command] nat pool {pool_name}start_ip[end_ip] no nat pool {pool_name}
[Purpose] Configure dynamic address pool
[Parameter]
| Parameter | Description |
|---|---|
| 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]
sonic(config)# nat pool test 1.1.1.1 1.1.1.2nat binding {binding_name} {pool_name} [acl_name]
Section titled “nat binding {binding_name} {pool_name} [acl_name]”[Command] nat binding {binding_name} {pool_name} [acl_name] no nat binding {binding_name} [acl_name]
[Purpose] Bind dynamic address pool
[Parameter]
| Parameter | Description |
|---|---|
| binding_name | bind name |
| pool_name | dynamic address pool name |
| acl_name | acl table name |
[View] System configuration view
[Use Cases]
sonic(config)# nat binding bing1 test acl1