跳转到内容
Ask AI

NAT Configuration

此内容尚不支持你的语言。

[Command] show nat config

[Purpose] Display NAT configuration information

[View] System view

[Use Cases]

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

[Command] show nat translations

[Purpose] Display NAT translations information

[View] System view

[Use Cases]

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 ---

[Command] show nat translations_count

[Purpose] Display NAT translations counts

[View] System view

[Use Cases]

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

[Command] show nat statistics

[Purpose] Display nat hit statistics

[View] System configuration view

[Use Cases]

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

[Command] nat-zone0-3

[Purpose] Configure nat-zone

[Parameter]

ParameterDescription
nat-zoneInterface 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 1

[Command] nat enable

no nat enable

[Purpose] Enable nat function

[View]

System configuration view

[Use Cases]

sonic(config)# nat enable

nat 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]

ParameterDescription
global_ipglobal ip
local_iplocal ip
snatFor this session, the private network side needs to initiate the establishment first
dnatFor this session, the public network side needs to initiate the establishment first
tcp|udp|icmp|allConfigure corresponding conversions for different protocol types
extendableSupport reusing private network port numbers
normalNormal configuration without involving port number reuse
commentAdd 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 test1

nat 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]

ParameterDescription
global_ipglobal ip
local_iplocal ip
snatFor this session, the private network side needs to initiate the establishment first
dnatFor this session, the public network side needs to initiate the establishment first
tcp|udp|icmp|allConfigure corresponding conversions for different protocol types
extendableSupport reusing private network port numbers
normalNormal configuration without involving port number reuse
commentAdd 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 test1

[Command] nat pool {pool_name}start_ip[end_ip] no nat pool {pool_name}

[Purpose] Configure dynamic address pool

[Parameter]

ParameterDescription
pool_nameaddress pool name
start_ipstart ip of address pool
end_ipend ip of address pool

[View] System configuration view

[Use Cases]

sonic(config)# nat pool test 1.1.1.1 1.1.1.2

nat 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]

ParameterDescription
binding_namebind name
pool_namedynamic address pool name
acl_nameacl table name

[View] System configuration view

[Use Cases]

sonic(config)# nat binding bing1 test acl1