Network Address Translation end to end: static/dynamic NAT and PAT/NAPT, SNAT vs DNAT, Cisco inside/outside terminology, how PAT rewrites and tracks flows, checksum recompute, what breaks (ALGs, IPsec NAT-T, hairpinning), NAT behavior types & traversal (STUN/TURN/ICE), CGNAT and NAT64.
NAT rewrites addresses (and usually ports) as packets cross a boundary — the workaround that let a shrinking IPv4 space serve billions of hosts. It's simple in the common case and full of edge cases interviewers love: what breaks end-to-end, why some protocols need help, and how peers behind NAT ever talk to each other.
The one that matters is PAT / NAPT (a.k.a. "NAT overload"): many private hosts share one public IP by multiplexing on source port. The router keeps a translation table and reverses the rewrite on the return packet.
| Type | What it does |
|---|---|
| Static NAT | Fixed 1:1 mapping (one private ↔ one public). Used to publish a server. |
| Dynamic NAT | Many private → a pool of public, first-come; still 1:1 while active. |
| PAT / NAPT (overload) | Many private → one public, disambiguated by port. The home/office default. |
| SNAT vs DNAT | Rewrite the source (outbound, hide clients) vs the destination (inbound, port-forward / load-balance). |
Cisco's four-address vocabulary: inside local (real private), inside global (the public it's translated to), outside global (real Internet host), outside local (how the outside appears inside) — "inside/outside" = whose host, "local/global" = which side of the NAT you're looking from.
10.0.0.5:51000 → 93.184.216.34:443 hits the NAT.203.0.113.1:62000, stores the mapping
(10.0.0.5:51000) ↔ (203.0.113.1:62000) keyed by the 5-tuple, and forwards.203.0.113.1:62000 is matched in the table and rewritten back to
10.0.0.5:51000.For peer-to-peer (VoIP, gaming, WebRTC) the NAT's behavior decides whether hole-punching works:
| Behavior | Return traffic allowed from… |
|---|---|
| Full-cone | Any external host, once a mapping exists (easiest to traverse). |
| Restricted-cone | Only IPs the inside host already sent to. |
| Port-restricted | Only the same IP+port the inside host sent to. |
| Symmetric | A new mapping per destination — hardest; often needs a relay. |
STUN discovers your public mapping, TURN relays when direct fails, and ICE tries candidates in order — the WebRTC stack.