Skip to content
BytePath v0.0.35

IPv4 Subnetting and CIDR

Subnetting divides address space into prefixes that match network size and routing boundaries. The key is to count bits, preserve block alignment, and check the result rather than memorize a list of numbers.

IPv4 has 32 bits. A /24 prefix has 24 network bits and 8 host bits, corresponding to mask 255.255.255.0. A /26 has 26 network bits and 6 host bits, corresponding to 255.255.255.192.

The total number of addresses in a prefix is 2^(32 - prefix length). For an ordinary IPv4 subnet shorter than /31, the conventional host capacity is total addresses minus two, because the network and directed broadcast addresses are reserved. /31 point-to-point links (RFC 3021) and /32 host routes are exceptions; do not subtract two for them.

For 192.168.10.77/26:

  1. /26 leaves six host bits, so each block contains 2^6 = 64 addresses.
  2. The blocks in the final octet start at 0, 64, 128, and 192.
  3. .77 falls in the block starting at .64.
  4. The subnet is 192.168.10.64/26; its conventional host range is .65–.126, and its broadcast is .127.

Check: 64 addresses run from .64 through .127, with the next subnet beginning at .128.

Suppose 192.168.10.0/24 must become four equal subnets, each supporting at least 50 ordinary hosts. Six host bits provide 64 total addresses (62 conventional hosts), so /26 is the smallest matching block. The four aligned subnets are:

Subnet Host range Broadcast
192.168.10.0/26 .1–.62 .63
192.168.10.64/26 .65–.126 .127
192.168.10.128/26 .129–.190 .191
192.168.10.192/26 .193–.254 .255

All four blocks exactly cover the original /24; they do not overlap or leave a gap.

VLSM assigns different prefix lengths to different needs. Start with the largest requirement, round each host requirement up to a block that fits, and allocate each block on its correct boundary. For example, 50 ordinary hosts need /26 (62 hosts), while 20 need /27 (30 hosts). A point-to-point link can use /31 when both endpoints support the standard.

For each allocation, record the network/prefix, usable range or link endpoints, and broadcast where applicable. Check that no block overlaps another and that each network address is aligned to its block size. Leave unallocated capacity visible in the plan.

  • Counting total addresses as usable hosts without considering network and broadcast reservations.
  • Starting a subnet at an arbitrary address instead of a valid block boundary.
  • Forgetting that 172.16.0.0/12, not all of 172.0.0.0/8, is private space.
  • Assuming every interface needs a default gateway; a gateway is a route for destinations not covered by more specific routes.
  • Using a calculator without checking whether the input subnets overlap in the wider design.

Write the prefix and mask first, identify the block size, then verify network, broadcast, and the next block. The Subnet Calculator can check your work after you calculate it manually.

Find the subnet, conventional host range, and broadcast for 10.20.30.141/27. Then identify the next subnet boundary. Confirm that the block has 32 total addresses and that your answer ends before the next block begins.

You should be able to calculate a subnet from an address and prefix, split an address block into equal networks, and make a non-overlapping VLSM plan with /31 and /32 exceptions in mind.

Available

Difficulty
Time
Practice
Assessment
Knowledge check