IP Addresses — every server's home address
Think of the internet as one giant postal system. An IP address is what's written on the envelope. Get it wrong, or leave it off, and your data just doesn't show up.
What an IP address actually is
An IP address is a unique number that pins down one device on a network. Your phone has one. So does every laptop, server, printer, and even that smart lightbulb in the corner. It's the same idea as a house address: if nobody knows where you live, your post has nowhere to go.
Your street address — 10 Downing Street, London, SW1A 2AA — tells the whole world exactly where to find you. An IP address does the same job for your device. Anywhere on earth, if another machine knows your IP, it can reach you.
IPv4 — the classic form
Most IP addresses you'll run into look like this: 203.0.113.10. Four numbers, dots between them. Each one sits between 0 and 255, which works out to exactly 4,294,967,296 possible IPv4 addresses. Sounds like plenty, right? It isn't — we've already run out.
Public vs private IPs
Not every IP is reachable from the open internet. Some ranges are set aside as private — they only work inside a local network, like your home, an office, or a VPC in the cloud.
| Type | Example | Where it's routable | Who assigns it |
|---|---|---|---|
| Public | 203.0.113.10 | The entire internet | Your ISP or cloud provider (via IANA/RIRs) |
| Private | 10.0.2.5, 192.168.1.24 | Only inside your LAN/VPC | Your router, DHCP, or you |
The three private ranges (RFC 1918):
10.0.0.0 – 10.255.255.255— the giant one, the kind you'll find inside data centres and cloud VPCs172.16.0.0 – 172.31.255.255— the mid-sized one, and the range Docker reaches for by default (its bridge is172.17.0.0/16)192.168.0.0 – 192.168.255.255— the little one your home router is almost certainly handing out right now
Two reasons. They save money — you're not buying a public IP for every single device — and they add a layer of safety, since nothing out on the internet can dial your private IP directly. When traffic does need to leave, it heads out through NAT, which we get into in the Security chapter.
When a customer asks you to "point my domain at the server," they need the server's public IP — the one your VPS provider shows in its dashboard, or what curl ifconfig.me prints from the box itself. Not the 10.x or 192.168.x address that ip addr shows inside the machine. Cloud servers almost always have both: a private IP for talking to their neighbours, and a public one for the outside world. Drop the private IP into public DNS by accident and the site loads for nobody. When in doubt, the public IP is the one on the provider's control panel.
Static vs dynamic
Static
Set once, and it stays put. Servers, printers, and routers want this. Picture your database's IP changing every night — nothing would ever manage to find it.
Dynamic (DHCP)
Handed out by a DHCP server — usually your router — the moment a device joins the network. Your phone grabs a fresh one every time it hops onto Wi-Fi.
IPv6 — the (much) bigger one
IPv4 ran dry years ago. IPv6 is the fix: it swaps the 32-bit address for a 128-bit one, which gets you 340 undecillion addresses. That's a 3 followed by 38 zeros — far more than we could ever plausibly use.
An IPv6 address looks like this:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Eight groups of four hex digits, colons in between. Long runs of zeros collapse down to ::, so the address above shortens to 2001:db8:85a3::8a2e:370:7334.
Almost every modern device speaks both. Cloud providers, ISPs, and phones "dual-stack" — they use whichever one the far end understands. You'll bump into IPv6 more and more over time, but IPv4 isn't going anywhere yet.
Loopback and other special addresses
| Address | Meaning |
|---|---|
127.0.0.1 (v4) / ::1 (v6) | Loopback — always means "this machine". curl 127.0.0.1 talks to your own laptop and nowhere else. |
0.0.0.0 | "Any address" — a server that binds here listens on every interface at once. |
255.255.255.255 | Broadcast — one message out to every device on the local network. |
169.254.x.x | Link-local — what a device gives itself when DHCP never answers. |
Try it yourself
Find your public IP:
curl https://ifconfig.me
Find your local (private) IP:
# Linux/macOS
ip -4 addr show # or: ifconfig
# Windows
ipconfig
Ping a public IP to see if it's reachable:
ping 8.8.8.8 # Google DNS — always up
Point api.mycompany.com → 10.0.2.5 in your public DNS and you've just broken the site for everyone who isn't on your VPN. Private IPs belong in private zones — keep them there.
Key takeaways
- An IP address is a unique number identifying a device on a network.
- IPv4 = 4 numbers × 8 bits (
203.0.113.10); IPv6 = 8 hex groups × 16 bits. - Public IPs are reachable from the internet; private IPs (
10.x,172.16-31.x,192.168.x) aren't. - Static IPs never change; dynamic ones are handed out by DHCP.
127.0.0.1is always your own machine.