Subnetting Explained: A Beginner's Guide to IP Addresses and CIDR
Subnetting is the topic that makes a lot of new network engineers want to quit. It feels like math wizardry. But once a few ideas click, it becomes mechanical. Let’s build the intuition from the ground up.
An IP address is two things in one
An IPv4 address like 192.168.1.10 is 32 bits, written as four “octets” (0–255 each). Crucially, it contains two parts:
- A network portion — which network you’re on
- A host portion — which specific device you are on that network
The subnet mask is what tells you where the split is. In 255.255.255.0, the first three octets (the 255s) are the network; the last octet (0) is for hosts.
CIDR notation: the shorthand
Instead of writing 255.255.255.0, we write /24 — meaning “the first 24 bits are the network.” This is CIDR (Classless Inter-Domain Routing) notation. A few common ones:
/24=255.255.255.0→ 256 addresses (254 usable hosts)/25=255.255.255.128→ 128 addresses (126 usable)/26=255.255.255.192→ 64 addresses (62 usable)
Each extra bit in the mask halves the number of hosts and doubles the number of subnets.
Why “usable hosts” is two less
Every subnet reserves two addresses:
- The network address (all host bits 0) — names the subnet itself
- The broadcast address (all host bits 1) — talks to everyone on the subnet
So a /24 has 256 total addresses but 254 usable for devices.
Subnetting = borrowing host bits
“Subnetting” means splitting one network into smaller ones by borrowing bits from the host portion to create more network portions.
Say you have 192.168.1.0/24 (254 hosts) but you want 4 separate subnets. You borrow 2 bits (because 2² = 4), making it a /26. That gives you four subnets of 62 hosts each:
192.168.1.0/26→ hosts .1–.62192.168.1.64/26→ hosts .65–.126192.168.1.128/26→ hosts .129–.190192.168.1.192/26→ hosts .193–.254
The jump size (64 here) is your clue for where each subnet starts.
The two questions subnetting answers
- How many subnets do I need? → borrow enough bits (2ⁿ ≥ subnets needed).
- How many hosts per subnet do I need? → leave enough host bits (2^(host bits) − 2 ≥ hosts needed).
Every subnetting problem is just balancing these two.
A quick mental shortcut
Memorize the “block sizes” for the last octet: /25 = 128, /26 = 64, /27 = 32, /28 = 16, /29 = 8, /30 = 4. Once you know the block size, the subnets just march up in those steps.
Make it stick by doing it
Reading subnetting once rarely sticks — you need reps. The fastest way is to actually assign subnets to interfaces on a router and watch traffic flow (or fail) based on your masks. On Learn.GT, you can practice addressing and subnetting on real router labs, with instant feedback and an AI tutor. Start with networking fundamentals.
Subnetting isn’t magic. It’s just deciding where to put the line between “network” and “host” — and once you’ve done a dozen, you’ll do them in your head.