Subnetting 101
Step 9 — VLSM (Variable Length Subnet Masking)
VLSM allows you to use different subnet masks within the same network, optimizing IP address usage. Instead of wasting addresses with fixed-size subnets, you right-size each subnet for its needs.
Why VLSM Matters
Without VLSM (wasteful):
You have a /24 network and need subnets for: 100 hosts, 50 hosts, 20 hosts, and 2 hosts.
Using fixed /26 subnets (62 hosts each): You can't even fit the 100-host subnet! Using fixed /25 subnets (126 hosts each): Only 2 subnets possible, massive waste.
With VLSM (efficient):
- 100 hosts → /25 (126 hosts)
- 50 hosts → /26 (62 hosts)
- 20 hosts → /27 (30 hosts)
- 2 hosts → /30 (2 hosts)
All fit within a single /24!
The VLSM Process
- Sort requirements from largest to smallest
- Allocate the largest subnet first from the start of your address space
- Allocate the next largest from where the previous ended
- Repeat until all subnets are allocated
- Verify no overlaps and addresses remain within your block
Worked Example
Given: 192.168.1.0/24
Create subnets for:
- LAN A: 100 hosts
- LAN B: 50 hosts
- LAN C: 25 hosts
- WAN link: 2 hosts
Step 1: Sort by size (largest first)
- LAN A: 100 hosts
- LAN B: 50 hosts
- LAN C: 25 hosts
- WAN link: 2 hosts
Step 2: Determine subnet sizes needed
- 100 hosts → need /25 (126 hosts, next power of 2 above 100+2)
- 50 hosts → need /26 (62 hosts)
- 25 hosts → need /27 (30 hosts)
- 2 hosts → need /30 (2 hosts)
Step 3: Allocate addresses
| Subnet | CIDR | Network | Host Range | Broadcast |
|---|---|---|---|---|
| LAN A | /25 | 192.168.1.0 | .1 - .126 | .127 |
| LAN B | /26 | 192.168.1.128 | .129 - .190 | .191 |
| LAN C | /27 | 192.168.1.192 | .193 - .222 | .223 |
| WAN | /30 | 192.168.1.224 | .225 - .226 | .227 |
Remaining addresses: 192.168.1.228 - 192.168.1.255 (available for future use)
Visual: Address Space Usage
192.168.1.0/24 Address Space:
Practice Problem
Given: 10.10.0.0/16
Create an addressing scheme for:
- Headquarters: 4,000 hosts
- Branch Office 1: 500 hosts
- Branch Office 2: 250 hosts
- Data Center: 100 hosts
- Management VLAN: 20 hosts
- 3 WAN links: 2 hosts each
Show Solution
Determine subnet sizes:
- 4,000 hosts → /20 (4,094 hosts)
- 500 hosts → /23 (510 hosts)
- 250 hosts → /24 (254 hosts)
- 100 hosts → /25 (126 hosts)
- 20 hosts → /27 (30 hosts)
- 2 hosts × 3 → /30 each (2 hosts)
| Subnet | CIDR | Network | Broadcast |
|---|---|---|---|
| HQ | /20 | 10.10.0.0 | 10.10.15.255 |
| Branch 1 | /23 | 10.10.16.0 | 10.10.17.255 |
| Branch 2 | /24 | 10.10.18.0 | 10.10.18.255 |
| Data Center | /25 | 10.10.19.0 | 10.10.19.127 |
| Management | /27 | 10.10.19.128 | 10.10.19.159 |
| WAN 1 | /30 | 10.10.19.160 | 10.10.19.163 |
| WAN 2 | /30 | 10.10.19.164 | 10.10.19.167 |
| WAN 3 | /30 | 10.10.19.168 | 10.10.19.171 |
Remaining: 10.10.19.172 - 10.10.255.255 for future growth
Common VLSM Mistakes
❌ Not sorting by size first
Always allocate largest subnets first to avoid fragmentation
❌ Overlapping subnets
Each new subnet must start AFTER the previous one ends
❌ Forgetting subnet boundaries
Subnets must start on proper boundaries (multiples of their block size)
Checkpoint
Before moving on, make sure you can:
- Explain why VLSM is more efficient than fixed-length subnetting
- Calculate the correct subnet size for a given host requirement
- Allocate multiple variable-sized subnets without overlaps
- Verify that all subnets fit within your address space