Subnetting: The Complete Guide
This is the complete path to subnetting mastery: binary foundations → masks & CIDR → the block-size method → VLSM → wildcards → IPv6 → exam speed. Work through it in order (about 40 minutes) and finish with the linked practice sets. Bookmark it — it doubles as your revision index.
- What subnetting is (and why networks need it)
- Binary foundations — the 8 place values
- Subnet masks and CIDR notation
- The block-size method — subnet in your head
- Worked examples, exam-style
- VLSM — sizing subnets to real needs
- Wildcard masks — the inverse you need for ACLs and OSPF
- IPv6 subnetting in five minutes
- The 7 mistakes that cost exam marks
- Exam speed strategy
What subnetting is (and why networks need it)
A single IP network is one broadcast domain: every device hears every broadcast, one flat security zone, one addressing pool. That works for a handful of devices and collapses at scale. Subnetting divides one address block into smaller, isolated networks — each with its own identity, its own broadcast domain, and its own entry in the routing table.
Concretely, subnetting lets you:
- Contain broadcasts. A 1,000-host flat network drowns in ARP and DHCP chatter; ten /26 subnets don't.
- Apply security boundaries. Firewall rules and ACLs act on subnet boundaries — finance in one subnet, guests in another.
- Route efficiently. Routers forward between subnets and summarise them upstream.
- Use addresses precisely. A point-to-point link needs 2 addresses, not 254 — VLSM (below) sizes each subnet to its need.
Every skill in this guide reduces to one idea: an IP address is two numbers glued together — a network part and a host part — and the subnet mask is the marker showing where the glue line is.
Binary foundations — the 8 place values
IPv4 addresses are 32 bits, written as four octets (8 bits each). Each octet is a number from 0–255. To work with masks you only need to read one octet in binary, and that takes exactly eight place values:
128 64 32 16 8 4 2 1
Binary → decimal: add the place values wherever there's a 1. So 11000000 = 128+64 = 192, and 11110000 = 128+64+32+16 = 240.
Decimal → binary: subtract place values left to right. For 200: 200−128=72 ✓, 72−64=8 ✓, 32 ✗, 16 ✗, 8−8=0 ✓, rest 0 → 11001000.
That is all the binary subnetting ever requires. Drill it for ten minutes with our binary conversion tutorial and the rest of this guide becomes arithmetic.
Subnet masks and CIDR notation
A subnet mask is 32 bits: 1s marking the network portion, then 0s marking the host portion. The 1s are always contiguous — which is why only eight values can ever appear in a mask octet: 0, 128, 192, 224, 240, 248, 252, 255.
CIDR notation (/24, /26…) simply counts the 1-bits. /26 means 26 ones: 11111111.11111111.11111111.11000000 = 255.255.255.192.
| CIDR | Mask | Block size | Usable hosts |
|---|---|---|---|
/8 | 255.0.0.0 | — | 16,777,214 |
/16 | 255.255.0.0 | — | 65,534 |
/24 | 255.255.255.0 | 256 | 254 |
/25 | 255.255.255.128 | 128 | 126 |
/26 | 255.255.255.192 | 64 | 62 |
/27 | 255.255.255.224 | 32 | 30 |
/28 | 255.255.255.240 | 16 | 14 |
/29 | 255.255.255.248 | 8 | 6 |
/30 | 255.255.255.252 | 4 | 2 |
Two formulas govern everything:
- Subnets created = 2borrowed bits (bits taken from the host portion)
- Usable hosts = 2host bits − 2 (minus the network and broadcast addresses)
The full printable version lives on our subnet mask cheat sheet.
The block-size method — subnet in your head
Forget long binary tables in the exam. The block size (magic number) method answers any subnetting question in four steps:
- Find the interesting octet — the octet where the mask is neither 255 nor 0. For /26 it's the 4th; for /21 it's the 3rd.
- Block size = 256 − mask value in that octet. /26 → 256−192 = 64.
- List multiples of the block size: 0, 64, 128, 192. These are the subnet boundaries.
- Place your address between two boundaries. The lower one is the network; the next one minus 1 is the broadcast; everything between is the host range.
Example: which subnet holds 192.168.1.200/26?
Boundaries: .0 .64 .128 .192 200 sits between 192 and 256 Network: 192.168.1.192 First host: 192.168.1.193 Last host: 192.168.1.254 Broadcast: 192.168.1.255
Full walkthrough with more prefixes: How to Subnet Fast.
Worked examples, exam-style
1 — Host counting. How many usable hosts in 172.16.32.0/27? Host bits = 32−27 = 5 → 25−2 = 30 hosts (.33–.62, broadcast .63).
2 — Reverse lookup. Is 10.5.4.130/25 a host, network, or broadcast? /25 → block 128 → boundaries .0 and .128. 130 sits just above .128 → it's a usable host in 10.5.4.128/25 (hosts .129–.254).
3 — Design. You need 6 subnets from 192.168.10.0/24. 23=8 ≥ 6 → borrow 3 bits → /27, 8 subnets of 30 hosts, boundaries every 32: .0, .32, .64, .96, .128, .160, .192, .224.
Seven more fully-worked questions (with hidden answers to test yourself): Subnetting Practice Questions.
VLSM — sizing subnets to real needs
Fixed-length subnetting wastes space: giving a 2-host WAN link a /26 burns 60 addresses. Variable Length Subnet Masking assigns each subnet the smallest prefix that fits, using one rule: allocate the largest requirement first, packing downward so every block lands on a valid boundary.
Example: from 172.16.0.0/24, serve LANs of 100, 50 and 25 hosts plus a router link:
100 hosts → /25 (126) 172.16.0.0/25 50 hosts → /26 (62) 172.16.0.128/26 25 hosts → /27 (30) 172.16.0.192/27 2 hosts → /30 (2) 172.16.0.224/30
Everything fits in one /24 with room left over. Allocate smallest-first instead and you fragment the space — the classic VLSM error. More scenarios: Subnetting Examples.
Wildcard masks — the inverse you need for ACLs and OSPF
Cisco ACLs and OSPF network statements use the wildcard mask — the bitwise inverse of the subnet mask. Compute it by subtracting each mask octet from 255:
Mask 255.255.255.192 Wildcard 0. 0. 0. 63
In a wildcard, 0 means "must match" and 1 means "don't care". So access-list 10 permit 192.168.1.0 0.0.0.63 matches exactly the /26 we subnetted above. Shortcut: wildcard = block size − 1. Full tutorial: Wildcard Masks Explained.
IPv6 subnetting in five minutes
IPv6 removes most of the arithmetic: the LAN subnet is virtually always a /64 (SLAAC requires 64 host bits), there is no broadcast address so you never subtract 2, and you subnet by walking hex digits between the site prefix and /64.
A typical site gets a /48 → 16 subnet bits → 65,536 /64 subnets. Work on nibble (4-bit) boundaries — /52, /56, /60, /64 — and each step changes exactly one hex digit: 2001:db8:acad:0001::/64, …:0002::/64, and so on. Full guide: IPv6 Subnetting.
The 7 mistakes that cost exam marks
- Wrong interesting octet. /17–/23 work in the 3rd octet, /25–/30 in the 4th. Match prefix to octet before anything else.
- Forgetting −2. 2host bits counts addresses; usable hosts subtract network + broadcast. (Exception: /31 point-to-point links, RFC 3021.)
- Broadcast off by one. Broadcast = next boundary − 1, never the boundary itself.
- Treating the network address as assignable. .0 of the subnet (or .64, .128…) is never a host.
- VLSM smallest-first. Always allocate the largest subnet first.
- Mask/wildcard confusion. ACLs and OSPF want the wildcard; interfaces want the mask.
- Assuming /24 everywhere. Real exams love /27–/30 in the fourth octet and /22–/23 in the third.
Exam speed strategy
CCNA gives you roughly 80 seconds per question, and subnetting hides inside routing, ACL and troubleshooting questions too. Speed target: any address → network, broadcast, host range in under 30 seconds.
- Memorise the eight mask values and the 128–1 place values cold.
- Drill 5–10 practice questions daily for two weeks — consistency beats cramming.
- Always solve all four values (network, first, last, broadcast) even when the question asks for one — it self-checks your block placement.
- Verify with the subnet calculator during practice — never in a real exam, so wean off it in week two.
Frequently asked questions
What is subnetting in simple terms?
Subnetting divides one large IP network into smaller networks (subnets). Each subnet gets its own network address, broadcast address and host range, which contains broadcast traffic, enables security boundaries and uses address space efficiently.
What is the fastest way to solve subnetting questions?
The block-size method: block size = 256 minus the mask value in the interesting octet. List multiples of the block size, place your address between two boundaries, and read off network, host range and broadcast.
How many hosts does each prefix give?
Usable hosts = 2 to the power of host bits, minus 2. A /26 has 6 host bits: 62 hosts. A /27 gives 30, /28 gives 14, /29 gives 6, /30 gives 2.
What is the difference between a subnet mask and a wildcard mask?
They are bitwise inverses. The subnet mask marks network bits with 1s (255.255.255.192); the wildcard marks don't-care bits with 1s (0.0.0.63) and is used in Cisco ACLs and OSPF network statements.
Do I need to learn binary for subnetting?
You need the eight place values (128 64 32 16 8 4 2 1) and the eight valid mask octets. With those memorised, the block-size shortcut replaces all long binary conversion.
Is subnetting still on the CCNA 200-301 exam?
Yes — IPv4 and IPv6 addressing and subnetting sit inside the IP Connectivity and Network Fundamentals domains, and subnetting knowledge is assumed by routing, ACL and troubleshooting questions throughout the exam.
Related articles
Want hands-on training?
Learn this on real Cisco lab devices with placement support at Attila Technologies, Ahmedabad.