Subnetting · 4 min read

VLSM worked example: carving a /22 into subnets

By the Elematron team · Published

Variable Length Subnet Masking (VLSM) allows you to divide a network into subnets of different sizes, matching each subnet to its actual host requirement. This worked example walks through a real scenario: taking a /22 network and carving it into four subnets for users, voice phones, servers, and point-to-point links. You will see the exact calculations, address ranges, and how to verify your work.

The scenario and requirements

Your organization has been allocated 172.16.0.0/22. You need to design subnets for:

A /22 gives you 1024 total addresses (2^(32-22) = 2^10 = 1024). Usable hosts per subnet depend on the prefix length: subtract 2 for network and broadcast addresses. Your task is to allocate the smallest prefix length to each subnet that meets its requirement, then verify no overlaps exist.

Calculating required prefix lengths

For each subnet, find the smallest block of addresses that fits the host count. Use the formula: hosts needed <= 2^(32 - prefix) - 2.

Total subnets needed: 1 x /24 + 1 x /26 + 1 x /27 + 1 x /30 = 256 + 64 + 32 + 4 = 356 addresses. Well within your /22 allocation of 1024.

Allocating addresses in order

When using VLSM, allocate subnets in descending order of size (largest first) to avoid fragmentation and simplify summarization. Start at 172.16.0.0/22.

Subnet 1 (Users) - /24:
  Network:   172.16.0.0/24
  Broadcast: 172.16.0.255
  Usable:    172.16.0.1 - 172.16.0.254 (254 hosts)
  Next block: 172.16.1.0

Subnet 2 (Voice) - /26:
  Network:   172.16.1.0/26
  Broadcast: 172.16.1.63
  Usable:    172.16.1.1 - 172.16.1.62 (62 hosts)
  Next block: 172.16.1.64

Subnet 3 (Servers) - /27:
  Network:   172.16.1.64/27
  Broadcast: 172.16.1.95
  Usable:    172.16.1.65 - 172.16.1.94 (30 hosts)
  Next block: 172.16.1.96

Subnet 4 (WAN link) - /30:
  Network:   172.16.1.96/30
  Broadcast: 172.16.1.99
  Usable:    172.16.1.97 - 172.16.1.98 (2 hosts)
  Next block: 172.16.1.100

Verification and overlap check

Verify that all subnets fit within the parent /22 and that no addresses overlap:

All subnets fit within the /22, each subnet is sized to its requirement with minimal waste, and no addresses are reused. Your VLSM design is valid.

Applying to your network

Once your subnets are designed, configure them on your routers and switches. On a Cisco router, you would assign these to interfaces and enable routing between them. On a FortiGate, you would create address objects and firewall policies for each subnet. Always document your allocation plan and keep it updated as your network grows.

VLSM Calculator
Automate VLSM calculations and verify your subnet designs instantly.
Open →
Every Elematron tool is free for everyone — no account needed.
Browse free tools →
Free tools for this
More from the blog
F5 XC Origin Pool Health Check Failures: Diagnosis and RecoveryRead →F5 BIG-IP GTM DNS Failover Design: Multi-Site Load BalancingRead →