Every device on a network needs an IP address, but not all IP addresses are the same. Understanding the difference between public and private IP addresses is essential for network setup, security, and troubleshooting.
Public IP Addresses
A public IP address is globally unique and routable on the internet. It's assigned by your Internet Service Provider (ISP) and is how your network is identified to the outside world.
Characteristics of Public IPs
- Globally unique — No two devices can have the same public IP
- Internet routable — Can be reached from anywhere on the internet
- Assigned by ISP — You don't choose it (unless you pay for a static IP)
- Usually shared — All devices on your home network share one public IP
Public IP Ranges
Public IPs are all IPv4 addresses except the reserved private ranges and special-purpose ranges.
Private IP Addresses
A private IP address is used within local networks (home, office, etc.) and is not routable on the public internet. Multiple networks worldwide can use the same private IP ranges without conflict.
Private IPv4 Ranges (RFC 1918)
| Class | Range | CIDR | Addresses |
|---|---|---|---|
| A | 10.0.0.0 – 10.255.255.255 |
10.0.0.0/8 | 16,777,216 |
| B | 172.16.0.0 – 172.31.255.255 |
172.16.0.0/12 | 1,048,576 |
| C | 192.168.0.0 – 192.168.255.255 |
192.168.0.0/16 | 65,536 |
Characteristics of Private IPs
- Not globally unique — Millions of networks use 192.168.1.1
- Not internet routable — Packets won't be forwarded on the internet
- Assigned locally — Your router assigns them via DHCP
- Free to use — No registration required
Most home routers use 192.168.0.1 or 192.168.1.1 for their own address and assign devices addresses like 192.168.1.2, 192.168.1.3, etc.
How NAT Connects Them
NAT (Network Address Translation) is the technology that bridges public and private IPs. Your router performs NAT to allow multiple devices with private IPs to share a single public IP.
How NAT Works
- Outbound request: Your device (192.168.1.5) sends a request to a website
- Translation: Your router replaces the private IP with your public IP and notes the mapping
- Response returns: The website responds to your public IP
- Reverse translation: Your router looks up the mapping and forwards the response to 192.168.1.5
# Example NAT table
Private IP:Port Public IP:Port Destination
192.168.1.5:54321 → 203.0.113.10:54321 → google.com:443
192.168.1.8:49876 → 203.0.113.10:49876 → youtube.com:443
NAT Types
- SNAT (Source NAT) — Changes the source address of outgoing packets
- DNAT (Destination NAT) — Changes the destination address (used for port forwarding)
- PAT (Port Address Translation) — Most common; uses ports to track connections
Finding Your IP Addresses
Find Your Public IP
Visit WhatIP.ca — your public IP is displayed instantly.
Find Your Private IP
Windows:
ipconfig
# Look for "IPv4 Address" under your adapter
macOS:
ipconfig getifaddr en0 # Wi-Fi
ipconfig getifaddr en1 # Ethernet
Linux:
ip addr show
# or
hostname -I
Find Your Router's IP
Windows:
ipconfig
# Look for "Default Gateway"
macOS:
netstat -nr | grep default
When to Use Each
| Scenario | IP Type | Why |
|---|---|---|
| Hosting a public website | Public | Needs to be reachable from internet |
| Home network devices | Private | No need for internet access inbound |
| Internal company servers | Private | Security + limited public IPs |
| Game server for friends | Public (port forward) | Friends need to connect to your IP |
| IoT devices | Private | Security; no inbound access needed |
Private IPs provide a layer of security. Devices with only private IPs cannot be directly accessed from the internet unless port forwarding is configured.