Designing a Subnet for a Host Count
Lessons 2 and 3 answered “given a prefix, what do I get?”. Now we reverse the problem: given a required number of hosts, which prefix should I choose? This is how real address plans are built, and it is a guaranteed exam skill.
The reverse problem
Forward questions give you a mask and ask for hosts. Design questions give you hosts and ask for a mask. The engine is still usable = 2h − 2, but you now solve it for h, then convert prefix = 32 − h.
2h − 2 ≥ N. The subnet prefix is then 32 − h. “Smallest h” means the largest prefix that still fits — wasting as few addresses as possible.Two phrases to keep straight. “Smallest prefix that fits” (in common course language) actually means the smallest subnet, i.e. the largest prefix number: /26 is smaller in size than /24. We will always phrase it as “the tightest prefix” to avoid confusion: find the tightest prefix (largest /n) whose usable count still covers N.
The 4-step design method
Run these four steps in order for every design question.
- Write the requirement N (hosts needed in the segment).
- Find h: the smallest host-bit count with
2h − 2 ≥ N. In practice, add 2 to N, then round up to the next power of two; the exponent is h. - Convert to a prefix:
prefix = 32 − h. - If you are subdividing an existing block, borrowed bits
s = new prefix − original prefix, and the block splits into2ssubnets.
Step 2 is the one students fumble, so here is the trick made explicit: N + 2 gives the minimum number of addresses you need. Round that up to the next power of 2. For 50 hosts, 50 + 2 = 52, round up to 64 = 26, so h = 6, prefix = /26.
Worked: 50, 200, 3, 500 hosts
Pick a requirement and watch the four steps produce the prefix.
Notice that 500 hosts forces a prefix shorter than /24: the subnet must span two /24 blocks. A /23 covers third-octet pairs such as 0–1, 2–3, and so on — Lesson 5 generalises this non-octet case.
The borrow formula
When you take an existing network and split it, you borrow bits from the host part and add them to the network part. Each borrowed bit doubles the number of subnets and halves the size of each.
2s equal subnets, and the new prefix is original prefix + s. Equivalently, subnets = 2(new prefix − original prefix).| Borrowed bits s | Subnets 2s | New prefix from /24 | Hosts each |
|---|---|---|---|
| 1 | 2 | /25 | 126 |
| 2 | 4 | /26 | 62 |
| 3 | 8 | /27 | 30 |
| 4 | 16 | /28 | 14 |
| 5 | 32 | /29 | 6 |
Read the table as a trade-off: every bit you borrow doubles the subnet count and halves the hosts. That is the entire economics of subnetting in one line.
Carving an address space into subnets
Here is the standard workflow for “take network X and produce subnets of size Y”:
- Confirm the required host count fits the chosen prefix (Step 2 above).
- Compute the block increment in the magic octet.
- Walk the multiples of the increment from the network address, writing each subnet.
- For each subnet list: network, first usable, last usable, broadcast.
Example: divide 192.168.1.0/24 into four equal /26 subnets. Borrow 2 bits (26 − 24 = 2) → 22 = 4 subnets, increment 256 − 192 = 64.
Check any row of that design: subnet 2 network .64, broadcast .127, usable .65–.126 = 126 − 65 + 1 = 62 addresses. Every subnet yields exactly 62 usable hosts, and the four blocks tile the /24 with no gaps: .0–.63, .64–.127, .128–.191, .192–.255.
Full design drills
Drill A: A floor needs 100 hosts. Smallest fitting prefix? h=6 gives 62 < 100; h=7 gives 126 ≥ 100 -> /25 (126 usable) Drill B: A floor needs 25 hosts. Smallest fitting prefix? h=4 gives 14 < 25; h=5 gives 30 ≥ 25 -> /27 (30 usable) Drill C: A link needs exactly 2 hosts. Smallest fitting prefix? h=2 gives 2 ≥ 2 -> /30 (2 usable) Drill D: A site needs 1000 hosts. Smallest fitting prefix? h=9 gives 510 < 1000; h=10 gives 1022 ≥ 1000 -> /22 (1022 usable) Drill E: Split 172.16.0.0/24 into 8 equal subnets. Which prefix, and list the first three. borrow s = 3 -> /27, 2^3 = 8 subnets, increment 256−224 = 32 #1 172.16.0.0/27 (.1-.30, bc .31) #2 172.16.0.32/27 (.33-.62, bc .63) #3 172.16.0.64/27 (.65-.94, bc .95)
Verify Drill E subnet 1: broadcast .31, usable .1–.30 = 30 − 1 + 1 = 30 = 25 − 2. Correct, and the increment of 32 keeps the blocks contiguous.
Key terms & sources
Design (reverse) problem
Choosing a prefix from a required host count rather than the other way round.
Borrowed bits (s)
Host bits reassigned to the network part; create 2s subnets.
Subnets = 2s
The borrow formula linking borrowed bits to subnet count.
Block increment
256 − mask value in the magic octet; the size and spacing of each subnet.
Tightest prefix
The largest /n (smallest subnet) whose usable hosts still cover the requirement.
- Pummill, R. & Manning, B. RFC 1878: Variable Length Subnet Table For IPv4 (1995) (host-per-mask table used to size subnets). rfc-editor.org/rfc/rfc1878.
- Fuller, V. & Li, T. RFC 4632: Classless Inter-Domain Routing (CIDR) (2006). rfc-editor.org/rfc/rfc4632.
- Cisco. CCNA (200-301) Exam Topics, IPv4 Addressing and Subnetting. cisco.com.
Review
Check what you have learned with these review questions.
Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.