VLSM Subnetting Guide
VLSM (Variable Length Subnet Masking) lets you create subnets of different sizes within the same address space. Unlike fixed-length subnetting, where every subnet is the same size, VLSM assigns each subnet exactly the space it needs, minimizing waste.
VLSM vs. Fixed-Length Subnetting
Fixed-length (FLSM): You split 192.168.1.0/24 into 4 equal /26 subnets. Each has 62 usable hosts. If one department only needs 10 hosts, you waste 52 addresses.
VLSM: You assign a /25 (126 hosts) to the large department and a /28 (14 hosts) to the small one. No waste.
The VLSM Algorithm
-
List all requirements. Name each subnet and specify how many hosts it needs.
-
Sort largest first. Always allocate the biggest subnet first.
-
For each requirement:
- Add reserved IPs (2 for standard, 5 for AWS, etc.)
- Find the smallest power of 2 that fits
- Calculate the CIDR prefix:
32 - log₂(block_size) - Assign the next aligned address
-
Check fit. Verify everything fits within the base network.
Worked Example
Base: 192.168.1.0/24 (256 addresses)
Requirements:
- Engineering: 100 hosts
- Sales: 50 hosts
- Management: 10 hosts
Step 1: Sort. Engineering (100), Sales (50), Management (10)
Step 2: Engineering. 100 + 2 reserved = 102. Next power of 2 = 128. CIDR = /25. Assigned: 192.168.1.0/25 (128 addresses, 126 usable, 26 wasted)
Step 3: Sales. 50 + 2 = 52. Next power of 2 = 64. CIDR = /26. Next aligned address after 192.168.1.128 for a /26 (64-byte alignment) = 192.168.1.128. Assigned: 192.168.1.128/26 (64 addresses, 62 usable, 12 wasted)
Step 4: Management. 10 + 2 = 12. Next power of 2 = 16. CIDR = /28. Next aligned address = 192.168.1.192. Assigned: 192.168.1.192/28 (16 addresses, 14 usable, 4 wasted)
Result:
| Subnet | CIDR | Hosts Needed | Usable | Waste |
|---|---|---|---|---|
| Engineering | 192.168.1.0/25 | 100 | 126 | 26 |
| Sales | 192.168.1.128/26 | 50 | 62 | 12 |
| Management | 192.168.1.192/28 | 10 | 14 | 4 |
| Unallocated | 48 addresses |
Total: 208 of 256 addresses used (81.3% utilization). Try this in our VLSM planner.
The Alignment Rule
This is the most common source of VLSM bugs. A block of size N must start at an address that is a multiple of N.
- A /25 (128 addresses) must start at 0, 128, 256, …
- A /26 (64 addresses) must start at 0, 64, 128, 192, …
- A /28 (16 addresses) must start at 0, 16, 32, 48, …
If you allocate a /25 ending at address 128, the next /28 (16 addresses) starts at 128, not 129. And if you allocated a /25 ending at 128 and need a /26 (64 addresses) next, the aligned start is 128 because 128 is divisible by 64.
Misaligning a subnet means it overlaps with other blocks or can’t be represented by a single CIDR entry.
Common Mistakes
- Not sorting largest first. If you allocate small subnets first, you fragment the address space and may not fit the larger subnets.
- Forgetting alignment. Every block must start on a natural boundary.
- Ignoring cloud reserved IPs. AWS reserves 5 IPs per subnet, not 2. A “100 host” requirement in AWS needs 105 addresses, not 102.
- Not accounting for growth. If Engineering might grow from 100 to 200 hosts, allocate a /24 (254 hosts) instead of a /25 (126 hosts).
When to Use VLSM
- Campus networks with departments of different sizes
- Cloud VPC planning where you allocate subnets across availability zones
- CCNA/CCNP exams, where VLSM is a core topic
- Any network where different segments need different sizes
Tools
Our VLSM planner automates this entire process. Enter your base network, list your requirements, and it calculates optimal subnets with correct alignment and cloud mode support.