Skip to main content
Varaxon Technologies

Websites and networks

VLSM subnetting, step by step: a worked example for an office network

Split one /24 into right-sized subnets for staff, guests, servers, printers and router links: a worked VLSM example, and why the largest goes first.

By Brandon Sooknanan, Founder, Varaxon Technologies · · 5 min read

Splitting a network into equal pieces is easy: a /24 makes two /25s, four /26s, and so on. Real networks aren't equal, though. The staff network needs a hundred addresses, the link between two routers needs two, and giving them the same size block either wastes most of the space or runs out of it. VLSM is the fix: size each subnet for what it needs.

This guide works through one complete example by hand, so you can see why each step happens, and then shows how to get the same answer in seconds from the calculator.

The brief

A small office has been given 192.168.10.0/24 (256 addresses) and needs these networks:

Subnets the office needs
NetworkHosts needed
Staff100
Guest Wi-Fi50
Servers20
Printers and cameras10
Link to branch A2
Link to branch B2

Count the router's own address on each network as one of the hosts. It needs an address like any other device.

Step 1: find the smallest block that fits each network

A subnet with prefix /n has 2^(32 − n) addresses. Two of them are reserved, the network address (first) and the broadcast address (last), so the usable hosts are 2^(32 − n) − 2. Pick the smallest block whose usable count covers the need:

Block size for each network
NetworkHosts neededSmallest blockMaskUsable
Staff100/25255.255.255.128126
Guest Wi-Fi50/26255.255.255.19262
Servers20/27255.255.255.22430
Printers and cameras10/28255.255.255.24014
Link to branch A2/31255.255.255.2542
Link to branch B2/31255.255.255.2542

The router links use /31, which RFC 3021 allows for point-to-point links: with only two ends, neither address is needed as network or broadcast. Most current routers support it. If yours doesn't, use a /30 (four addresses, two usable) instead.

Step 2: sort largest first

This is the rule that makes VLSM work. A block of size N must start at an address that's a multiple of N: a /26 (64 addresses) can start at .0, .64, .128 or .192, never at .100. If you place small subnets first, the big ones can't find an aligned start, and you either waste space or run out. Placing the largest first means every later, smaller block lands on a boundary automatically.

Step 3: place each block, one after another

Start at the beginning of the /24 and lay the blocks down in order. Each one starts where the last one ended.

The finished VLSM plan for 192.168.10.0/24
NetworkSubnetUsable rangeBroadcastSpare
Staff192.168.10.0/25192.168.10.1 to .126192.168.10.12726
Guest Wi-Fi192.168.10.128/26192.168.10.129 to .190192.168.10.19112
Servers192.168.10.192/27192.168.10.193 to .222192.168.10.22310
Printers and cameras192.168.10.224/28192.168.10.225 to .238192.168.10.2394
Link to branch A192.168.10.240/31192.168.10.240 and .241None (/31)0
Link to branch B192.168.10.242/31192.168.10.242 and .243None (/31)0

That uses 244 of the 256 addresses. The 12 left over, 192.168.10.244 to .255, are still aligned blocks (a /30 at .244 and a /29 at .248) you can hand out later.

Step 4: check the plan for growth

A plan that fits today can be full next year. Look at the Spare column: the staff network has room for 26 more devices, the printers only 4. If the office expects to grow, decide now, because re-addressing a live network later is painful. Options:

  • Size up a network you expect to grow, then re-run the plan. Asking for 20 printer addresses instead of 10 moves it from a /28 to a /27, and in this /24 that no longer fits alongside everything else: the calculator will say so.
  • Leave the spare blocks at the end unassigned, so neighbouring networks can't grow into each other's space by accident.
  • If the whole plan doesn't fit, start from a bigger network. A /23 gives 512 addresses; private ranges like 10.0.0.0/8 have plenty.

Doing it with the calculator

Open the subnet calculator, choose VLSM, enter 192.168.10.0/24, and add each network with the number of hosts it needs. It sorts them largest first, places every block on an aligned boundary, and returns the same table as above: subnet, mask, first and last host, broadcast and spare addresses for each, plus how much of the network is left. If a network won't fit, it says which one and why.

It also turns an IP range into CIDR blocks. Firewall rules and allow lists often need CIDR, while people think in ranges. For example, 192.168.1.10 to 192.168.1.20 becomes four blocks: 192.168.1.10/31, 192.168.1.12/30, 192.168.1.16/30 and 192.168.1.20/32.

Everything runs in your browser, so it's safe to use with internal address plans, and the code is MIT licensed if you want to build it into your own tools.

After the plan: scan what you built

A subnet plan is also a scanning plan. Each subnet becomes a target range for your vulnerability scanner, and keeping guests, servers and printers apart makes the results easier to read and the fixes easier to assign. Our guide to internal vs external vulnerability scans covers what to point the scanner at, and Scan Hub turns the export from any scanner into a report per client or per site.

Common questions

What is VLSM in networking?

Variable Length Subnet Masking: dividing one network into subnets of different sizes, each sized for the number of hosts it needs, instead of equal-sized pieces.

Why do you assign the largest subnet first in VLSM?

Each block must start at a multiple of its own size. Placing the largest blocks first keeps every later, smaller block on an aligned boundary, with no wasted gaps.

How many hosts fit in a /26?

62. A /26 has 64 addresses, and the first (network) and last (broadcast) can't be given to devices. In general a /n has 2^(32 − n) − 2 usable hosts, except /31 and /32.

Should I use /30 or /31 for router links?

/31 saves two addresses per link and is allowed for point-to-point links by RFC 3021. Use /30 if any device on the link doesn't support /31.

Turn your next scan export into a client-ready report.

Run a free pre-flight check

Cookie preferences

Essential site functions remain available whichever option you choose. Your advertising choice is saved on this site. The Scan Hub has a separate choice.

Google and Reddit may receive cookies, identifiers, browser and device information, and your network/IP information. Reject or withdraw at any time. Read the Privacy Policy.