Public vs Private IP Addresses

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

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

info Common Private IPs

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

  1. Outbound request: Your device (192.168.1.5) sends a request to a website
  2. Translation: Your router replaces the private IP with your public IP and notes the mapping
  3. Response returns: The website responds to your public IP
  4. 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

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
lightbulb Security Benefit

Private IPs provide a layer of security. Devices with only private IPs cannot be directly accessed from the internet unless port forwarding is configured.

Check Your Public IP

See your public IP address, location, and ISP information.

search Check My IP