Course contents

Chapter 10: NAT ConfigurationLesson 2 of 7

Static NAT

A fixed one-to-one mapping, used when a server inside must be reachable from outside.

Intermediate · 7 min read

Technical definition

Static NAT is a form of NAT that permanently maps one inside local address to one inside global address, as configured by an administrator. Because the mapping always exists, it works in both directions, which lets outside hosts start connections to an inside server.

A server the world must reach

The office runs its website on Web1 (192.168.10.50). Customers on the internet type the site's name, DNS gives them a public address, and their browser connects. But Web1 has a private address, and nobody outside can reach it. Web1 needs a public address that always leads to Web1.

The ISP has given the office a small extra block, 203.0.113.16/29, and routes it to R1. You will use 203.0.113.21 for Web1.

A fixed mapping that works both ways

Static NAT is a fixed, one-to-one mapping between one inside local address and one inside global address. You type it once, and the router keeps it forever. It works in both directions:

  • Traffic to 203.0.113.21 from outside is sent to 192.168.10.50.
  • Traffic from 192.168.10.50 going out leaves as 203.0.113.21.
Diagram
Static NAT: the internet reaches Web1 through 203.0.113.21
Static NAT: the internet reaches Web1 through 203.0.113.21
Gi0/0 · insideGi0/1 · outsidePC1IP 192.168.10.11PC2IP 192.168.10.12Web1IP 192.168.10.50SW1NATR1 (NAT)edge routerISPIP 203.0.113.1InternetServerIP 198.51.100.10

Device key: PC1 (computer) · PC2 (laptop) · Web1 (server) · SW1 (switch) · R1 (NAT), ISP (router)

Lines show the example’s network connections. Thick links: uplinks/WAN, as labelled. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.

Reading the addresses

IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.

An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.

  • PC1: IP 192.168.10.11
  • PC2: IP 192.168.10.12
  • Web1: IP 192.168.10.50
  • R1 (NAT): edge router
  • ISP: IP 203.0.113.1
  • Server: IP 198.51.100.10
  1. 1. A visitor connects. The client at 198.51.100.10 sends to 203.0.113.21. The ISP routes that block to R1.
  2. 2. R1 uses its fixed mapping. No outbound packet was needed first. R1 changes the destination to 192.168.10.50 and delivers it.
  3. 3. The reply goes out. R1 changes Web1's source back to 203.0.113.21, so the client sees the address it expected.

Why visitors can start the connection

With the other kinds of NAT, an entry only appears after an inside device sends something out. A visitor on the internet can't start a connection, because R1 wouldn't know which inside device to send it to. Static NAT solves that: the entry exists before any traffic. The cost is one public address per server, which is why static NAT is used for servers, not for every PC.

Diagram
Why visitors can start the connection
Why visitors can start the connection
Static NATDynamic NAT / PAT
Entry createdWhen you configure itWhen an inside host sends traffic
Outside can start a connection?YesNot reliably (PAT: no)
Public addresses usedOne per inside hostShared
Typical useWeb, mail and VPN serversPCs and phones
Read each row across: the left box names the item, the others describe it.

Mapping Web1 to 203.0.113.21

Based on Cisco IOS / IOS XE documentation, not run on a lab device.

interface GigabitEthernet0/0 ip address 192.168.10.1 255.255.255.0 ip nat inside interface GigabitEthernet0/1 ip address 203.0.113.2 255.255.255.252 ip nat outside

Mark which side is which. Every kind of NAT needs this step.

ip nat inside source static 192.168.10.50 203.0.113.21

Global config: inside local first, then inside global.

Sometimes you only have one public address, the one on Gi0/1. Then you can map a single port instead of the whole address. This is called static PAT, or port forwarding:

ip nat inside source static tcp 192.168.10.50 443 interface GigabitEthernet0/1 443

HTTPS (TCP 443) arriving on R1's outside address is sent to Web1. Other ports are not forwarded.

In practice, when a new static mapping doesn't work, check the ip nat inside and ip nat outside lines first. A missing or swapped marking stops the translation even though the mapping itself is correct.

The entry that exists before any traffic

This output is based on Cisco documentation, not run on a lab device.

Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show ip nat translations
Pro Inside global         Inside local          Outside local         Outside global
--- 203.0.113.21          192.168.10.50         ---                   ---
tcp 203.0.113.21:443      192.168.10.50:443     198.51.100.10:50122   198.51.100.10:50122
Total number of translations: 2
The first row, with --- in the protocol and outside columns, is the static entry itself. It is always there, even with no traffic. The second row appeared when the client at 198.51.100.10 opened an HTTPS connection to Web1.
Example output · based on Cisco documentation; exact format varies by platform and software version
R1#show running-config | include ip nat
 ip nat inside
 ip nat outside
ip nat inside source static 192.168.10.50 203.0.113.21
A quick way to check both interfaces and the mapping at once.

Test yourself on static NAT

Predict · scenario 1

In 'ip nat inside source static 192.168.10.50 203.0.113.21', which address is the inside global?

Predict · scenario 2

The office has 3 servers that must each be reachable on all ports. How many public addresses does static NAT need?

Predict · scenario 3

With no traffic at all, does a static NAT entry show in show ip nat translations?