🌐

Understanding NAT and IPv4 Limitations

Apr 23, 2025

Network Address Translation (NAT) and IPv4

The Problem with IPv4

  • IPv4 Limitations:
    • Supports only 4.29 billion addresses.
    • Completely exhausted due to increasing number of internet-connected devices (20 to 30 billion).

Solution: Network Address Translation (NAT)

  • Purpose: Extends the functionality of IPv4 by allowing multiple devices on a local network to be mapped to a single public IP address.
  • Use Cases: Translates private IP addresses to public IP addresses, allowing communication over the internet.

Private vs. Public IP Addresses

  • Private IP Addresses: Defined by RFC 1918, not routable on the public internet.
    • Common ranges:
      • 10.0.0.0 to 10.255.255.255
      • 172.16.0.0 to 172.31.255.255
      • 192.168.0.0 to 192.168.255.255
    • Used in homes and businesses.

How NAT Works

  • Example Setup:
    • Private IP: 10.10.20.15
    • Public IP: 104.20.19.63
  • Process:
    • A private IP (10.10.20.15) wants to communicate with a public IP (104.20.19.63).
    • Router with NAT changes the source IP address to a public IP (e.g., 94.1.1.1).
    • The packet is then sent to the destination.
    • When the response comes back, the NAT router reverses the translation to send it back to the private IP.

Port Address Translation (PAT) or NAT Overload

  • Efficiency: Allows multiple devices on a local network to share one public IP address by using different port numbers.
  • Example:
    • Device VA:
      • Private IP: 10.10.20.15, Port: 3233
      • Public IP: 94.1.1.1, NAT-assigned Port: 1055
    • Device Jonas:
      • Private IP: 10.10.20.70, Port: 5782
      • Public IP: 94.1.1.1, NAT-assigned Port: 1056
  • Function:
    • The router maintains a NAT table linking private IPs and ports to a public IP and port.
    • Efficiently manages communication by incrementing port numbers to distinguish between different internal devices sharing the same external IP.

Conclusion

  • NAT and PAT are essential technologies for addressing the limitations of IPv4 by enabling multiple devices to connect to the internet through limited public IP addresses and ensuring efficient communication.