Lesson 4 — VLSM Basics
VLSM Basics
Carve one address block into right-sized subnets with variable-length masks, allocating largest first so nothing overlaps and nothing is wasted.
Lesson orientation
What you'll learn (4 objectives)~27 min: video → lesson → check → apply → lab prep
Learning objectives
- Explain why fixed-length subnetting wastes addresses and VLSM conserves them
- Size each subnet to its host count by rounding up to a power of two
- Allocate subnets largest-first from a single block without overlap
- Verify a plan by checking that each subnet starts on a valid boundary for its own size
Terms you will see
Time breakdown
- Read the notes12 min
- Subnetting Trainer — VLSM mode10 min
- Worked allocation and prediction5 min
Why not one mask for everything?
Fixed-length subnetting forces every subnet in a design to the same size. That is simple, and it is wasteful the moment your segments differ. If you split a block into /24s but one segment holds 200 devices and another holds a two-router link, the small segment burns 252 addresses it will never use.
Variable-length subnet masking lets each subnet take the prefix that fits its own host count. One block stretches much further, and it becomes practical to give a point-to-point link the /30 it actually needs rather than a whole /24. The arithmetic is nothing new — it is the block-size method from Lesson 2, applied repeatedly and in the right order.
Sizing a subnet from its host requirement
- Take the number of hosts the segment needs, including realistic growth.
- Find the smallest number of host bits h where 2^h − 2 is at least that requirement. The two lost addresses are always the network and broadcast.
- The block size is 2^h, and the prefix is 32 − h.
| Hosts needed | Host bits | Block size | Prefix | Usable hosts |
|---|---|---|---|---|
| 1 – 2 | 2 | 4 | /30 | 2 |
| 3 – 6 | 3 | 8 | /29 | 6 |
| 7 – 14 | 4 | 16 | /28 | 14 |
| 15 – 30 | 5 | 32 | /27 | 30 |
| 31 – 62 | 6 | 64 | /26 | 62 |
| 63 – 126 | 7 | 128 | /25 | 126 |
| 127 – 254 | 8 | 256 | /24 | 254 |
Allocate largest first
Sort the requirements from largest to smallest, place the biggest subnet at the start of the block, and lay each subsequent subnet immediately after the previous one's broadcast address. Worked through on 192.168.1.0/24 for Engineering (100 hosts), Sales (50), Ops (20), and a router-to-router link (2):
| Segment | Hosts | Prefix | Network | First host | Last host | Broadcast |
|---|---|---|---|---|---|---|
| Engineering | 100 | /25 | 192.168.1.0 | 192.168.1.1 | 192.168.1.126 | 192.168.1.127 |
| Sales | 50 | /26 | 192.168.1.128 | 192.168.1.129 | 192.168.1.190 | 192.168.1.191 |
| Ops | 20 | /27 | 192.168.1.192 | 192.168.1.193 | 192.168.1.222 | 192.168.1.223 |
| R2R link | 2 | /30 | 192.168.1.224 | 192.168.1.225 | 192.168.1.226 | 192.168.1.227 |
Every subnet begins exactly where the previous broadcast plus one falls, and every start is a valid boundary for its own size: 128 is a multiple of 64, 192 is a multiple of 32, and 224 is a multiple of 4. Addresses from 192.168.1.228 onward are still free. That alignment is not luck — it is what descending order buys you, because a large block always lands on a boundary that the smaller blocks after it can also satisfy.
The two ways a plan goes wrong
These are different failures with different symptoms, and it is worth keeping them apart.
So: allocate largest first to avoid wasting the block, and check alignment to avoid overlapping it. The exam tests both, and the two mistakes look nothing alike once you know what you are looking at.
Verifying a finished plan
- Every network address is a multiple of its own block size.
- Every subnet's broadcast is exactly one below the next subnet's network address, with no gap you did not intend.
- No subnet's range extends into the next subnet's range.
- Every segment's usable host count is at least its stated requirement, computed as 2^h − 2.
- The total addresses allocated do not exceed the parent block.
Run those five checks on any plan before you configure anything. Four of them are arithmetic you can do in your head after this week, and they catch every error described above.
What you should retain
- VLSM matches each subnet's prefix to its own host count, so one block stretches much further.
- Size by rounding up to the smallest h where 2^h − 2 meets the requirement.
- Allocate largest first, placing each subnet at the previous broadcast plus one.
- A subnet must start on a multiple of its own block size — unaligned starts cause overlap.
- Small-first allocation does not usually overlap; it fragments the block and strands the large subnets.
- Point-to-point links take a /30 and give exactly 2 usable addresses.
Before you read on
Continue the allocation above. A second router-to-router link needs 2 hosts, and the next free address is 192.168.1.228. Give its prefix, network address, usable range, and broadcast — and confirm the start is properly aligned.
See it happen
Subnetting Trainer — VLSM mode
Switch the trainer into VLSM mode and allocate a few blocks end to end. Doing several by hand is what turns the largest-first rule from something you agree with into something you actually do under time pressure.
Check this section before moving on
Wildcards & VLSM Allocation
The quiz opens on its own page so you can focus on it. It is a Week 1 milestone, tracked separately from this lesson's own completion.
Topics covered
- • Subnet mask to wildcard conversion and what a wildcard matches
- • Sizing a subnet from its host requirement
- • Largest-first allocation and subnet boundaries
- • Spotting overlap and fragmentation in a plan
Study deeper
Topic guides extend this lesson — they do not replace the first-party walkthrough above.
IP Addressing & Subnetting
For additional VLSM worked examples and the wider addressing context behind this week's arithmetic
