- VLSM sizes each subnet by its own host count.
- Always allocate the largest subnet first so every block stays aligned.
- A block of N addresses must start on a multiple of N.
- Leftover space splits into aligned free blocks you can use later.
Size subnets by host count, with AWS, Azure, GCP and OCI rules
Why equal subnets waste space
Say you have 192.168.10.0/24 and need five networks: an office LAN with 100 hosts, sales with 50, guest Wi-Fi with 20, servers with 10 and a WAN link with 2. Fixed-length subnetting has to use the largest size for all five. 100 hosts need a /25, and a /24 only holds two /25s. The plan fails before it starts.
With VLSM each subnet gets its own prefix. The office takes a /25, sales a /26, guest a /27, servers a /28 and the WAN link a /30. All five fit in the same /24 with space left over.
Step 1: size each subnet
Add 2 to each host count for the network and broadcast addresses, then round up to the next power of two.
| Subnet | Hosts | Plus 2 | Block | Prefix | Usable |
|---|---|---|---|---|---|
| Office LAN | 100 | 102 | 128 | /25 | 126 |
| Sales | 50 | 52 | 64 | /26 | 62 |
| Guest Wi-Fi | 20 | 22 | 32 | /27 | 30 |
| Servers | 10 | 12 | 16 | /28 | 14 |
| WAN link | 2 | 4 | 4 | /30 | 2 |
Step 2: sort largest first
A block of 128 addresses must start on a multiple of 128, a block of 64 on a multiple of 64, and so on. If you place a small block first, the next large block can no longer start on its boundary and you lose space or create overlaps. Sorting by size, largest first, makes every placement land on a valid boundary automatically.
Step 3: place the blocks
Start at the bottom of the network and put each block right after the previous one.
| Subnet | Network | First host | Last host | Broadcast |
|---|---|---|---|---|
| Office LAN | 192.168.10.0/25 | 192.168.10.1 | 192.168.10.126 | 192.168.10.127 |
| Sales | 192.168.10.128/26 | 192.168.10.129 | 192.168.10.190 | 192.168.10.191 |
| Guest Wi-Fi | 192.168.10.192/27 | 192.168.10.193 | 192.168.10.222 | 192.168.10.223 |
| Servers | 192.168.10.224/28 | 192.168.10.225 | 192.168.10.238 | 192.168.10.239 |
| WAN link | 192.168.10.240/30 | 192.168.10.241 | 192.168.10.242 | 192.168.10.243 |
244 of the 256 addresses are now allocated. The remaining 12 addresses, 192.168.10.244 to .255, split into two aligned free blocks: 192.168.10.244/30 and 192.168.10.248/29. They are ready for another link or a small management VLAN. Open this exact plan in the VLSM calculator.
VLSM in the cloud
Cloud providers reserve more addresses than the classic two. AWS and Azure keep five per subnet, Google Cloud four and Oracle Cloud three, and each has a smallest allowed subnet. That changes the sizing step. 12 hosts fit a /28 on premises (14 usable) but not on AWS, where a /28 has only 11 usable addresses, so you need a /27. Our cloud reserved IP guide has the details, and the VLSM calculator applies them when you pick a platform.
Common VLSM mistakes
- Allocating in the order you listed. Always sort by size first.
- Forgetting growth. A subnet sized exactly to today's hosts fills up quickly. Round up a size when the spare count is small.
- Leaving odd fragments. Free space should be kept as aligned blocks, not as a loose range, so it can be used later without renumbering.
- Overlapping summaries. If you summarise routes, keep related subnets together so they share a common prefix. The supernet calculator shows what a summary covers.
Sources
- RFC 1878: Variable Length Subnet Table For IPv4
- RFC 4632: Classless Inter-domain Routing (CIDR)
- RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links