Why IPv4 Ran Out of Addresses and How NAT Saved the Internet


When the Internet was designed in the 1970s, nobody imagined billions of smartphones, smart TVs, and IoT devices would one day be fighting for addresses. Back then, the addressing scheme seemed limitless. But by the late 1990s, cracks began to appear: IPv4, the backbone of the Internet, was running out of space.

This is the story of how IPv4 hit its limits and how Network Address Translation (NAT) became the unsung hero that kept the Internet alive.




The Basics: What Is IPv4?

  • IPv4 stands for Internet Protocol version 4.
  • It uses 32-bit addresses, written as four numbers separated by dots (e.g., 192.168.0.1).
  • With 32 bits, IPv4 can generate around 4.3 billion unique addresses.

At first glance, 4.3 billion sounds like a lot. But consider:

  • Every computer, phone, and server needs an address.
  • Enterprises, ISPs, and universities were allocated huge blocks of addresses in the early days.
  • Many blocks were wasted or underused.

By the early 2000s, the exhaustion problem was real.




Public vs Private IP Addresses

IPv4 addresses are divided into two categories:

  1. Public IP addresses

    • Globally unique and routable on the Internet.
    • Assigned by regional internet registries (like ARIN, RIPE, APNIC).
    • Example: 8.8.8.8 (Google DNS).
  2. Private IP addresses

    • Reserved ranges that can be reused inside local networks.
    • Not routable directly on the Internet.
    • Examples:
      • 10.0.0.010.255.255.255
      • 172.16.0.0172.31.255.255
      • 192.168.0.0192.168.255.255

Private addresses gave us some relief, but they created a new challenge:

👉 How do devices with private addresses communicate with the wider Internet?




The IPv4 Crunch: Why 4.3 Billion Wasn’t Enough

Here’s why IPv4 space ran out faster than expected:

  • Inefficient allocation Early networks received enormous chunks (Class A /8 blocks = 16 million addresses each), even if they didn’t need them.

  • Population growth of devices Laptops, phones, tablets, and IoT devices exploded in number.

  • Always-on connectivity Devices started staying online permanently, consuming addresses continuously.

  • Global scale With billions of people worldwide needing connectivity, 4.3 billion wasn’t nearly enough.




Enter NAT: The Lifesaver

Network Address Translation (NAT) was introduced to bridge the gap.

Instead of giving every device a unique public IP, NAT allows multiple devices to share a single public IP.

How it works:

  1. Inside your home, devices use private IPs like 192.168.1.10 or 192.168.1.20.
  2. The router runs NAT, which keeps a translation table.
  3. When your laptop sends a request to google.com, NAT rewrites the source private IP to your home’s public IP.
  4. When Google replies, NAT consults its table to send the packet back to the right device.

This process is invisible to users but absolutely vital for the modern Internet.




Types of NAT (with Examples)

To really understand NAT, let’s look at the three main types: Static NAT, Dynamic NAT, and PAT (Port Address Translation).



1. Static NAT — One-to-One Mapping

Scenario:

You host a web server in your private network with IP 10.0.0.10. You own a public IP 203.0.113.10. You want Internet users to reach your server.

[Internet] ──(203.0.113.10)── [NAT Router] ──(10.0.0.10)── [Web Server]
Enter fullscreen mode

Exit fullscreen mode

How it works:

  • NAT always maps 10.0.0.10203.0.113.10.
  • Requests for 203.0.113.10 are forwarded to 10.0.0.10.
  • Replies from 10.0.0.10 are rewritten to appear from 203.0.113.10.

NAT Table:

10.0.0.10:80  <->  203.0.113.10:80
Enter fullscreen mode

Exit fullscreen mode

Use case: Hosting a website, VPN, or mail server.

Limitation: Wastes a public IP for each server.




2. Dynamic NAT — Many-to-Many (Using a Pool)

Scenario:

An office network (10.0.1.0/24) has a pool of three public IPs: 203.0.113.20–22.

How it works:

  • First user gets 203.0.113.20.
  • Second user gets 203.0.113.21.
  • Third user gets 203.0.113.22.
  • If a fourth user tries to connect, they must wait until one address is free.

NAT Table at one moment:

10.0.1.11  <->  203.0.113.20
10.0.1.12  <->  203.0.113.21
10.0.1.13  <->  203.0.113.22
Enter fullscreen mode

Exit fullscreen mode

Use case: Older enterprise networks.

Limitation: If the pool is too small, users can’t connect.




3. PAT (Port Address Translation) — Many-to-One (Most Common)

Scenario:

Your home has many devices (192.168.1.0/24). Your ISP gives you one public IP: 198.51.100.23.

[Phone 192.168.1.11]     \
[Laptop 192.168.1.10] ---- [NAT Router] ---- (198.51.100.23) ---- [Internet]
[TV    192.168.1.12]     /
Enter fullscreen mode

Exit fullscreen mode

How it works:

  • Laptop → 192.168.1.10:52344 becomes 198.51.100.23:40001.
  • Phone → 192.168.1.11:50123 becomes 198.51.100.23:40002.
  • NAT uses port numbers to keep connections separate.

NAT Table:

192.168.1.10:52344  <->  198.51.100.23:40001
192.168.1.11:50123  <->  198.51.100.23:40002
Enter fullscreen mode

Exit fullscreen mode

Use case: Home and small-business routers.

Limitation: Devices cannot be reached from the Internet unless port forwarding is set up.




Bonus: Port Forwarding with PAT

If you want to allow outside access to a private server, you can forward a specific port.

Example: Allow SSH into your internal machine 192.168.1.50:22 through public IP 198.51.100.23.

  • Rule: 198.51.100.23:2222192.168.1.50:22
  • A remote user connects with:
  ssh user@198.51.100.23 -p 2222
Enter fullscreen mode

Exit fullscreen mode

NAT translates the request and sends it to your internal server.




Quick Comparison

Type Mapping Use Case Pros Cons
Static NAT One-to-one Hosting servers with fixed IPs Stable, predictable Consumes a public IP per host
Dynamic NAT Many-to-many Older enterprise setups Simple in concept Pool exhaustion possible
PAT Many-to-one Home & SMB networks (most common) Conserves public IPs, scalable Breaks inbound by default



ASCII Diagram: How PAT Works (Home Router Example)

Device A: 192.168.1.10:52344  --->
                                       NAT Router (Public IP 198.51.100.23)
Device B: 192.168.1.11:50123  --->
                                       NAT Table:
                                       192.168.1.10:52344 -> 198.51.100.23:40001
                                       192.168.1.11:50123 -> 198.51.100.23:40002

From Internet’s view:
198.51.100.23:40001 -> goes back to Device A
198.51.100.23:40002 -> goes back to Device B
Enter fullscreen mode

Exit fullscreen mode




The Drawbacks of NAT

NAT isn’t perfect. Some issues include:

  • Breaks end-to-end connectivity: Devices behind NAT can’t be directly reached from the Internet without port forwarding.
  • Complicates protocols: Some applications (VoIP, peer-to-peer) need special handling.
  • Adds overhead: Routers must maintain NAT tables and modify packets.

Still, NAT was far easier than re-architecting the Internet overnight.




What About IPv6?

The long-term solution to address exhaustion is IPv6.

  • IPv6 uses 128-bit addresses, giving us about 3.4 × 10^38 possible addresses.
  • That’s enough for every grain of sand on Earth to have its own IP address.

But IPv6 adoption has been slow, so NAT remains critical today.




Conclusion

IPv4 was never designed for the modern scale of the Internet. When we ran out of addresses, NAT stepped in as a clever workaround — allowing billions of devices to connect without needing billions of public IPs.

Even though IPv6 is the future, NAT is the technology that kept the Internet alive during IPv4’s growing pains. Every time you connect to Wi-Fi at home, at work, or in a café, you’re witnessing NAT at work.


👉 Next time you browse online, remember: behind the scenes, your device may be sharing a single public identity with thousands of others—all thanks to NAT.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *