How To

VLSM Subnetting Explained: How to Subnet by Host Requirements

Carving a network into equal-size subnets wastes addresses. A point-to-point link with two routers does not need the same block you hand a 60-user LAN, yet fixed-length subnetting gives every segment the same mask. VLSM, variable-length subnet masking, fixes that: you size each subnet to the hosts it actually needs and pack them into one network with no gaps.

Original content from computingforgeeks.com - post 168971

This guide shows how to subnet by host requirements, then works a full VLSM design end to end: choosing each mask, allocating in the right order, checking for overlap, adding a subnet later, and confirming the result in a Cisco routing table. It assumes you can already subnet by network requirements; VLSM is the next step on the CCNA 200-301 path. Every subnet below was allocated and overlap-checked by hand in June 2026.

Subnet by host requirements

When the requirement is “this segment needs N hosts,” pick the smallest mask where 2 to the power of the host bits, minus 2, is at least N. The minus 2 removes the network and broadcast addresses. Borrow the fewest host bits that still satisfy the requirement, which leaves the most space for everything else.

Hosts neededHost bitsUsable (2^H minus 2)Mask (from a /24)
222/30
up to 636/29
up to 14414/28
up to 30530/27
up to 62662/26
up to 1267126/25

What VLSM is, and what it is not

VLSM means using more than one subnet mask within the same classful network. Splitting 192.168.10.0/24 into a /25, two /26s, and a /30 is VLSM. Using different masks on different networks is just ordinary classless addressing, not VLSM. There is no IOS command that turns VLSM on; it happens automatically when you assign different masks to interfaces inside one network.

The catch the exam tests is routing-protocol support. A protocol can only carry VLSM if it advertises the mask with every route. Classful RIPv1 does not, so it cannot.

Routing protocolSupports VLSM?Why
RIPv1NoClassful: does not send the mask, auto-summarizes at classful boundaries
RIPv2YesSends the mask with each route
OSPFv2YesClassless: mask carried per route
EIGRPYesClassless: mask carried per route

Allocate the largest subnet first

The one rule that prevents most VLSM mistakes: allocate the subnet with the most hosts first, then the next largest, down to the /30 links last. A large subnet needs a large contiguous block aligned to its mask boundary. If you hand out small subnets first, you can chop up the address space so no aligned block is left for the big one. Place the biggest rooms first; the closets fit in the space that remains.

A VLSM design worked end to end

Take 10.0.0.0/24 and four segments: LAN-A needs 100 hosts, LAN-B needs 60, LAN-C needs 20, and a WAN link needs 2. Sort them largest to smallest, choose each mask from the host-requirement rule, then allocate from 10.0.0.0 upward, each subnet starting right after the previous one’s broadcast.

LAN-A (100 hosts) takes a /25, which starts at 10.0.0.0 and ends at 10.0.0.127. LAN-B (60) takes a /26 starting at the next free address, 10.0.0.128. LAN-C (20) takes a /27 at 10.0.0.192. The WAN link (2) takes a /30 at 10.0.0.224. Here is the full allocation:

SegmentHostsMaskSubnet IDUsable rangeBroadcast
LAN-A100/2510.0.0.010.0.0.1 to 10.0.0.12610.0.0.127
LAN-B60/2610.0.0.12810.0.0.129 to 10.0.0.19010.0.0.191
LAN-C20/2710.0.0.19210.0.0.193 to 10.0.0.22210.0.0.223
WAN2/3010.0.0.22410.0.0.225 to 10.0.0.22610.0.0.227

Four segments fit inside a single /24 with room to spare, and not one address is wasted on the WAN link. Fixed-length subnetting would have forced every segment onto a /25 and run out of space after two.

Check for overlapping subnets

Two subnets overlap when one’s address range falls inside another’s. The check is three steps: compute each subnet ID, compute its broadcast (subnet ID plus 2 to the power of the host bits, minus 1), then confirm the next subnet’s ID is greater than the previous broadcast. In the design above, each broadcast (.127, .191, .223, .227) is lower than the next subnet ID (.128, .192, .224), so nothing overlaps.

The classic mistake: sizing LAN-C as 10.0.0.96/27 instead of 10.0.0.192/27. That /27 spans 10.0.0.96 to 10.0.0.127, which sits inside LAN-A’s 10.0.0.0/25 range (10.0.0.0 to 10.0.0.127). The two overlap, and IOS rejects the second address with an “overlaps with” error. Always check the new subnet’s range against every subnet already assigned.

Add a subnet to an existing design

Requirements change, and VLSM is built for it. Suppose LAN-D appears later and needs 10 hosts. Ten hosts needs 14 usable, which is a /28. Find the lowest /28 that does not overlap anything already used. The /28 blocks fall on multiples of 16: 10.0.0.192 and 10.0.0.208 sit inside LAN-C’s /27 (10.0.0.192 to 10.0.0.223), and 10.0.0.224 holds the WAN /30. The first /28 that is fully free is therefore 10.0.0.240.

SegmentHostsMaskSubnet IDUsable rangeBroadcast
LAN-D10/2810.0.0.24010.0.0.241 to 10.0.0.25410.0.0.255

LAN-D slots into the gap between the WAN link and the end of the /24 without disturbing any existing subnet. That is the whole point of planning largest-first: the leftover space stays usable.

Confirm VLSM in the routing table

Once the five subnets are live on a router, show ip route groups them under their classful parent and prints a header line that proves VLSM is active:

10.0.0.0/8 is variably subnetted, 5 subnets, 5 masks

Read it literally: five subnets of the 10.0.0.0 network are installed, and they use five different mask lengths (/25, /26, /27, /28, and /30). The counts track whatever is actually configured, so before LAN-D was added the same line would read “4 subnets, 4 masks”. The phrase “variably subnetted” is the routing table confirming VLSM is in use. If a network is ever summarized back to /8, a classful protocol such as RIPv1 is the usual cause.

Practice VLSM

VLSM is a calculation skill, so drill it. Use the trainer for the underlying network and broadcast math, then the quiz for the VLSM-specific decisions: mask choice by host count, allocation order, overlap, and protocol support.

Loading subnetting trainer...

The questions below check the VLSM judgement calls, each with a worked explanation.

Loading quiz...

VLSM quick-reference card

Keep this beside you while you practice. It is the whole method in six lines.

RuleWhat it does
2^H minus 2 is at least NPick the mask: H host bits for N hosts
Allocate largest firstBiggest subnet, then down to the /30 links
Start after the last broadcastNext subnet ID is the previous broadcast plus 1
Overlap checkNext subnet ID must be above the previous broadcast
Protocol supportRIPv2, OSPFv2, EIGRP yes; RIPv1 no
“variably subnetted” in show ip routeConfirms VLSM is active

With VLSM in hand, addressing stops being a source of wasted space and overlap errors, and you are ready for the routing topics that assume a clean, efficient address plan. For every mask, host count, and wildcard on one page, keep the subnetting cheat sheet within reach.

Keep reading

Configure Samba File Share on Debian 13 / 12 Debian Configure Samba File Share on Debian 13 / 12 Setup WireGuard VPN on Ubuntu 24.04 / Debian 13 / Rocky Linux 10 Debian Setup WireGuard VPN on Ubuntu 24.04 / Debian 13 / Rocky Linux 10 Use NetworkManager nmcli on Ubuntu and Debian Debian Use NetworkManager nmcli on Ubuntu and Debian Subnetting Cheat Sheet: IPv4 Masks, Hosts, and VLSM Networking Subnetting Cheat Sheet: IPv4 Masks, Hosts, and VLSM How to Subnet: A Step-by-Step Guide to Subnetting by Network Requirements Networking How to Subnet: A Step-by-Step Guide to Subnetting by Network Requirements How To Ping IP or Host with Graph using gping Networking How To Ping IP or Host with Graph using gping

Leave a Comment

Press ESC to close