Networking · · 3 min read

What is NAT?

Learn how Network Address Translation (NAT) works - lets home networks and data centres share one public IPv4 address, hides private hosts and enables port forwarding for servers.

Featured image from the ELI5 series. The image features some retro colouring/ design with the title "What is.. NAT?"

Network Address Translation (NAT) lets dozens or even thousands of devices at home, in an office or inside a data-centre share one public IP address on the internet. A NAT-capable router rewrites every outgoing packet so that the wider world only ever sees its own public address, then keeps a short-lived table so return traffic can find its way back. This saves scarce IPv4 addresses, hides internal hosts from casual scans and gives administrators an easy way to steer traffic with features such as port forwarding. Despite the growth of IPv6, NAT remains common wherever IPv4 is still in use.

Why we needed NAT in the first place

Address exhaustion

IPv4 has roughly four billion unique addresses. Long before the web exploded, engineers saw that pool would run dry. Private address ranges such as 192.168.0.0/16 or 10.0.0.0/8 were set aside for local networks; routers using NAT translate those private addresses to a smaller public pool as packets leave the site.

A simple telephone-switch analogy

Imagine everyone in a block of flats sharing one outward-facing phone line. The building’s switchboard adds an extension number when you dial out, then listens for that extension on incoming calls to put them back through. NAT performs the same trick with IP addresses and, when needed, port numbers.

How NAT Works

  1. Packet leaves a device - Source IP 192.168.1.10, source port 50932.
  2. Router rewrites it - Replaces 192.168.1.10 with its own public IP (for example, 203.0.113.5) and may change the port, e.g. to 45012. It stores a line in a translation table:
Inside IPInside portOutside IPOutside portTimestamp
192.168.1.1050932203.0.113.54501210:15:07
  1. Response arrives - Destination 203.0.113.5:45012 matches the table, so the router rewrites the packet back to 192.168.1.10:50932 and forwards it indoors.

This split-second bookkeeping is invisible to users and applications.

Common flavours of NAT

Port forwarding - Letting the world call you back

Some applications such as game servers, CCTV streams, remote desktop need unsolicited inbound connections. Port forwarding (sometimes “destination NAT”) tells the router to send traffic that arrives on a chosen public port straight to a particular internal host and port.

Image depicting a simple diagaram where a web request comes in on port 443 to the routers poublic ip, then passes it to the internal web server.
A request comes in from the internet on port 443 to the public IP address on the router. The router has a port forwarding rule that any traffic received on this port is to be forwarded to the internal web server, displaying the web page for the end user.

Benefits and Trade-offs

Pros

Cons

Does IPv6 make NAT obsolete?

IPv6 offers 3.4 × 10³⁸ addresses, enough for every grain of sand to have several billion IPs. In theory, every device can sit directly on the internet without translation. Most operators therefore avoid NAT66 and keep the end-to-end model "pure". That said, some organisations still use it for provider-independent addressing or multi-homing, so NAT knowledge will not vanish overnight.

FAQ

Do I still need NAT if my ISP gives me IPv6?

You can run dual stack: IPv4 traffic uses NAT, IPv6 traffic does not. NAT is only required where IPv4 is present.

Is NAT the same as a firewall?

No. NAT changes addresses; a firewall enforces policy. Many home routers bundle both features, which causes confusion.

Why does my online game complain about “Strict NAT”?

The game wants inbound connections to your console or PC. Opening the suggested ports or enabling UPnP usually fixes it.

Can NAT improve security?

It hides internal IPs, adding a small obstacle, but serious defence still relies on patching, strong passwords and proper firewall rules.

Read next