← Learn networking

NAT and PAT Explained: How Private Networks Share One Public Address

5 min read

IPv4 has about 4.3 billion addresses — nowhere near enough for every device on earth. Two mechanisms stretched the supply: private addressing (RFC 1918 ranges that are never routed on the public internet) and NAT (Network Address Translation), which lets a whole private network share one or a few public addresses. PAT — Port Address Translation, also called NAT overload — is the variant running in virtually every home and office router.

In simple words

Think of an apartment building with one street address. From outside, every resident shares that address — what tells them apart is the flat number. PAT is the building's reception: your home network has one public IP address, and the router keeps track of which "flat" (port number) belongs to which device, so replies always reach the right laptop or phone.

The three private ranges

These blocks are reserved for internal use and are dropped by internet routers:

  • 10.0.0.0/8 — 16,777,216 addresses (large enterprises)
  • 172.16.0.0/12 — 1,048,576 addresses (medium networks)
  • 192.168.0.0/16 — 65,536 addresses (homes and small offices)

Because they are not globally unique, they can be reused behind every NAT device on the planet — your 192.168.1.10 and your neighbour's are different machines, and that is fine.

The three flavours of NAT

  • Static NAT maps one private address to one public address permanently (1:1). Used when an internal server must be reachable from the internet at a fixed address.
  • Dynamic NAT maps private addresses to a *pool* of public addresses on demand. Better utilisation than static, but still one public address per active private host.
  • PAT (overload) maps many private addresses to a *single* public address by also translating the TCP/UDP port. This is the one that lets hundreds of devices share one public IP, and it is what this article focuses on.

How PAT keeps track: the translation table

The router maintains a table of active translations. Each entry records the inside-local address and port, the inside-global address and port, and the destination. When a reply comes back to the public address and translated port, the router looks up the table, swaps the destination back, and forwards the packet to the right internal host. Return traffic works because the table remembers who started each conversation.

Worked example: two laptops, one public address

The office router's public address is 203.0.113.5. Two laptops browse the web:

  • Laptop A (192.168.1.10) opens a connection from source port 52341. The router creates entry: 192.168.1.10:52341 → 203.0.113.5:1024. The web server sees the connection coming from 203.0.113.5:1024.
  • Laptop B (192.168.1.11) also happens to use source port 52341. No conflict: the router creates 192.168.1.11:52341 → 203.0.113.5:1025. A different translated port keeps the flows distinct.
  • Replies arriving at 203.0.113.5:1024 go to Laptop A; :1025 to Laptop B. Neither laptop knows translation happened.

With source ports 1024–65535 available, a single public address supports roughly 65,000 simultaneous sessions — the practical limit people call "port exhaustion".

Worked example: two laptops, one public address
1/4
Laptop A192.168.1.10Laptop B192.168.1.11Routerpublic IP: 203.0.113.5Web server

Two laptops share one router with a single public IP: 203.0.113.5.

  1. Two laptops share one router with a single public IP: 203.0.113.5.
  2. Laptop A sends from source port 52341: 192.168.1.10:52341 → 203.0.113.5:1024
  3. Laptop B uses the SAME source port 52341: 192.168.1.11:52341 → 203.0.113.5:1025
  4. Replies come back: the router delivers the :1024 reply to Laptop A and the :1025 reply to Laptop B.

Publishing a server: static NAT and port forwarding

Not everything can hide behind PAT — sometimes the internet must reach *in*. A company web server at 192.168.1.50 gets a static NAT entry mapping it 1:1 to public 203.0.113.10; unlike PAT entries, this mapping is permanent and doesn't depend on outbound traffic. An inbound ACL then permits only the needed ports — 80 and 443 — to 203.0.113.10, and the router translates the destination to 192.168.1.50 before forwarding. When public addresses are scarce, port forwarding achieves the same with PAT mechanics: a fixed rule maps 203.0.113.5:8080 to 192.168.1.50:80, so the server is reachable on a non-standard port of the shared address. Both are just permanent translation-table entries. The security principle is unchanged in each case: translate only what you must, permit only the ports the service needs, and let the firewall — not the NAT table — be the policy.

What NAT does not do

NAT is not a firewall. It happens to block unsolicited inbound traffic — because there is no table entry for a conversation nobody started — but that is a side effect, not a security policy. Stateful firewalls and ACLs are still required. NAT also breaks protocols that embed addresses inside their payloads (classic FTP, some VoIP signalling), which is why routers include ALGs (Application Layer Gateways) to rewrite those payloads.

The address crisis NAT postponed

In the early 1990s the internet faced a genuine emergency: classful addressing was wasting millions of addresses, and exhaustion was forecast within years. Two emergency measures, standardised together in 1994, bought the time needed: CIDR (RFC 1519), which replaced rigid classes with arbitrary prefix lengths, and NAT (RFC 1631), which let whole networks hide behind few public addresses. They worked almost too well — thirty years later, IPv4 is still the dominant protocol and the transition to IPv6 is still incomplete. NAT was meant as a short-term hack; it became permanent infrastructure. Understanding it matters not because it's elegant, but because it's everywhere: every home router, every enterprise edge, and every cloud NAT gateway runs the same translation table described in this article.

At a glance: why, where, when, how

  • Why: the world ran out of IPv4 addresses; NAT/PAT lets a whole network of private addresses share a few public ones.
  • Where: in every home router, office firewall, and cloud NAT gateway — you are almost certainly behind one right now.
  • When: every time a device with a private address talks to the public internet.
  • How: the router rewrites the source address (and port) on the way out, records it in a translation table, and reverses the rewrite on replies — as this article's worked example shows.

Advantages and disadvantages

Advantages

  • Saves public addresses: hundreds of devices share one public IP.
  • A side benefit: unsolicited inbound traffic has no table entry and is dropped, which hides internal devices by default.
  • Freedom inside: you can renumber or grow your private network without telling the internet.

Disadvantages

  • Breaks end-to-end design: inbound connections fail unless you add port forwarding or static NAT.
  • Some protocols embed addresses in their data (older FTP, some VoIP) and need ALG helpers to survive translation.
  • One shared address means one bad user can get the address blocklisted for everyone behind it.

Real-life example

At home, your laptop, phone, TV and tablet all browse, stream and update at the same time — yet your internet provider gave your house exactly one public IP address. Your router is doing PAT thousands of times a day: every request goes out under that one address with a different port "flat number", and every reply is delivered back to the right device. Nobody in the family ever sees it happen.

FAQ

Why do online games ask me to forward ports?

Because PAT only permits return traffic for connections you initiated. An inbound game-server connection arrives unsolicited, so there is no table entry — the router drops it. Port forwarding creates a permanent entry pointing that port at your console or PC.

Does NAT hide my internal network structure?

Partly — the internet sees only the public address. But it is obscurity, not security: treat NAT as address conservation and run a real firewall for protection.

What about IPv6?

IPv6 restores end-to-end addressing — every device can have a globally unique address, so NAT is unnecessary. Enterprises sometimes still use IPv6-to-IPv6 "NAT" for topology hiding, but it is not needed for address conservation.

Related: NAT / PAT