IPv4

VLSM Explained — Variable Length Subnet Masking with Examples

G Gurpreet Singh August 28, 2026 5 min read
A slash 24 address bar divided into differently sized colour-coded subnets from a slash 26 down to three slash 30 WAN links, beside a comparison showing why allocating smallest first produces an invalid boundary

VLSM (Variable Length Subnet Masking) means using different subnet mask lengths within the same network, so each segment gets only as many addresses as it actually needs.

Without VLSM every subnet must be the same size, sized for the largest segment. If your biggest LAN needs 50 hosts you would use /26 everywhere — including on point-to-point WAN links that need exactly 2 addresses. Each of those links would then waste 60 addresses.

The Waste, Quantified

Take 192.168.10.0/24 serving four LANs (50, 25, 12 and 5 hosts) plus three WAN links of 2 hosts each.

Fixed-length (/26 everywhere)VLSM
Subnets available4As many as needed
Segments to serve77
ResultFails — runs out after 4Fits with room spare
Addresses wasted on WAN links1800

Fixed-length subnetting cannot even complete this design. That is the practical case for VLSM.

The Rule: Always Allocate Largest First

This is the whole method, and getting it wrong is why people produce overlapping subnets.

  1. List every segment with its host requirement. Include WAN links — each needs 2.
  2. Sort descending by hosts needed.
  3. Assign the largest first, starting at the beginning of your address space.
  4. Each next subnet starts where the previous one’s broadcast ended, plus 1.
  5. Verify no overlap before you configure anything.

Why largest first? A large block must start on a boundary that is a multiple of its own size. If you place small subnets first, you fragment the space and the large block no longer has a valid aligned position — even when the raw address count would fit.

Worked Example 1 — 192.168.10.0/24

Requirements:

SegmentHosts neededPrefix requiredGives
Sales50/2662
Engineering25/2730
Support12/2814
Management5/296
WAN link 12/302
WAN link 22/302
WAN link 32/302

Already sorted largest to smallest. Now allocate:

SegmentNetworkMaskUsable rangeBroadcast
Sales192.168.10.0/26255.255.255.192.1 – .62.63
Engineering192.168.10.64/27255.255.255.224.65 – .94.95
Support192.168.10.96/28255.255.255.240.97 – .110.111
Management192.168.10.112/29255.255.255.248.113 – .118.119
WAN link 1192.168.10.120/30255.255.255.252.121 – .122.123
WAN link 2192.168.10.124/30255.255.255.252.125 – .126.127
WAN link 3192.168.10.128/30255.255.255.252.129 – .130.131

Seven segments placed, and 192.168.10.132 through .255 — 124 addresses — remains free for growth. Fixed-length subnetting could not have fitted this at all.

Following the arithmetic

Sales /26:       block 64  ->  0 to 63,   next free = 64
Engineering /27: block 32  ->  64 to 95,  next free = 96
Support /28:     block 16  ->  96 to 111, next free = 112
Management /29:  block 8   ->  112 to 119, next free = 120
WAN 1 /30:       block 4   ->  120 to 123, next free = 124
WAN 2 /30:       block 4   ->  124 to 127, next free = 128
WAN 3 /30:       block 4   ->  128 to 131, next free = 132

Each subnet begins exactly where the previous broadcast ended, plus 1 — and each start address is a multiple of its own block size. That second property is what makes the allocation valid.

Worked Example 2 — 172.16.0.0/16 for a Multi-Site Network

SiteHostsPrefixNetworkRange
HQ4,000/20172.16.0.0/20172.16.0.1 – 172.16.15.254
Branch A900/22172.16.16.0/22172.16.16.1 – 172.16.19.254
Branch B400/23172.16.20.0/23172.16.20.1 – 172.16.21.254
Branch C200/24172.16.22.0/24172.16.22.1 – 172.16.22.254
DMZ60/26172.16.23.0/26172.16.23.1 – 172.16.23.62
WAN links ×42 each/30172.16.23.64/30 …172.16.23.65 – .78

The whole design consumes just over 23 of the 256 available /24s, leaving 172.16.24.0 onward for expansion.

The Overlap Trap

This is the mistake that causes real outages. Suppose you allocate small first:

WAN link:    192.168.10.0/30    -> 0 to 3
Management:  192.168.10.4/29    -> 4 to 11
Support:     192.168.10.12/28   -> INVALID

A /28 has block size 16, so it must start on a multiple of 16 — .0, .16, .32 and so on. It cannot start at .12. You would have to skip forward to .16, wasting .12–.15, and every subsequent allocation inherits the fragmentation.

Allocating largest first makes each boundary fall naturally, because every block size is a multiple of the ones that come after it.

How overlap manifests

If you do configure overlapping subnets — say 192.168.10.0/25 and 192.168.10.64/26 — routers apply longest prefix match, so the /26 silently wins for addresses in its range. Some hosts become unreachable, others work, and the routing table looks correct at a glance. It is a genuinely unpleasant fault to trace.

VLSM and Routing Protocols

VLSM only works if your routing protocol carries the subnet mask in its updates — that is, if it is classless.

ProtocolClassless?Supports VLSM
RIPv1NoNo
IGRPNoNo
RIPv2YesYes
EIGRPYesYes
OSPFYesYes
IS-ISYesYes
BGPYesYes

Everything in current use is classless, so this is mainly an exam point. One live gotcha remains: auto-summary. If EIGRP or RIPv2 has auto-summary enabled, it summarises to classful boundaries at major network borders and breaks discontiguous VLSM designs.

Router(config-router)# no auto-summary

VLSM vs CIDR vs Supernetting

VLSMCIDR / Supernetting
DirectionDivides a network into smaller piecesCombines networks into a larger block
Prefix movesLonger (/24 → /26, /30)Shorter (four /24s → one /22)
PurposeEfficient address use inside your networkSmaller routing tables between networks
Where usedEnterprise LAN designInternet routing, route summarisation

They are complementary: VLSM to allocate efficiently downward, summarisation to advertise efficiently upward. A well-designed network does both — which is only possible if addresses are assigned contiguously per site.

Checklist Before You Configure

  1. Every segment listed, including WAN links and future growth
  2. Sorted largest to smallest
  3. Each subnet starts on a multiple of its own block size
  4. No two ranges overlap
  5. Room left at the end for expansion
  6. Classless routing protocol, with no auto-summary
  7. Addressing contiguous per site, so it can be summarised later

Check your allocations with the subnet calculator, and if the block-size arithmetic is not yet automatic, work through subnetting explained and the practice questions first.

Frequently Asked Questions

What is VLSM in simple terms?

Using different subnet mask lengths inside one network so each segment gets only the addresses it needs — a /30 for a WAN link, a /26 for a 50-host LAN — instead of forcing every subnet to the same size.

Why must you allocate the largest subnet first?

Because a subnet must start on an address that is a multiple of its block size. Placing small subnets first fragments the space so the large block no longer has a valid aligned starting point, even when enough raw addresses remain.

What is the difference between VLSM and subnetting?

Subnetting divides a network into equal-sized pieces. VLSM is subnetting a subnet — applying the process repeatedly with different mask lengths, so the pieces can differ in size.

Does VLSM work with RIPv1?

No. RIPv1 and IGRP are classful and do not carry the subnet mask in their updates, so they cannot support VLSM. RIPv2, EIGRP, OSPF, IS-IS and BGP all can.

What is the difference between VLSM and CIDR?

VLSM divides a network into progressively smaller subnets. CIDR (supernetting) combines networks into a larger block with a shorter prefix, to reduce routing table size. Opposite directions, complementary purposes.

How do I check my VLSM plan for overlaps?

List every subnet with its network and broadcast address, sort by network address, and confirm each network address is greater than the previous broadcast. Any subnet not starting on a multiple of its block size is invalid.

GU
Written by

Gurpreet Singh

Hey! I"m Gurpreet Singh and I Have 7+ Years of experience in the Network & Security Domain as well as the Cloud Infra Domain. I am Certified with Cisco ( CCNA ), CheckPoint ( CCSA ), 1xAWS, 3xAZURE, and 3xNSE. So I love to share my tech knowledge with you.

Leave a Reply

Your email address will not be published. Required fields are marked *