Knowledge base

VLSM tutorial — a worked subnet planning example

Plan different-sized subnets, choose prefixes, align blocks, and work through a complete /24 example.

By the end of this guide, you will be able to divide one network among teams with different needs without overlapping addresses. From 192.168.0.0/24, for example, we will give an office a /26 for 50 hosts and Wi-Fi a smaller /28 for 12, while preserving one contiguous block for growth. VLSM means Variable Length Subnet Mask: using different mask lengths in one plan. It is not a separate protocol; it uses subnet masks and CIDR prefixes. A valid plan contains non-overlapping, correctly aligned blocks that all fit inside the base network.

VLSM versus equal-sized subnets

FLSM (Fixed Length Subnet Mask) chooses one size for every subnet. VLSM fits each block to demand, so a department needing addresses for 50 devices can use /26 while a 12-device segment uses /28. The trade-off is a more exact plan and routing that carries prefix lengths.

Choosing a prefix

For a conventional /0 through /30 IPv4 subnet, choose the smallest h for which 2^h − 2 covers the hosts; the prefix is 32 − h. Fifty hosts need /26, twenty need /27, and ten need /28. Count gateways, infrastructure interfaces, and planned headroom as addresses too.

Why allocate largest first

Descending order is not a protocol requirement, but it is a reliable planning algorithm. A large block has fewer valid boundaries and may no longer fit after space is fragmented. A /26 starts every 64 addresses, /27 every 32, and /28 every 16.

Example: 192.168.0.0/24

Assume Office needs 50 host addresses, Lab 25, Wi-Fi 12, and Management 6. Each count already includes the gateway and other interfaces. The minimum allocation is /26, /27, /28, and /29. The calculator selects these prefixes for those exact requirements; it does not add a gateway or headroom automatically.

The table below shows a plan with headroom: Management receives /28 instead of the minimum /29. To reproduce it in the calculator, enter 7 for Management: 6 needed addresses plus at least 1 for growth. A /29 is now too small, so the calculator selects a /28 with 14 host slots. That leaves 8 slots above today's demand of 6. Keep the other requirements unchanged.

SegmentBlockHost rangeBroadcastHost capacity
Office192.168.0.0/26.1–.62.6362
Lab192.168.0.64/27.65–.94.9530
Wi-Fi192.168.0.96/28.97–.110.11114
Management192.168.0.112/28.113–.126.12714

In the minimum plan, Management occupies 192.168.0.112/29: hosts .113–.118 and broadcast .119. This also leaves 192.168.0.120/29 free alongside 192.168.0.128/25. The headroom plan assigns the first of these free blocks to Management, reducing the unallocated space.

The contiguous 192.168.0.128/25 remains free. In practice, you can divide that block into more correctly aligned subnets later. Do not add it to unused host slots inside assigned subnets: those slots still belong to their existing blocks and cannot be assigned to another segment. Plan your own requirements with the VLSM calculator.

Headroom and future growth

You cannot arbitrarily enlarge a subnet later. Growing /28 to /27 needs the adjacent block to be free and the start aligned to a /27 boundary, and usually requires renumbering. Reserve headroom deliberately for growth, gateways, management, and services rather than inflating every segment without a limit.

VLANs, subnets, and routing

A VLAN is a layer-2 domain, a subnet is a layer-3 addressing plan, and routing moves traffic between subnets. One VLAN often maps to one subnet, but VLSM calculations do not create a VLAN, gateway interface, DHCP scope, or firewall policy.

/31 and calculator limits

RFC 3021 defines /31 for point-to-point links. Ordinary user networks use the network–hosts–broadcast model, so a planner may intentionally avoid selecting /31 automatically. Treat point-to-point links as a separate requirement and confirm support on both devices.

Checklist

  • Normalize the base network and list every demand, including gateways and headroom.
  • Allocate largest first; verify each start boundary and end address.
  • Confirm no overlap and that every block remains inside the base network.
  • Record free space as actual prefixes, not only a total address count.
  • Connect the plan to VLAN, routing, DHCP, and security configuration.

A little network lab

One extra host changes the allocation

Split 10.42.0.0/24 for 100, 45, 13, and 6 host addresses, including gateways. Then add one address to the final segment and compare the free space.

Example result.0/25 → .128/26 → .192/28 → .208/29Open example in calculator
  1. 100 hosts require /25 (126 slots), and 45 require /26 (62 slots). They occupy .0–.127 and .128–.191.

  2. 13 require /28: .192–.207. For 6, the minimum is /29: .208–.215, with hosts .209–.214. Free blocks are 10.42.0.216/29 and 10.42.0.224/27, totalling 40 addresses.

  3. Changing the final requirement to 7 needs /28: .208–.223. Only 10.42.0.224/27 remains free, or 32 addresses. One extra host increased the allocation by 8 addresses.

Your turn

After changing the requirement to 7, can another segment fit 30 hosts including its gateway?

Show answer and explanation

Yes. To preserve the existing allocations, use 10.42.0.224/27: hosts .225–.254 and broadcast .255. Recalculating the entire list sorts requirements largest first and may move earlier segments. 31 hosts would require a /26 and no longer fit.

Official documents

Standards & sources

Sources checked:

The date refers to checking the listed documents and registries, not endorsement by their authors. Calculation assumptions and limits appear with the result. How we prepare the material.