I ran an office network. The engineering floor had 60 machines, marketing had 25, finance had 15, and the executive floor had 4. Each team "just needs its own subnet," so I handed out four fresh /24s. That's 4 x 254 usable addresses — more than 1,000 — for a building with about 100 machines total. I was using roughly 10% of what I allocated and calling it good practice.
The same scene repeats everywhere: a /24 with 20 devices on it, a /26 holding 15, a VLAN with a printer and a door controller. Each one feels harmless, until you actually run out of address space and have to renumber the whole floor.
The fix is VLSM — Variable Length Subnet Masking. And it's a one-sentence rule once you see the word.
The one-sentence rule
VLSM means different subnets inside the same network can use different prefix lengths, so each subnet is sized to what it actually contains — instead of forcing every subnet to share the same width.
Without VLSM, if you're working inside 192.168.0.0/24, every subnet you carve out of it has the same size. Two /25s, each 126 usable addresses. A team of 15 gets 126 addresses and the other 111 sit idle. Then you run out of /24s and wonder where all the space went.
With VLSM, you mix the sizes freely: one /26 (62 usable) for engineering's 60 machines, a /27 (30 usable) for the 25-person team, another /27 (30 usable) for the 15-person team, and a /28 (14 usable) for the executive floor — all carved from a single /24.
A worked example (this is the whole trick)
Let's split 192.168.10.0/24, which gives 254 usable addresses, into four segments: 60 devices, 25 devices, 15 devices, and 4 devices.
For each, round the host count up to the next power of two, then subtract 2 for the network and broadcast addresses, then pick the prefix that matches:
| Segment | Prefix | Addresses | Usable hosts | Assign to |
|---|---|---|---|---|
| 192.168.10.0 | /26 | 64 | 62 | Engineering (60) |
| 192.168.10.64 | /27 | 32 | 30 | Marketing (25) |
| 192.168.10.96 | /27 | 32 | 30 | Finance (15) |
| 192.168.10.128 | /28 | 16 | 14 | Exec (4) |
Add up the usable hosts: 62 + 30 + 30 + 14 = 136 total — still barely half of the 254 the /24 could hold, but every team gets only as much as it needs.
The subtle part: VLSM doesn't mean "make every subnet as small as possible." It means "choose each subnet's size from the same /24 based on its need."
A quick reference for picking the prefix
You don't want to redo the subtraction every time you plan a segment, so here's the lookup I actually use:
| Hosts needed | Block | Prefix | Usable |
|---|---|---|---|
| 2 | 4 | /30 | 2 |
| 6 | 8 | /29 | 6 |
| 14 | 16 | /28 | 14 |
| 30 | 32 | /27 | 30 |
| 62 | 64 | /26 | 62 |
| 126 | 128 | /25 | 126 |
| 254 | 256 | /24 | 254 |
To read it: "I need room for 60 machines" → 60 fits in the 64-size block → that's a /26, giving 62 usable.
That's the whole skill: memorize the "next power of two minus 2" ladder, and VLSM becomes table lookup instead of head-scratching.
When you should NOT use VLSM
- Routing gets more complicated. Every width you mix in means the router carries more entries.
- Future growth is harder. If "25 devices" becomes "80 next quarter," you're renumbering that subnet.
- The next person has to read your mind. The cleverest allocation is the hardest to maintain.
- You're still learning the basic power-of-two math. Flat equal-sized subnets are a fine starting point.
Build the plan without doing arithmetic in your head
When you're laying out several real segments, the subtraction slips — a /26 becomes a /28, or two blocks overlap. I keep a VLSM calculator that takes the network and the list of host counts, and returns a minimal, non-overlapping layout, showing the network, usable range, and hosts for each segment side by side. It's free, runs entirely in the browser, and makes the plan verifiable instead of vibes.
For the longer reasoning — why variable-length works and a fuller worked example — I've written it up in VLSM explained.
The takeaway is short: the /24 you give to a 4-person team isn't "playing it safe" — it's burning the exact thing that eventually runs out. VLSM keeps one clean address budget, gives each segment only what it needs, and leaves room for the next request. It stopped me from asking for "another /24 for five people," and it'll save your address space the same way.
Top comments (0)