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

  1. Sort requirements from largest to smallest
  2. Allocate the largest subnet first from the start of your address space
  3. Allocate the next largest from where the previous ended
  4. Repeat until all subnets are allocated
  5. 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)

  1. LAN A: 100 hosts
  2. LAN B: 50 hosts
  3. LAN C: 25 hosts
  4. 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

SubnetCIDRNetworkHost RangeBroadcast
LAN A/25192.168.1.0.1 - .126.127
LAN B/26192.168.1.128.129 - .190.191
LAN C/27192.168.1.192.193 - .222.223
WAN/30192.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:

.0
LAN A (/25) - 128 addresses
.127
.128
LAN B (/26) - 64 addresses
.191
.192
LAN C (/27) - 32 addresses
.223
.224
WAN
Available (.228-.255)
.255

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)
SubnetCIDRNetworkBroadcast
HQ/2010.10.0.010.10.15.255
Branch 1/2310.10.16.010.10.17.255
Branch 2/2410.10.18.010.10.18.255
Data Center/2510.10.19.010.10.19.127
Management/2710.10.19.12810.10.19.159
WAN 1/3010.10.19.16010.10.19.163
WAN 2/3010.10.19.16410.10.19.167
WAN 3/3010.10.19.16810.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