tip
~/geeksubnet/guides/vlsm

VLSM: design a real addressing plan

From requirements to a non-overlapping plan. Check the result in the VLSM solver.

Variable Length Subnet Masking (VLSM) is just subnetting where the pieces are different sizes. It matters because real networks are lopsided: a user VLAN might need 500 addresses while a router-to-router link needs two. Giving both a /24 wastes a thousand addresses. This guide treats VLSM as a repeatable design process and works a full example end to end.

Why fixed-size subnets waste space

Suppose you carve 10.0.0.0/24 into eight equal /27 subnets (30 hosts each). A point-to-point link between two routers uses 2 of those 30 addresses; the other 28 are stranded — you cannot lend them to the busy user segment next door, because they belong to a different subnet. Multiply that across dozens of links and you run out of space in a block that is mostly empty. VLSM fixes this by sizing each subnet to its actual need.

The algorithm: largest first

There is one rule that makes VLSM work without overlaps: allocate the largest subnet first, then the next largest, and so on. Each subnet is placed at the next free, correctly aligned boundary. Sorting largest-to-smallest guarantees alignment falls into place naturally; doing it in the wrong order leaves awkward gaps.

  1. List every segment with its required usable host count.
  2. For each, find the smallest prefix that fits: round the requirement (plus 2 for network and broadcast) up to the next power of two.
  3. Sort the list from largest block to smallest.
  4. Assign blocks in order, each starting where the previous one ended.

Worked example: five segments in a /22

You are given 172.16.0.0/22 (1,024 addresses) and these requirements:

SegmentHosts neededSmallest prefixBlock size
Office LAN400/23512
Wi-Fi200/24256
Servers60/2664
Management20/2732
Router link2/304

A 400-host segment needs 402 addresses including network and broadcast; the next power of two is 512, a /23. Wi-Fi's 200 rounds up to 256, a /24. Now allocate largest first, starting at 172.16.0.0:

Office LAN  /23   172.16.0.0    →  172.16.1.255    (510 usable)
Wi-Fi       /24   172.16.2.0    →  172.16.2.255    (254 usable)
Servers     /26   172.16.3.0    →  172.16.3.63     ( 62 usable)
Management  /27   172.16.3.64   →  172.16.3.95     ( 30 usable)
Router link /30   172.16.3.96   →  172.16.3.99     (  2 usable)

Each block begins exactly where the last one ended, and each start address is a multiple of its own block size — that is what "aligned" means. Total consumed: 512 + 256 + 64 + 32 + 4 = 868 addresses out of 1,024, leaving 172.16.3.100 through 172.16.3.255 (156 addresses) free for growth. Efficiency: about 85%.

Always size to the realistic maximum, not today's count. A segment with 60 servers that grows past 62 forces a painful renumber. If you expect growth, give Servers a /25 (126 usable) now — VLSM is about deliberate sizing, not squeezing every address.

Verifying the plan

Two checks catch almost every mistake. First, no overlap: each subnet's broadcast address must be lower than the next subnet's network address. Second, alignment: each network address modulo its block size must be zero (e.g. a /26's network must be a multiple of 64). The VLSM solver enforces both and shows the allocation efficiency; the subnet splitter handles the simpler case where every segment is the same size.

Common mistakes

Open the VLSM solver → ← Subnetting basics Next: IPv6 → All guides