Why it matters
NAT is why home networks work despite IPv4 exhaustion. Understanding it clarifies connectivity issues and P2P design.
Advertisement
The architecture
NAT gateway: maps outbound connections. Tracks internal IP:port ↔ external IP:port mapping in state table.
Types: full-cone, restricted-cone, port-restricted, symmetric (varying restrictiveness).
Advertisement
How it works end to end
Outbound: client → NAT → external. NAT maps and tracks. Response uses tracked mapping.
Inbound: unsolicited traffic to public IP has no mapping — dropped.
Port forwarding: manually add inbound mapping. Enables hosting services behind NAT.
NAT traversal: STUN (discover mapping), TURN (relay when direct fails), UPnP (device asks for mapping).