Starphix
Network Engineering / Sources
The Lab / Sources / Network Engineering / Labs/Subnetting-Drills.md

Subnetting Drills

Subnetting is arithmetic, and arithmetic becomes fast with ten minutes a day. This note is the method, then the drills, then the answers.

The method that scales to /30

You need three numbers: block size, network address, broadcast address.

  1. Block size = 256 − (the mask octet you are in). For /26 the mask octet is 224, so block size = 32.
  2. Networks start at multiples of the block size in the interesting octet.
  3. Broadcast = next network − 1.
  4. Usable hosts = broadcast − network − 1.
Prefix Mask octet Block size Usable
/25 128 128 126
/26 192 64 62
/27 224 32 30
/28 240 16 14
/29 248 8 6
/30 252 4 2
/31 254 2 2 (point-to-point, no broadcast)
/32 255 1 1 (host route)

Memorise this table and most questions collapse into one subtraction.

Worked example, slowly

Which subnet is 192.168.10.77/27 in, and what are its bounds?

  • /27 → mask 255.255.255.224 → block size 32.
  • Multiples of 32: 0, 32, 64, 96.
  • 77 falls between 64 and 96 → network 192.168.10.64.
  • Broadcast = 96 − 1 = 95.
  • Usable = 65–94 (30 addresses).

Drills

Answer before scrolling. Aim for under 20 seconds each.

  1. Network and broadcast for 10.0.5.130/25?
  2. How many usable hosts in /28?
  3. Is 172.16.4.200/26 in the same subnet as 172.16.4.190/26?
  4. Split 192.168.0.0/24 into four equal subnets. List them.
  5. Smallest prefix that holds 50 hosts?
  6. Smallest prefix that holds 500 hosts?
  7. Point-to-point link, minimal waste: which prefix?
  8. 203.0.113.0/24 — network and broadcast of the 6th /28?
  9. Two hosts, 10.1.1.10/24 and 10.1.2.10/24: same subnet?
  10. Summarise 10.8.0.0/24 through 10.11.0.0/24 into one prefix.

Answers

  1. Block 128 → network 10.0.5.128, broadcast 10.0.5.255.
  2. 16 − 2 = 14.
  3. Block 64 → 200 is in 192–255, 190 is in 128–191. Different subnets.
  4. /26 → 192.168.0.0, .64, .128, .192, each with 62 usable.
  5. 50 hosts needs 6 host bits (62) → /26.
  6. 500 needs 9 host bits (510) → /23.
  7. /31 (RFC 3021), or /30 if the platform does not support /31.
  8. /28 block 16; networks at 0,16,32,48,64,80 → 6th is 203.0.113.80, broadcast .95.
  9. No — /24 boundaries fall between 10.1.1.x and 10.1.2.x.
  10. 10.8.0.0/22 (covers 10.8.0.0–10.11.255.255).

The mistakes that matter in practice

Mistake Consequence
Gateway outside the host's subnet Host ARPs for an address it cannot reach, or sends to the wrong next hop
/24 assumed when the mask is /25 Half the hosts are unreachable and it looks intermittent
Two subnets with the same CIDR Routing becomes ambiguous; one side is silently unreachable
Summarising wider than the addresses present A blackhole for the gap
Forgetting the network and broadcast Off-by-two in capacity planning, occasionally in DHCP scopes
Overlapping ranges across VPN/VPC Blocks the tunnel entirely; requires renumbering

IPv6, briefly

No broadcast, no NAT, and the arithmetic is hexadecimal. The equivalents:

  • /64 — one subnet, always; SLAAC requires it.
  • /56 — a typical site allocation (256 subnets).
  • /48 — a typical organisation allocation (65,536 subnets).
  • /127 — point-to-point links.
  • Subnetting is on the fourth hextet boundary; you almost never subnet below /64.

The habit that transfers: think in prefix lengths and boundaries, not in dotted decimal.

From the Network Engineering research vault · CC BY 4.0 · all notes · raw markdown