Course contents

Chapter 10: NAT ConfigurationLesson 4 of 7

PAT (NAT overload)

Many inside devices sharing one public address, kept apart by port numbers.

Intermediate · 8 min read

Technical definition

PAT (Port Address Translation) is a form of NAT, called NAT overload by Cisco, that lets many inside hosts share one public IP address. The router translates both the address and the TCP or UDP port number and records each address-and-port pair, so it can tell the conversations apart and send replies to the right host.

Twenty PCs, one address

Most offices and homes have just one public address: the one on the router's outside interface. In the office that is 203.0.113.2. Dynamic NAT would let only one PC online at a time. Yet all twenty PCs need the internet at once. PAT makes this possible.

Ports keep the conversations apart

PAT (Port Address Translation), which Cisco calls NAT overload, lets many inside hosts share one public address. To tell the conversations apart, the router also looks at port numbers. A port is a number from 0 to 65535 in the TCP or UDP header that identifies one conversation on a device. A browser, for example, picks a random source port such as 51000 for each connection.

So instead of recording "address ↔ address", R1 records "address and port ↔ address and port". R1 tries to keep the original source port. If another host is already using that port on the public address, R1 picks a different free one.

Diagram
PAT: two PCs share 203.0.113.2
PAT: two PCs share 203.0.113.2
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. Two PCs, same source port. PC1 and PC2 both open HTTPS to the server, and by chance both pick source port 51000.
  2. 2. R1 keeps them apart. PC1 keeps port 51000. That is taken for PC2, so R1 gives PC2 port 1024. Both leave as 203.0.113.2.
  3. 3. Replies are sorted by port. A reply to port 1024 must belong to PC2, so R1 rewrites it to 192.168.10.12:51000.
Diagram
Ports keep the conversations apart
Ports keep the conversations apart
Inside localInside globalOutside
192.168.10.11:51000203.0.113.2:51000198.51.100.10:443
192.168.10.12:51000203.0.113.2:1024198.51.100.10:443
Read each row across: the left box names the item, the others describe it.

Why one public address is enough for an office

Every row in a PAT table is unique, because the public port is unique. With about 64,000 usable ports per protocol, one address can carry tens of thousands of conversations at once. That is plenty for a home or a small office. Large sites can use a small pool of addresses with overload to get more ports.

Static NATDynamic NATPAT
Mapping1 to 1, fixed1 to 1, from a poolMany to 1, by port
Public addressesOne per hostOne per active hostOften just one
Keywordstaticpooloverload

Interface PAT or pool PAT

Based on Cisco IOS / IOS XE documentation, not run on a lab device. The interfaces are marked inside and outside as in the “Static NAT” lesson.

access-list 1 permit 192.168.10.0 0.0.0.255

The inside hosts that may use PAT.

ip nat inside source list 1 interface GigabitEthernet0/1 overload

Interface PAT: share the address on Gi0/1. If the ISP changes that address (for example by DHCP), NAT follows it.

Or, to overload a pool of addresses instead of the interface:

ip nat pool PUBLIC 203.0.113.17 203.0.113.20 netmask 255.255.255.248 ip nat inside source list 1 pool PUBLIC overload

Pool PAT: the same as dynamic NAT, plus the overload keyword.

In practice, interface PAT is the usual choice on a branch router with one public address from the ISP: the configuration keeps working when that address changes.

One address, many ports in the translation table

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
tcp 203.0.113.2:51000     192.168.10.11:51000   198.51.100.10:443     198.51.100.10:443
tcp 203.0.113.2:1024      192.168.10.12:51000   198.51.100.10:443     198.51.100.10:443
udp 203.0.113.2:53122     192.168.10.12:53122   198.51.100.10:53      198.51.100.10:53
icmp 203.0.113.2:7        192.168.10.11:7       198.51.100.10:7       198.51.100.10:7
Total number of translations: 4
Every inside global address is the same, 203.0.113.2. Only the port changes. There are no --- rows: PAT creates a row per conversation, not per host. For ping (ICMP), the router uses the ICMP query ID in place of a port.

Test yourself on PAT

Predict · scenario 1

What lets R1 tell apart replies for PC1 and PC2 when both use 203.0.113.2?

Predict · scenario 2

Which keyword turns dynamic NAT into PAT?

Predict · scenario 3

PC1 uses source port 49200 and no one else is using it. What port will R1 most likely use outside?