Network Address Translation
Rewriting the addresses in packets as they cross a router so that many devices can share one public IPv4 address, a stopgap that became permanent and broke the internet's end-to-end design.
Network address translation (NAT) lets a router rewrite the IP addresses, and usually the port numbers, of packets passing through it. Its everyday use is sharing one public IPv4 address among every device in a home or office. Devices get private addresses from reserved ranges such as 192.168.0.0/16 and 10.0.0.0/8, which are not routed on the public internet. The router swaps in its own public address on the way out and reverses the swap on the way back.
It was proposed in 1994 as a temporary measure. IPv4 has about 4.3 billion addresses, which was clearly too few as the internet grew, and the real fix, IPv6, would take years to deploy. NAT bought time, and IPv4's central free pool was still exhausted in 2011. NAT turned out to be the permanent arrangement for most networks.
How the common form works:
- When a device at
192.168.1.20:51000opens a connection, the router picks a free port on its public address, say203.0.113.5:62001, and records the pair in a translation table. - Replies to
203.0.113.5:62001match that entry and are rewritten back to the device. - Entries expire after a period of silence, so long-lived connections send keepalives to hold their mapping open.
- Packets that arrive with no matching entry have nowhere to go and are dropped.
That last property makes NAT behave somewhat like a Firewall, since unsolicited inbound traffic can't reach the devices behind it. It is a side effect rather than a security design, and a real firewall with a default-deny policy does the job deliberately.
The cost is the end-to-end principle. On the original internet any host could reach any other. Behind NAT, a device can start connections but can't easily receive them, which breaks hosting, Peer-to-Peer applications, voice calls and multiplayer games. Workarounds pile up:
- Port forwarding, configured by hand or requested automatically with UPnP, maps a public Port to an internal device.
- NAT Traversal techniques such as hole punching let two devices behind NATs connect directly with help from a Signaling Server, and relay traffic when that fails. WebRTC and mesh Virtual Private Network tools depend on it.
Carrier-grade NAT (CGNAT) adds a second layer at the ISP, so many customers share one public address. Customers can't forward ports at all, and services can no longer tell users apart by IP address. That complicates Rate Limiting and abuse bans, since blocking one address may block a whole neighborhood.
NAT also appears inside machines. Containerization tools usually give containers private addresses and translate their traffic through the host. IPv6 has enough addresses for every device to have its own, removing the original reason for NAT, though many networks keep a firewall that blocks unsolicited inbound connections by default.
See also3
Port Scanning
Probing a machine's network ports to find which services are listening, the first step of both attacks and audits, now done to the entire internet in minutes, so anything exposed gets found.
Networks & Distribution9 connections
Wi-Fi
Wireless local networking over shared, unlicensed radio channels, where every device on a channel takes turns talking, which explains most of its speed, range, and reliability quirks.
Networks & Distribution13 connections
Subnet
A block of IP addresses that share a common prefix, written in CIDR notation such as 192.168.1.0/24, which decides what a device can reach directly and what it must send through a router.
Networks & Distribution13 connections
Linked from12
- FirewallNetworks & Distribution
A filter that allows or blocks network traffic by rule, the oldest perimeter defense, and less sufficient on its own than it used to be.
- Internet of ThingsNetworks & Distribution
Everyday objects with network connections, from thermostats and light bulbs to industrial sensors, notorious for weak security, dependence on vendor clouds, and devices that outlive the companies supporting them.
- IPv6Networks & Distribution
IPv6 exists mainly to end address scarcity, with a large enough space that per-device NAT becomes optional.
- MQTTNetworks & Distribution
A lightweight publish-subscribe protocol in which devices send small messages to topics on a central broker, the common language of sensors, smart homes, and industrial telemetry.
- NAT TraversalNetworks & Distribution
NAT traversal is the set of tricks two devices behind separate routers use to open a direct connection anyway.
- Network SocketNetworks & Distribution
The programming interface through which a program talks to the network, identified by an address and a port, and treated by the operating system as one more file descriptor.
- PortSystems & Tooling
The numeric endpoint a network service listens on, and a scarce shared resource on a developer machine.
- Port ScanningNetworks & Distribution
Probing a machine's network ports to find which services are listening, the first step of both attacks and audits, now done to the entire internet in minutes, so anything exposed gets found.
- Remote DesktopNetworks & Distribution
Controlling a computer from somewhere else by streaming its screen to a distant machine and sending keyboard and mouse input back, used for IT support, remote work and cloud gaming, and a favorite entry point for attackers when left exposed.
- Signaling ServerNetworks & Distribution
The small coordination service peers use to find each other before connecting directly.
- SubnetNetworks & Distribution
A block of IP addresses that share a common prefix, written in CIDR notation such as 192.168.1.0/24, which decides what a device can reach directly and what it must send through a router.
- Wi-FiNetworks & Distribution
Wireless local networking over shared, unlicensed radio channels, where every device on a channel takes turns talking, which explains most of its speed, range, and reliability quirks.