Ravindra BagaleCourses & study guides

Chapter 1: Networking Fundamentals

1.7 Public vs private IP

A public IP is globally unique and routable on the internet. A private IP is used only inside a local network (home, college, VPC) and is not routable on the internet. RFC 1918 reserves three private ranges:

Class Private range (RFC 1918) CIDR Typical use
A 10.0.0.0 – 10.255.255.255 10.0.0.0/8 Large companies, AWS VPCs
B 172.16.0.0 – 172.31.255.255 172.16.0.0/12 AWS default VPC uses 172.31.0.0/16
C 192.168.0.0 – 192.168.255.255 192.168.0.0/16 Home Wi-Fi routers

Other special ranges: 100.64.0.0/10 (carrier-grade NAT used by mobile ISPs) and 169.254.0.0/16 (link-local; on EC2, 169.254.169.254 is the instance metadata service).

Check your own IPs:

# Private IP(s) of this machine
ip -4 addr show
hostname -I

# Public IP as seen by the internet
curl -s https://checkip.amazonaws.com