The Plain Picture#
Some phone numbers are special: 100 goes to the police, internal office extensions like 2045 only
work inside the office, and dialling your own number gives a busy tone. IP addresses have special ranges
too.
The Real Names and the Ranges to Memorise#
| Range | Name | Meaning |
|---|---|---|
10.0.0.0/8 | private | usable by anyone inside their own network; never routed on the public internet |
172.16.0.0/12 | private | same (covers 172.16.0.0 – 172.31.255.255) |
192.168.0.0/16 | private | same; typical for home routers |
127.0.0.0/8 | loopback | "this same computer". 127.0.0.1 is called localhost |
169.254.0.0/16 | link-local | self-assigned when no address could be obtained (Ch 9). Also where clouds put their "metadata service": 169.254.169.254 |
100.64.0.0/10 | carrier-grade NAT | used inside internet providers' networks (next file) |
0.0.0.0 | "unspecified" | "no address yet", or "every address on this machine" — its server meaning is in the next file |
255.255.255.255 | limited broadcast | "everyone on this LAN" (Ch 9) |
Under the Hood#
Private addresses (RFC 1918). A standards document numbered RFC 1918 set aside the three private
ranges. Millions of homes all use 192.168.1.x at the same time without conflict, because those
addresses never appear on the public internet — routers on the internet drop them. A device with a
private address reaches the internet only through NAT, which rewrites addresses at the edge of the
network (next file, after ports are explained).
In the cloud, every server in your network normally gets a private address from your VPC range
(10.0.0.0/16 in Chapter 5), and only a few entry points get public addresses. That's a security
feature: a database with only a private address simply cannot be reached from the internet.
Loopback. Traffic to 127.0.0.1 never leaves your machine — the kernel hands it straight back.
When you run StudyBuddy's backend on your laptop and open http://localhost:8000, you're using loopback.
Link-local 169.254.x.x. If your laptop shows an address starting with 169.254, it failed to get an
address from the network (Chapter 9) and made one up. It can't reach the internet. It's a common
"Wi-Fi connected but no internet" symptom.
Gotchas
localhostinside a Docker container means the container itself, not your laptop. "My app can't reach the database on localhost from inside Docker" is a classic confusion (Docker (coming soon)).The cloud metadata address
169.254.169.254can hand out a server's cloud credentials to anything running on it. Attackers who trick a server into fetching URLs for them (an attack called SSRF, Security Fundamentals) aim straight for it.
Check yourself
4 questionsName the three private IPv4 ranges.
Show answerHide answer
10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
Why can millions of homes all use 192.168.1.10?
Show answerHide answer
Private addresses only need to be unique inside each network; they're never used on the public internet, and NAT translates them at the edge.
What is 127.0.0.1?
Show answerHide answer
Loopback / localhost — "this same machine"; traffic never leaves it.
Your laptop's address is 169.254.12.7. What does that tell you?
Show answerHide answer
It failed to get an address automatically (DHCP, Ch 9) and self-assigned a link-local address; it has no working internet.