Networking 2 min read

Network address translation (NAT) is what lets all the phones, laptops and TVs in your home use the internet through a single public IP address. Your router does it automatically, millions of times a day.

How NAT works

  1. Your laptop at 192.168.1.20 opens a website. It sends the request to the router.
  2. The router replaces the private source address with its public address, and picks a free port number to tell the connections apart.
  3. It records the mapping in a table: laptop 192.168.1.20 port 51000 ↔ public IP port 40001.
  4. The website answers to the public IP and port 40001.
  5. The router looks up the table and forwards the answer to the laptop.

Because it tracks ports as well as addresses, this is technically PAT (port address translation) or "NAT overload", the most common form.

Why NAT exists

There are only about 4.3 billion IPv4 addresses, far fewer than the devices that need them. NAT lets each home use one public address and private addresses inside. Providers go one step further with carrier-grade NAT, sharing one public address between many homes.

Types of NAT

Type What it does
Static NAT One private address always maps to one public address
Dynamic NAT Private addresses take public ones from a pool as needed
PAT / NAT overload Many private addresses share one public address, told apart by port
CGNAT NAT done by the provider, for many customers at once

NAT types in gaming

Consoles show a NAT type that describes how easily other players can connect to you:

  • Open (Type 1 / Type A): others can connect directly. Usually requires a public IP and open ports or UPnP.
  • Moderate (Type 2 / Type B): you can connect to most players.
  • Strict (Type 3 / Type C): you can only join some sessions and cannot host.

To improve it: enable UPnP on your router, or set up port forwarding for the console, and make sure you are not behind CGNAT or a second router.

NAT and security

NAT is not a firewall, but it has a similar side effect: devices behind it cannot be reached from the internet unless a connection was started from inside or a port is forwarded. Keep the router's firewall on as well.

NAT and IPv6

With IPv6, every device can have its own public address, so NAT is usually not used. The router's firewall still blocks unrequested incoming connections.

Frequently asked questions

Does NAT hide my IP address?

It hides your devices' private addresses. Websites still see your public IP.

What is double NAT?

Two routers both doing NAT, for example a provider modem-router plus your own router. It can cause gaming and port forwarding problems; set one of them to bridge mode.

Can NAT slow down my internet?

Not noticeably on modern routers.