CompSci.rocks
LearnNetworking

VLSM Practice Problems

Practice Variable Length Subnet Masking: allocate a network into differently-sized subnets based on host requirements, then check your network, broadcast, usable range, and CIDR for each one.

Variable Length Subnet Masking (VLSM) is what happens once you're comfortable with basic subnetting and need to fit several differently-sized networks into one address block without wasting addresses. If you haven't worked through fixed-size subnetting yet, start with the subnetting practice problems page first — VLSM is the same math, just applied once per subnet instead of once for the whole network. Prefer working from paper instead of a screen, or need a set of problems to hand out to a whole class? This VLSM worksheet generator builds a printable version of the same kind of problem.

VLSM Practice

You're given a network and a list of subnets with their host requirements, in no particular order. Figure out how to allocate them — largest first — then fill in the network address, first usable address, last usable address, broadcast address, and CIDR for each one.

What is VLSM and why use it?

Fixed-length subnet masking (FLSM) splits a network into equal-sized pieces — every subnet gets the same mask, whether it needs 2 addresses or 200. That's simple, but wasteful: a point-to-point link between two routers only needs 2 usable addresses, and giving it the same /24 as a 200-host office wastes 252 addresses on nothing.

VLSM fixes that by giving every subnet a mask sized to what it actually needs. A 200-host office might get a /24, while the point-to-point link next to it gets a /30 — and both come out of the same larger block of address space without overlapping.

How to solve a VLSM problem by hand

Step 1 — List every required subnet and its host count. These almost never come pre-sorted — a real problem (and the practice problems below) will hand you a list like "Sales: 100 hosts, IT: 50 hosts, Point-to-Point Link: 2 hosts" in whatever order the scenario describes them.

Step 2 — Sort the list from the most hosts needed to the fewest. This is the step people skip, and it's the one that makes VLSM work. Allocating largest to smallest guarantees every subnet lands on a correctly aligned address boundary automatically — no extra math required to check alignment.

Step 3 — Find the block size each subnet needs. Same formula as regular subnetting: find the smallest power of two that's at least 2 more than the host count (the network and broadcast addresses still get subtracted out). 100 hosts needs a block of 128 (since 64 only gives 62 usable), which is a /25.

Step 4 — Allocate from the start of the given network, in your sorted order. The first (largest) subnet's network address is the given network's own address. Every subnet after that starts immediately where the previous one's broadcast address left off — its network address is the previous broadcast address plus 1.

Step 5 — Compute the usual four values for each subnet. Broadcast address is the network address plus the block size minus 1; first usable is the network address plus 1; last usable is the broadcast address minus 1.

Worked example

Given network 192.168.10.0/24, allocate: Sales (100 hosts), IT (50 hosts), Point-to-Point Link (2 hosts).

Sorted largest to smallest: Sales (100), IT (50), Point-to-Point Link (2).

Subnet Hosts Block size CIDR Network Broadcast First usable Last usable
Sales 100 128 /25 192.168.10.0 192.168.10.127 192.168.10.1 192.168.10.126
IT 50 64 /26 192.168.10.128 192.168.10.191 192.168.10.129 192.168.10.190
Point-to-Point Link 2 4 /30 192.168.10.192 192.168.10.195 192.168.10.193 192.168.10.194

Notice that IT's network address (.128) is exactly Sales's broadcast address (.127) plus 1, and the point-to-point link's network address (.192) is exactly IT's broadcast address (.191) plus 1. That's VLSM in a nutshell — each subnet picks up exactly where the last one ended. Out of the full /24 (256 addresses), this allocation uses 196 and leaves 60 addresses (192.168.10.196192.168.10.255) free for future growth.

Common mistakes to watch for

  • Allocating in the order the subnets were given, instead of sorting by size first. This is the single most common VLSM mistake, and it usually causes overlapping subnets or wasted alignment gaps.
  • Sizing a block off the host count alone. Remember the network and broadcast addresses come out of every block — a block size of 100 doesn't cover 100 hosts, since only 98 of those addresses would be usable.
  • Starting the next subnet at the wrong address. It's the previous subnet's broadcast address plus 1, not its network address plus the block size (which happens to be the same value, but is easy to get backwards under pressure).
  • Forgetting a point-to-point link still needs its own block. Even a 2-host link needs a /30 — it can't just borrow 2 addresses out of the middle of another subnet.

Once VLSM allocation feels natural, the subnet calculator is handy for double-checking any single subnet's values once you've worked out where it starts, and the subnetting practice problems page is worth revisiting if the basic block-size math above ever feels shaky.