VLSM Explained
Variable Length Subnet Masking (VLSM) is the ability to use different subnet masks within a single major network. Without VLSM (called Fixed Length Subnet Masking, FLSM), every subnet in a network must use the same prefix, which wastes addresses when subnets vary widely in size. VLSM lets you size each subnet to its actual need. Verify any VLSM layout with the subnet calculator.
FLSM vs VLSM
| Property | FLSM | VLSM |
|---|---|---|
| Mask per network | One fixed prefix | Different prefixes allowed |
| Address efficiency | Low (sized to largest subnet) | High (right-sized) |
| Routing protocol support | RIPv1, IGRP | RIPv2, EIGRP, OSPF, IS-IS, BGP |
| Required for route summarization | No | Yes |
The VLSM allocation method
The standard procedure, in order:
- List every subnet with its required host count.
- Sort largest to smallest. Allocating the biggest first prevents fragmentation.
- Pick the smallest prefix that fits each subnet (2^h − 2 ≥ hosts needed).
- Allocate sequentially from your starting block, advancing by each subnet's block size.
- Double-check no overlaps — the next network address equals the previous broadcast + 1.
Step-by-step worked example
You are given 192.168.1.0/24 and need four subnets:
| Subnet | Hosts needed |
|---|---|
| LAN-A (users) | 100 |
| LAN-B (servers) | 50 |
| LAN-C (printers) | 20 |
| WAN link (P2P) | 2 |
Step 1 — Size each subnet
| Subnet | Hosts | Prefix | Host bits | Usable |
|---|---|---|---|---|
| LAN-A | 100 | /25 | 7 | 126 |
| LAN-B | 50 | /26 | 6 | 62 |
| LAN-C | 20 | /27 | 5 | 30 |
| WAN | 2 | /30 | 2 | 2 |
Step 2 — Allocate sequentially (largest first)
| Subnet | Prefix | Network | Usable 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 |
Total used: 256 addresses — the entire /24, with zero waste. With FLSM you would have used a /25 for all four subnets, consuming 4 × 128 = 512 addresses (a /23) and wasting most of them on the 2-host WAN link.
Step 3 — Verify alignment
Each network address must be a multiple of its block size: 0 (÷128), 128 (÷64), 192 (÷32), 224 (÷4). All pass. The next free address would be 192.168.1.228.
Configuration example
! LAN-A — users
interface Vlan10
ip address 192.168.1.1 255.255.255.128
! LAN-B — servers
interface Vlan20
ip address 192.168.1.129 255.255.255.192
! WAN link to branch
interface Serial0/0/0
ip address 192.168.1.225 255.255.255.252Routing protocol requirements
VLSM requires a classless routing protocol that carries the prefix length in its updates. OSPF, EIGRP, IS-IS, RIPv2, and BGP all support VLSM. RIPv1 and IGRP are classful and cannot advertise variable-length masks — they will summarize to the classful boundary and break your design.
! Enable RIPv2 (classless) to carry VLSM
router rip
version 2
no auto-summary
network 192.168.1.0Common VLSM mistakes
- Allocating smallest-first — fragments the block and can make a large subnet not fit.
- Forgetting the −2 — a /27 gives 30 usable, not 32.
- Using classful routing — RIPv1/auto-summary collapses your subnets.
- Overlapping subnets — always compute the next network as previous broadcast + 1.
Related guides & tools
- VLSM Calculator & Subnet Planner — plan your VLSM subnets automatically
- Subnet Overlap Checker — verify your VLSM plan has no overlaps
- IPv4 Subnetting Guide
- Route Summarization Explained
- How to Choose a Subnet Size
- Subnetting Cheat Sheet