Public vs Private IP Addresses

Understand the difference between public and private IPs, RFC 1918 ranges, and how NAT connects them.

Public vs Private IP Addresses

Not all IP addresses are created equal. The internet relies on a clear distinction between public and private addresses to manage the limited IPv4 address space efficiently.

Public IP Addresses

A public IP address is globally unique and routable on the internet. It's the address that websites and services see when your device connects to them. Your Internet Service Provider (ISP) assigns your router a public IP.

Key characteristics: - Unique across the entire internet - Assigned by ISPs from blocks allocated by Regional Internet Registries (RIRs) - Required for any device directly accessible from the internet

Private IP Addresses (RFC 1918)

Private IP addresses are reserved for use within local networks and are not routable on the public internet. Defined in RFC 1918, three ranges are designated for private use:

Range CIDR Addresses
10.0.0.010.255.255.255 10.0.0.0/8 16.7 million
172.16.0.0172.31.255.255 172.16.0.0/12 1 million
192.168.0.0192.168.255.255 192.168.0.0/16 65,536

The 192.168.x.x range is what most home routers use. Your laptop might be 192.168.1.5, your phone 192.168.1.6, and so on.

NAT: Bridging Private and Public

Network Address Translation (NAT) is the technology that allows multiple devices with private IPs to share a single public IP address. When your device sends data to the internet:

  1. Your device sends a packet from its private IP (e.g., 192.168.1.5)
  2. Your router replaces the source IP with its public IP (e.g., 203.0.113.50)
  3. The router tracks which internal device made the request in a NAT table
  4. When the response arrives, the router forwards it to the correct internal device

NAT is the primary reason the internet didn't run out of IPv4 addresses years ago. It allows millions of home and office networks to operate with just one public IP each.

How to Tell Which You Have

  • Your public IP: Visit a site like IPFYI or search "what is my IP"
  • Your private IP: Check your device's network settings (typically 192.168.x.x or 10.x.x.x)

If these two addresses are different (they almost always are), NAT is at work.

Lihat Juga