Configuring Static and Dynamic Nat Translation
Configuring Static and Dynamic Nat Translation
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 1
Configuring Static and Dynamic NAT Translation
Information About Static NAT
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
2 OL-31635-01
Configuring Static and Dynamic NAT Translation
Static Twice NAT Overview
• Global address—Any address that appears on the outside (public) portion of the network.
• Legitimate IP address—An address that is assigned by the Network Information Center (NIC) or service
provider.
• Inside local address—The IP address assigned to a host on the inside network. This address does not
need to be a legitimate IP address.
• Outside local address—The IP address of an outside host as it appears to the inside network. It does not
have to be a legitimate address, because it is allocated from an address space that can be routed on the
inside network.
• Inside global address—A legitimate IP address that represents one or more inside local IP addresses to
the outside world.
• Outside global address—The IP address that the host owner assigns to a host on the outside network.
The address is a legitimate address that is allocated from an address or network space that can be routed.
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 3
Configuring Static and Dynamic NAT Translation
Licensing Requirements for Static NAT
device on an external network cannot connect to devices in your network, unless your device has initiated the
contact.
Dynamic NAT translations do not exist in the NAT translation table until a device receives traffic that requires
translation. Dynamic translations are cleared or timed out when not in use to make space for new entries.
Usually, NAT translation entries are cleared when the ternary content addressable memory (TCAM) entries
are limited. The default minimum timeout for dynamic NAT translations is 30 minutes.
When you create dynamic entries without timeouts configured, they take the default timeout of one hour. If
you enter the clear ip nat translations all command after configuring timeouts, the configured timeout take
effect. Timeout can be configured from 1 to 172800 seconds.
Dynamic NAT supports Port Address Translation (PAT) and access control lists (ACLs). PAT, also known
as overloading, is a form of dynamic NAT that maps multiple unregistered IP addresses to a single registered
IP address by using different ports. Your NAT configuration can have multiple dynamic NAT translations
with same or different ACLs. However, for a given ACL, only one interface can be specified.
For aging ,there are three different options that can be configured:
• 1-Time-out:This is applicable for all type of flows(both TCP and UDP)
• 2-TCP TIME-OUT: This is applicable for only TCP flows
• 3-UDP TIME-OUT: This is applicable for only UDP flows
• NAT is supported on the default Virtual Routing and Forwarding (VRF) table only.
• NAT is supported for IPv4 Unicast only.
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
4 OL-31635-01
Configuring Static and Dynamic NAT Translation
Restrictions for Dynamic NAT
• Egress ACLs are applied to the original packets and not the NAT translated packets.
• By default, NAT does not have any reservation in TCAM. You need to reserve the space for NAT in
the VACL region of TCAM by using the hardware profile tcam feature nat limit command .
• HSRP and VRRP are not supported on a NAT interface.
• Warp mode latency performance is not supported on packets coming from the outside to the inside
domain.
• If an IP address is used for Static NAT or PAT translations, it cannot be used for any other purpose. For
example, it cannot be assigned to an interface.
• For Static NAT, the outside global IP address should be different from the outside interface IP address.
• Twice NAT is not supported. (Twice NAT is a variation of NAT in that both the source and destination
addresses are modified by NAT as a datagram crosses address domains (inside to outside or outside to
inside.)
• NAT statistics are not available.
• When configuring a large number of translations (more than 100), it is faster to configure the translations
before configuring the NAT interfaces.
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 5
Configuring Static and Dynamic NAT Translation
Configuring Static NAT
Step 2 switch(config)# feature nat Enables the static NAT feature on the device.
Step 2 switch(config)# interface type Specifies an interface to configure, and enters interface
slot/port configuration mode.
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
6 OL-31635-01
Configuring Static and Dynamic NAT Translation
Enabling Static NAT for an Inside Source Address
This example shows how to configure an interface with static NAT from the inside:
switch# configure terminal
switch(config)# interface ethernet 1/4
switch(config-if)# ip nat inside
Note When the Cisco Nexus device is configured to translate an inside source IP address (Src:ip1) to an outside
source IP address (newSrc:ip2), the Cisco Nexus device implicitly adds a translation for an outside
destination IP address (Dst: ip2) to an inside destination IP address (newDst: ip1).
Procedure
Step 2 switch(config)# ip nat inside source Configures static NAT to translate the inside global
static local-ip-address address to the inside local address or to translate the
global-ip-address opposite (the inside local traffic to the inside global
traffic).
This example shows how to configure static NAT for an inside source address:
switch# configure terminal
switch(config)# ip nat inside source static 1.1.1.1 5.5.5.5
switch(config)# copy running-config startup-config
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 7
Configuring Static and Dynamic NAT Translation
Enabling Static NAT for an Outside Source Address
Procedure
Step 2 switch(config)# ip nat outside Configures static NAT to translate the outside global address
source static global-ip-address to the outside local address or to translate the opposite (the
local-ip-address [add-route] outside local traffic to the outside global traffic). When an
inside translation without ports is configured, an implicit add
route is performed. The original add route functionality is
an option while configurating an outside translation.
This example show how to configure static NAT for an outside source address:
switch# configure terminal
switch(config)# ip nat outside source static 2.2.2.2 6.6.6.6
switch(config)# copy running-config startup-config
Procedure
Step 2 switch(config)# ip nat inside source static Maps static NAT to an inside local port to an
{inside-local-address outside-local-address | {tcp| inside global port.
udp} inside-local-address {local-tcp-port |
local-udp-port} inside-global-address
{global-tcp-port | global-udp-port}}
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
8 OL-31635-01
Configuring Static and Dynamic NAT Translation
Configuring Static PAT for an Outside Source Address
This example shows how to map UDP services to a specific inside source address and UDP port:
switch# configure terminal
switch(config)# ip nat inside source static udp 20.1.9.2 63 35.48.35.48 130
switch(config)# copy running-config startup-config
Procedure
Step 2 switch(config)# ip nat outside source static Maps static NAT to an outside global port
{outside-global-address outside-local-address | to an outside local port.
{tcp | udp} outside-global-address
{global-tcp-port | global-udp-port}
outside-local-address {global-tcp-port |
global-udp-port}}
Step 3 switch(config)# copy running-config (Optional)
startup-config Saves the change persistently through reboots
and restarts by copying the running
configuration to the startup configuration.
This example shows how to map TCP services to a specific outside source address and TCP port:
switch# configure terminal
switch(config)# ip nat outside source static tcp 20.1.9.2 63 35.48.35.48 130
switch(config)# copy running-config startup-config
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 9
Configuring Static and Dynamic NAT Translation
Configuring Static Twice NAT
Procedure
Example:
Switch# configure terminal
Step 3 ip nat inside source static Configures static twice NAT to translate an inside
inside-local-ip-address global address to an inside local address or to
outside-global-ip-address [group group-id] translate inside local traffic to inside global traffic.
• The group keyword determines the group
Example: to which a translation belongs.
Switch(config)# ip nat inside source
static 10.1.1.1 192.168.34.4 group 4
Step 4 ip nat outside source static Configures static twice NAT to translate an
inside-local-ip-address outside global address to an inside local address
outside-global-ip-address [group group-id] or to translate inside local traffic to inside global
[add-route] traffic.
• The group keyword determines the group
Example: to which a translation belongs.
Switch(config)# ip nat outside source
static 209.165.201.1 10.3.2.42 group
4 add-route
Example:
Switch(config-if)# ip address 10.2.4.1
255.255.255.0
Step 7 ip nat {inside | outside} Connects the interface to an inside network, which
is subject to NAT.
Example:
Switch(config-if)# ip nat inside
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
10 OL-31635-01
Configuring Static and Dynamic NAT Translation
Configuring Static Twice NAT for an Outside Source Address
Procedure
Example:
switch# configure terminal
Step 3 ip nat outside source static local-ip-address Configures static twice NAT to translate the
global-ip-address [group group-id] inside global address to the inside local address
or to translate the outside local traffic to the
Example: outside global traffic.
switch(config)# ip nat outside source
static 10.1.1.1 192.168.34.4 group 4 • The group keyword determines the group
to which a translation belongs.
Step 5 ip address ip-address mask Sets a primary IP address for the interface.
Example:
switch(config-if)# ip address 10.2.4.1
255.255.255.0
Step 6 ip nat {inside | outside} Connects the interface to the inside network,
which is subject to NAT.
Example:
switch(config-if)# ip nat outside
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 11
Configuring Static and Dynamic NAT Translation
Configuring the NAT Limit
Procedure
Step 2 switch(config)# hardware profile tcam Configures the NAT TCAM limit. The valid
feature nat limit tcam-size range of tcam-size is from 2 to 2048.
The following example shows how to configure the NAT limit to 400.
switch# configure terminal
switch(config)# hardware profile tcam feature nat limit 400
switch(config)# show hardware profile tcam feature nat limit 400
switch(config)# copy running-config startup-config
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
12 OL-31635-01
Configuring Static and Dynamic NAT Translation
Example: Configuring Static Twice NAT
Procedure
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 13
Configuring Static and Dynamic NAT Translation
Configuring Dynamic NAT
Example:
Switch# configure terminal
Step 4 permit protocol source source-wildcard Sets conditions in an IP access list that permit
any traffic matching the conditions.
Example:
Switch(config-acl)# permit ip
10.111.11.0/24 any
Step 5 deny protocol source source-wildcard any Sets conditions in an IP access list that deny
packets from entering a network.
Example:
Switch(config-acl)# deny udp
10.111.11.100/32 any
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
14 OL-31635-01
Configuring Static and Dynamic NAT Translation
Configuring Dynamic Translation and Translation Timeouts
Example:
Switch(config)# ip nat inside source
list acl1 interface ethernet 1/1
overload
Step 9 ip address ip-address mask Sets a primary IP address for the interface.
Example:
Switch(config-if)# ip address
10.111.11.39 255.255.255.0
Example:
Switch(config-if)# ip address
172.16.232.182 255.255.255.240
Example:
Switch(config-if)# ip nat outside
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 15
Configuring Static and Dynamic NAT Translation
Verifying Dynamic and Static Twice NAT Configurations
Step 17 ip nat translation max-entries Specifies the maximum number of dynamic NAT
number-of-entries translations. The number of entries can be between
1 and 1023.
Example:
Switch(config)# ip nat translation
max-entries 300
Step 18 ip nat translation udp-timeout seconds Specifies the timeout value for UDP-based dynamic
NAT entries.
Example: • Dynamically created NAT translations are
Switch(config)# ip nat translation
udp-timeout 45000 cleared when the configured timeout limit is
reached. All configured timeouts are triggered
after the timeout configured for the ip nat
translation sampling-timeout command
expires.
Step 19 ip nat translation timeout seconds Specifies the timeout value for dynamic NAT
translations.
Example: • NAT uses this timeout value only if the
switch(config)# ip nat translation
timeout 13000 tcp-timeout or udp-timeout keywords are
not configured.
Step 1 enable
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
16 OL-31635-01
Configuring Static and Dynamic NAT Translation
Example: Configuring Dynamic Translation and Translation Timeouts
Example:
Switch> enable
Enables privileged EXEC mode.
• Enter your password if prompted.
Example:
Switch# show ip nat translations
Displays active Network Address Translation (NAT) translations.
• Displays additional information for each translation table entry, including when an entry was created
and used.
Example
The following is sample output from the show ip nat translations command:
switch# show ip nat translations
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
OL-31635-01 17
Configuring Static and Dynamic NAT Translation
Example: Configuring Dynamic Translation and Translation Timeouts
Cisco Nexus 5600 Series NX-OS Interfaces Configuration Guide, Release 7.x
18 OL-31635-01