How IP Addresses Work
What Is NAT (Network Address Translation)?
NAT is the quiet workhorse that let the internet keep growing after IPv4 addresses became scarce. Your home router does it every second.
The problem
Your home has many devices online but usually just one public IPv4 address from your ISP. How can a laptop, three phones, a TV, and a console all share a single address and still receive the right replies? The answer is Network Address Translation.
How NAT works
When a device on your private network sends a request to the internet, your router rewrites the packet so it appears to come from the router's single public address. It records the mapping in a table — which internal device and port the request came from. When the reply arrives, the router consults its table and forwards the response to the correct internal device.
Because it tracks port numbers as well as addresses, this common form is often called Port Address Translation (PAT) or "NAT overload." It lets thousands of connections share one public IP without confusion.
An unexpected side effect: security
NAT was invented to conserve addresses, but it brings a side benefit. Because devices behind NAT have no directly reachable public address, unsolicited traffic from the internet has nowhere to land by default. This is not a real firewall, but it does hide internal devices from casual probing.
The downsides
NAT complicates any situation where an outside device needs to start a connection to something inside your network — hosting a game server, running a webcam, or peer-to-peer apps. Workarounds include port forwarding (manually mapping an external port to an internal device) and various automatic hole-punching techniques.
NAT and IPv6
IPv6's enormous address space means every device can have its own public address, so NAT is largely unnecessary there. Until IPv4 fully retires, though, NAT remains one of the most important pieces of plumbing on the internet — and the reason your public IP belongs to your router, not to any single device behind it.