No history yet

Introduction to NAT

The IP Address Shortage

When the internet was first designed, engineers assigned addresses using a system called IPv4. It provided about 4.3 billion unique addresses, which seemed like more than enough at the time. But the internet exploded in popularity. Soon, every computer, phone, and server needed its own address, and it became clear that we were going to run out.

To solve this, a clever workaround was developed. A special range of IP addresses was set aside for private use. You've probably seen them before, like 192.168.1.1 or 10.0.0.1. These are addresses for local networks—the one in your home, at a coffee shop, or in an office. Millions of different networks can reuse these same private addresses without any conflict.

This created a new problem. If countless devices use the same private IPs, how do they communicate with the global internet, which requires a unique public IP address?

Meet Network Address Translation

The solution is Network Address Translation, or NAT. Think of NAT as a receptionist for your entire local network. All the devices in your home or office are in a private building, each with its own internal extension number (a private IP address). The outside world, however, only sees the building's single public street address (a public IP address).

Network Address Translation (NAT)

noun

A method used by routers to modify the network address information in the header of IP packets as they travel between a private network and a public network.

When your computer (with a private IP) wants to visit a website, it sends a request to your router. The router, which has a unique public IP address assigned by your internet provider, acts as a middleman. It swaps out your computer's private source IP for its own public IP and forwards the request to the website.

When the website responds, the data comes back to the router's public address. The router then looks at its records, sees which internal device made the original request, and forwards the data to the correct private IP. This process allows many devices to share a single public IP address, massively conserving the limited supply of IPv4 addresses.

A key side effect of NAT is improved security. Since your devices' private IP addresses are hidden behind the router's public IP, it's much harder for outsiders to directly target a specific computer on your local network.

Types of NAT

NAT isn't a one-size-fits-all solution. It comes in a few different flavors, each suited for different tasks.

TypeMappingCommon Use Case
Static NATOne-to-oneA single private IP is permanently mapped to a single public IP. Useful for a web server inside a private network that must be reachable from the internet.
Dynamic NATMany-to-manyA private IP is mapped to an available public IP from a pool. The public IP can change. Good for organizations with more devices than available public IPs.
PAT (NAT Overload)Many-to-oneMultiple private IPs are mapped to a single public IP, using different port numbers to track connections. This is the most common type, used in nearly all home routers.

The most common type you'll encounter is Port Address Translation (PAT), also called NAT Overload. This is the magic that lets your laptop, phone, and smart TV all use the internet at the same time through one connection.

Lesson image

When your laptop sends a request to the internet, the router doesn't just change the IP address; it also assigns a unique port number to the connection. It keeps a table that looks something like this:

  • 192.168.1.100 (your laptop) on port 54001 is talking to Google.
  • 192.168.1.150 (your phone) on port 54002 is streaming music.

When data comes back, the router checks the port number to see where it should go. This system allows a single public IP address to handle thousands of unique connections simultaneously.

Quiz Questions 1/5

What was the primary problem that led to the development of Network Address Translation (NAT)?

Quiz Questions 2/5

In the common analogy, a router performing NAT is like a receptionist for an office building. What does the building's single public street address represent?

NAT is a fundamental networking concept that solved a critical problem and shaped the structure of the modern internet. By translating addresses, it conserves IPs and adds a layer of security to local networks.