Every device on the internet has an address. Your phone, your laptop, Google’s servers — all of them. Without IP addresses, data would have no idea where to go. It would be like mailing a letter with no address on the envelope.
Yet most people have never looked at theirs. Let’s change that.
Introduction
- What an IP address is and how it works
- The difference between public and private IPs
- How subnet masks divide networks
- CIDR notation (the
/24you keep seeing) - IPv4 vs IPv6: why we’re running out
An IP address works like a street address.
- Network portion = The city name (identifies which network you’re on)
- Host portion = The house number (identifies your specific device on that network)
Just like “42 Oak Street, Springfield” tells the postman the city AND the exact house, 192.168.1.42 tells routers the network AND the specific device.
Anatomy of an IPv4 Address
An IPv4 address is a 32-bit number, written as 4 groups of 8 bits (0-255), separated by dots.
Computers see 1s and 0s.
- 192.168.1 (24 bits) →
11000000.10101000.00000001 - 42 (8 bits) →
00101010
Every IP address has two parts: Network (which network?) and Host (which device on that network?). The subnet mask determines where one ends and the other begins.
Finding Your IP Address
Display all network interfaces and their IP addresses (Linux)
ip addr show eth0- •Look for 'inet' followed by your IP
- •On Windows use: ipconfig
- •On macOS use: ifconfig
Find your public IP address (the one the internet sees)
curl ifconfig.me203.0.113.42
- •This shows your PUBLIC IP
- •ip addr shows your PRIVATE IP
- •They are different! (NAT makes this possible)
Public vs. Private IP Addresses
Not all IP addresses are created equal. Some are for the public internet, others are for your local network only.
Reserved Private IP Ranges
| Range | CIDR | Typical Use |
|---|---|---|
10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 | Large enterprises, cloud VPCs |
172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 | Medium organizations |
192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 | Home networks, small offices |
There are only ~4.3 billion IPv4 addresses (2³²). That’s not enough for every device on Earth. Private IPs let millions of networks reuse the same address ranges internally, and NAT handles the translation to the public internet.
Subnet Masks: Dividing the Address
The subnet mask tells the system which bits are the network and which are the host.
| Subnet Mask | CIDR | Network Bits | Host Bits | Usable Hosts |
|---|---|---|---|---|
255.0.0.0 | /8 | 8 | 24 | 16,777,214 |
255.255.0.0 | /16 | 16 | 16 | 65,534 |
255.255.255.0 | /24 | 24 | 8 | 254 |
255.255.255.128 | /25 | 25 | 7 | 126 |
255.255.255.192 | /26 | 26 | 6 | 62 |
Reading a /24 Network
IP: 192.168.1.42
Mask: 255.255.255.0 (/24)
Network: 192.168.1.0 ← The "street" (first 24 bits)
Host: .42 ← The "house" (last 8 bits)
Range: 192.168.1.1 to 192.168.1.254 (254 usable)
/24 = 254 hosts. This is the most common subnet for home and small office networks. When someone says “a /24 network,” they mean a block of 254 usable addresses.
CIDR Notation
CIDR (Classless Inter-Domain Routing) is the modern way to express IP ranges. Instead of writing the full subnet mask, you write a slash followed by the number of network bits.
| Full Form | CIDR |
|---|---|
192.168.1.0 with mask 255.255.255.0 | 192.168.1.0/24 |
10.0.0.0 with mask 255.0.0.0 | 10.0.0.0/8 |
172.16.0.0 with mask 255.255.240.0 | 172.16.0.0/20 |
The number after / = how many bits are used for the network. The remaining bits = hosts.
Special IP Addresses
| Address | Purpose |
|---|---|
127.0.0.1 | Loopback — your own machine (“localhost”) |
0.0.0.0 | ”All interfaces” / “any address” (used in server configs) |
255.255.255.255 | Broadcast — sends to all devices on the network |
169.254.x.x | APIPA — auto-assigned when DHCP fails |
8.8.8.8 | Google’s Public DNS server |
Ping yourself (loopback test). If this fails, your network stack is broken.
ping -c 4 127.0.0.1- •This tests your local TCP/IP stack
- •If this fails, reinstall network drivers
IPv4 vs IPv6
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address size | 32 bits | 128 bits |
| Total addresses | ~4.3 billion | ~340 undecillion (3.4 × 10³⁸) |
| Format | 192.168.1.1 | 2001:0db8:85a3::8a2e:0370:7334 |
| NAT needed? | Yes (not enough addresses) | No (every device gets a unique public IP) |
| Adoption | Universal | ~45% of global traffic (2026) |
IPv6 has been available since 1998, but adoption is slow because NAT “solved” the IPv4 shortage for most use cases. The transition is gradual — both protocols coexist today (dual-stack).
Troubleshooting IP Issues
| Problem | Check | Command |
|---|---|---|
| No internet | Do you have an IP? | ip addr show (look for inet) |
169.254.x.x address | DHCP server is unreachable | Restart router or check DHCP config |
| Can’t reach other devices | Same subnet? | Compare network portions of both IPs |
| Can reach local, not internet | Default gateway issue | ip route show (check default route) |
Display the routing table (shows your default gateway)
ip route show- •Look for 'default via X.X.X.X' — that's your router
- •On Windows: route print
Quiz: Test Your Knowledge
Test Your Knowledge
Take a quick 4-question quiz to check your understanding.
Key Takeaways
- Every device needs an IP — it’s the unique address that makes internet routing possible.
- Network + Host — the subnet mask splits the address into “which network” and “which device.”
- Public vs. Private — private IPs (
192.168.x.x,10.x.x.x) are for local networks; NAT bridges them to the public internet. - CIDR (
/24,/16) is the modern way to express network sizes. - IPv6 is coming — 128-bit addresses solve the scarcity problem, but adoption is gradual.
Deepen your networking knowledge:
- The OSI Model (Where IP fits in the stack)
- How the Internet Works (The full picture)
- TCP vs UDP (Transport protocols above IP)