IP Addressing — Public, Private, NAT, Subnets & IPv6
Press Next → or use ← → arrow keys
What Is an IP Address?
An IP address (Internet Protocol address) is that address. Every packet on the internet has a source IP (where it's from) and a destination IP (where it's going) — routers use these to forward the packet toward its target.
IP lives on Layer 3 of the OSI model (the Network layer), and on the Internet layer of the TCP/IP model. It sits above the physical Wi-Fi / Ethernet layer, and below TCP/UDP which handle reliable delivery and ports.
What IP Addressing Is Used For
Anatomy of an IPv4 Address — 32 Bits, 4 Octets
Humans write IPv4 as 192.168.1.10. Computers see 32 bits:
11000000 10101000 00000001 00001010. Total address space:
2³² ≈ 4.3 billion addresses — which is why we're running out
and IPv6 exists.
Public vs Private IP Addresses
| Globally unique across the entire internet |
| Assigned by your ISP (or cloud provider) |
| Reachable from anywhere on the internet |
| Costs money · registered with RIRs |
Examples: 142.250.183.174 (Google), 203.0.113.5 |
| Only unique within your own network |
| Assigned by your router via DHCP |
| Not routable on the public internet |
| Free · defined by RFC 1918 |
Examples: 192.168.1.10, 10.0.0.5 |
Every device inside your home gets a private IP. When those devices talk to the internet, the router uses NAT to make them all share the router's single public IP. More on that in a few slides.
Private IP Ranges — the RFC 1918 Reserved Blocks
| Class | Range | CIDR | Addresses | Where you see it |
|---|---|---|---|---|
| Class A | 10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | ~16.7 million | Large enterprises, cloud VPCs |
| Class B | 172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | ~1 million | Mid-size networks, Docker default |
| Class C | 192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | ~65,000 | Home & small-office routers |
These three blocks are reserved for internal use and
never appear on the public internet. That's why every
household in the world can safely use 192.168.1.1 as their
router without a conflict — they're on separate private networks.
127.0.0.0/8 — loopback (your own machine, localhost).
169.254.0.0/16 — APIPA (auto-assigned when DHCP fails).
Check Your Own IP Address
ipconfig shows your private LAN IP (e.g. 192.168.1.42).
curl ifconfig.me shows the public IP the world sees —
your ISP-assigned router IP. If ten devices in your home run the same command,
they'll all see the same public IP.
NAT — Network Address Translation
Your router doing NAT is that receptionist for your home network. Every device inside uses a private IP; NAT translates all their traffic to the one public IP the ISP gave you.
The world has ~4.3 billion IPv4 addresses but 30+ billion devices. NAT lets an entire home / office / country share a handful of public IPs. It's the reason we haven't run out of IPv4 yet — and why IPv6 wasn't urgent for so long.
End-to-End Journey — PC → Switch → Router → NAT → Server
1. PC (192.168.1.10) sends packet to switch
2. Switch (Layer-2) forwards to router by MAC
3. Router does NAT — rewrites the src IP from
192.168.1.10 ➜ 203.0.113.5 and remembers the mapping
4. Packet exits onto the public internet
5. Web server replies to 203.0.113.5
6. Router looks up the mapping and rewrites the destination back to
192.168.1.10.
IP + Subnet Mask — Splitting Network from Host
The subnet mask tells the router which bits of the IP identify the
network (blue) and which identify the host (red).
/24 means "the first 24 bits are the network" → all devices sharing
those bits are on the same LAN.
Network Address & Broadcast Address
In every subnet, two addresses are reserved — they cannot be given to a device.
192.168.1.0/24 → the network address is 192.168.1.0. Routers use it when talking about "the whole network".192.168.1.0/24 → 192.168.1.255. Used by DHCP, ARP, discovery./24: 256 total − 2 reserved = 254 usable IPs (192.168.1.1 through 192.168.1.254).
For a mask with H host bits: total addresses = 2ᴴ,
usable hosts = 2ᴴ − 2. /24 → 254 usable, /16 → 65,534 usable,
/30 → just 2 usable (perfect for router-to-router links).
IPv6 — The Successor We Actually Need
IPv6 uses 128 bits — about 340 undecillion addresses. That's roughly 5 × 10²⁸ addresses for every human on Earth. We will never run out again.
IPv6 is written as 8 groups of 4 hex digits separated by colons:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Leading zeros drop, and one run of all-zero groups can be shortened to :::
2001:db8:85a3::8a2e:370:7334
IPv4 vs IPv6 — Head to Head
| Property | IPv4 | IPv6 |
|---|---|---|
| Address size | 32 bits | 128 bits |
| Total addresses | ~4.3 billion | ~3.4 × 10³⁸ |
| Notation | Dotted decimal 192.168.1.10 | Colon hex 2001:db8::1 |
| NAT required? | Almost always | No — every device gets a public IP |
| Header size | 20–60 bytes (variable) | 40 bytes (fixed, faster routing) |
| Broadcast | Yes (x.x.x.255) | No broadcast — uses multicast instead |
| Auto-config | DHCP required | Built-in SLAAC (self-configures) |
| Security | IPsec optional | IPsec designed in from day one |
| Fragmentation | Routers & hosts | End hosts only (faster routers) |
| Loopback | 127.0.0.1 | ::1 |
Modern networks run both — that's called dual-stack.
Your laptop probably has both an IPv4 and an IPv6 address right now.
Try ipconfig or ip -6 addr to see the IPv6 side.
IP Golden Rules — 1 to 4
ipconfig) is what devices in your home see.
Your public IP (from curl ifconfig.me) is what the internet sees.
10/8, 172.16/12, 192.168/16 are your private blocks.
Anything else on the LAN is either mis-configured or shouldn't be there.
IP Golden Rules — 5 to 8
/24 means the first 24 bits identify the network, the last 8 identify the device.
Master CIDR and subnetting becomes intuitive.
/24 → 254, /25 → 126, /30 → 2. Perfect for sizing subnets to the right number of devices.
You Now Speak IP Fluently
You understand what an IP is, which layer it lives on, the difference between public and private, how to find both on your device, how NAT lets many devices share one public IP, how subnet masks split networks, why network/broadcast addresses are reserved — and where IPv6 fits in the modern world.
Practise VLSM & CIDR subnetting — split a /24 into 4 /26 networks.
Read RFC 1918 (private ranges), RFC 3022 (NAT), and RFC 8200 (IPv6).
Fire up Wireshark and watch a real packet capture — IP headers make far more sense once you've seen them live.
🌐 End of tutorial · Press ← to review, or click Restart