Week 7 · Lesson 7

Variable-Length Subnet Masks (VLSM)

Fixed-length subnetting is tidy but wasteful: every subnet is forced to the size of your largest requirement. VLSM lets each network take exactly the space it needs, then packs them back-to-back so the whole block is used. This is how real designs fit dozens of networks into one assigned range.

CCNA 200-301 Domain 1.0 Network Fundamentals Verified 2026-10-11
Part 1

Why VLSM? The waste in fixed-length

Fixed-length subnetting (FLSM), covered in Lesson 6, divides a block into subnets that are all the same size. It is simple to plan and easy to document, which is why exam design questions often start there. But real networks are not all the same size. A floor with 400 users, a branch with 20 staff, and a router-to-router link with exactly two interfaces are wildly different sizes — yet a fixed-length scheme forces every one of them to take the same prefix.

Suppose you are assigned 192.168.20.0/24 and you must serve five networks of 100, 50, 20, 10, and 2 hosts. The largest requirement is 100 hosts, and the smallest prefix that fits 100 is a /25 (126 usable). Fixed-length subnetting therefore makes every network a /25. Five /25s would need 5 × 128 = 640 addresses, which does not fit inside the 256 addresses of the /24 at all. The design literally cannot be built that way.

Definition — VLSM. Variable-Length Subnet Masking (VLSM) is the practice of using a different subnet mask on different subnets of the same parent block. Each subnet is sized to its actual host requirement, and the differently sized blocks are packed back-to-back so the parent block is used efficiently.

VLSM removes the “one size fits all” constraint. Instead of a /25 everywhere, the 100-host network gets a /25, the 50-host a /26, the 20-host a /27, the 10-host a /28, and the two-host link a /30. Their sizes are 128 + 64 + 32 + 16 + 4 = 244 addresses — comfortably inside the /24, with room left over. The same address space now supports the whole design.

Two things make VLSM work. First, every larger block size is an exact multiple of every smaller one: a 64-address /26 can be tiled from 128-address /25 halves, and so on. Second, the routing protocol must be classless so that each interface can advertise its own mask. We return to that requirement in the traps section, because it is a favourite exam point.

The waste in one-size-fits-all · switch the plan

Part 2

The allocation rule: largest first

The single rule that makes VLSM reliable is this: always allocate the largest subnet first. New engineers often allocate in the order the networks appear on the requirements sheet, then discover the large subnet no longer has anywhere to sit. Here is why.

A block of a given size must start on a boundary that is a multiple of its size. A /23 (512 addresses) must begin on a multiple of 512; a /26 (64 addresses) must begin on a multiple of 64. Those are called aligned boundaries. If you first drop a small /28 into the middle of where a /23 needs to live, you have broken the large block’s alignment and it can no longer be placed. Allocating largest-first reserves the big aligned holes while they are still free, and the small subnets fill the leftover gaps afterwards.

Calculation trick. Sort your requirements descending by host count before you touch the address plan. Convert each to its smallest fitting prefix, then walk down the parent block allocating from the current free address. Because every larger block is a multiple of every smaller block, the blocks tile with no gaps and no overlap — the property that makes variable sizing safe.

A quick way to convert a host requirement to a prefix is the ladder 2, 6, 14, 30, 62, 126, 254, 510, which corresponds to /30, /29, /28, /27, /26, /25, /24, /23. Read it left to right: if a network needs 50 usable hosts, the first value at least 50 is 62, so the prefix is /26. If it needs 400, the first value at least 400 is 510, so the prefix is /23. This ladder is built from 2h − 2 for each host-bit count.

Allocation order · choose the order you work in
NetworkHostsPrefixBlockGap beforeResult

Part 3

Worked example: VLSM inside a /22

A campus is assigned 172.16.4.0/22. That block contains 210 = 1024 addresses (1022 usable). The design requirements are below. Follow the method: sort largest-first, convert to prefixes, then allocate from the start of the block.

NetworkHosts neededSmallest prefixUsable
Engineering400/23510
Sales200/24254
HR100/25126
Guest Wi-Fi50/2662
Management20/2730
WAN link A2/302
WAN link B2/302

Convert each requirement. For 400 hosts, 29 − 2 = 510 is the first count that fits, so 9 host bits remain and the prefix is 32 − 9 = /23. For 200, 28 − 2 = 254 gives a /24. The rest follow the ladder: /25, /26, /27, and /30 for each two-host router link.

Now allocate from 172.16.4.0, largest first, respecting each block’s alignment:

NetworkPrefixSubnetUsable rangeBroadcast
Engineering/23172.16.4.0/23.4.1 – .5.254172.16.5.255
Sales/24172.16.6.0/24.6.1 – .6.254172.16.6.255
HR/25172.16.7.0/25.7.1 – .7.126172.16.7.127
Guest Wi-Fi/26172.16.7.128/26.7.129 – .7.190172.16.7.191
Management/27172.16.7.192/27.7.193 – .7.222172.16.7.223
WAN link A/30172.16.7.224/30.7.225 – .7.226172.16.7.227
WAN link B/30172.16.7.228/30.7.229 – .7.230172.16.7.231
Spare—172.16.7.232/29 + .240/28.7.232 – .7.255—

Check the arithmetic: 512 + 256 + 128 + 64 + 32 + 4 + 4 = 1000 addresses used, and 1024 − 1000 = 24 left over. The first ten bits of every subnet match the parent 172.16.4.0/22, so no subnet strays outside the assigned block.

Where does that boundary fall? A /22 uses 16 bits for the first two octets, six bits of the third octet, and two bits of the fourth — so 8 + 2 = 10 host bits in total, giving 210 = 1024 addresses (1022 usable). In the third octet the parent runs 4, 5, 6, 7, which is why Engineering and Sales each start on an even third octet and the last five subnets all live inside 172.16.7.0.

VLSM planner · parent block and host requirements
#HostsPrefixSubnetUsable rangeBroadcastGap

Part 4

A second walkthrough: VLSM inside a /24

The same method works from any parent. Take 192.168.5.0/24 and four requirements: 120 hosts, 60 hosts, 30 hosts, and one router link of 2 hosts.

PurposeNeedPrefixSubnetUsableBroadcast
LAN A120/25192.168.5.0/25.1 – .126.127
LAN B60/26192.168.5.128/26.129 – .190.191
LAN C30/27192.168.5.192/27.193 – .222.223
WAN link2/30192.168.5.224/30.225 – .226.227
Spare——192.168.5.228 onwards.228 – .255—

Every boundary is aligned: 0 is a multiple of 128, 128 of 64, 192 of 32, and 224 of 4. The used space is 128 + 64 + 32 + 4 = 228 addresses, leaving 28 free. A fixed-length scheme here would have had to make every LAN a /25, which fits only two of the three LANs plus the WAN — another design that the wasteful approach cannot build.

Design check. After allocating, add your block sizes and confirm the total is less than or equal to the parent size. Each block’s network address must be a multiple of its own size. If a /25 lands on an odd multiple of 64, it is misaligned and overlaps another subnet — recalculate.
Part 5

Route summarisation and aggregation

VLSM and summarisation are two halves of the same idea. Once a whole design lives inside a parent block, a router does not need to advertise every subnet separately. Route summarisation (also called route aggregation or supernetting) advertises many contiguous subnets as a single, shorter-prefix route. That shrinks routing tables, hides internal topology changes from the rest of the network, and speeds convergence.

The method is to find the longest common prefix. Write the candidate networks in binary, count how many leading bits they all share, and that count is the summary prefix length. The summary address keeps those shared bits and zeroes everything after them.

Subnets to advertiseCommon prefixSummary route
192.168.0.0/24 + 192.168.1.0/2423 bits192.168.0.0/23
192.168.0.0/24 – 192.168.3.0/24 (four /24s)22 bits192.168.0.0/22
192.168.4.0/24 – 192.168.7.0/24 (four /24s)22 bits192.168.4.0/22

There is a shortcut worth memorising: to summarise N contiguous, aligned blocks of the same size, subtract log2(N) from the original prefix length. Four /24s become a /24 − 2 = /22. Eight /24s become a /21. Two /25s become a /24. The blocks must be contiguous and start on the correct boundary, or the arithmetic lies.

In the /22 worked example, every subnet — Engineering, Sales, HR, Guest, Management, and both WAN links — sits inside 172.16.4.0/22. A single summary route for 172.16.4.0/22 therefore represents the entire campus, and one static route or one OSPF/EIGRP advertisement can send all that traffic toward the site:

! One route covers every VLSM subnet of the campus block
R1(config)# ip route 172.16.4.0 255.255.252.0 172.16.7.1

Summarisation is the practical reason to keep a VLSM design contiguous inside its parent: if the subnets are scattered across unrelated blocks, no single summary route can cover them.

Summary route · pick a block size and a count
#BlockRange

Part 6

Design checklist and common traps

Use this checklist every time you are asked to design subnets from a required host count:

  1. List every requirement and sort it descending by host count.
  2. Convert each host count to its smallest fitting prefix using the ladder 2, 6, 14, 30, 62, 126, 254, 510.
  3. Starting at the parent network address, allocate largest-first, checking that each block begins on an aligned boundary.
  4. Write down each subnet’s network, first usable, last usable, and broadcast.
  5. Summarise the parent block so the rest of the network sees one route.
Watch out. The classic VLSM errors: allocating small subnets first (breaking a large block’s alignment); forgetting the − 2 for the network and broadcast addresses; and letting two subnets overlap. Always verify that network + size of one subnet equals the network of the next, with no shared addresses.
Exam tip. VLSM and CIDR require a classless routing protocol. Classful protocols such as RIPv1 do not carry a subnet mask in their updates, so they cannot advertise variable-length subnets or a summary route. Modern classless protocols — RIPv2, EIGRP, OSPF, and BGP — do. If a question asks why VLSM fails with a given protocol, the answer is almost always “that protocol is classful and assumes the default mask.”
ProtocolCarries the subnet mask?Can it advertise VLSM and a summary route?
RIPv1No — classfulNo
RIPv2YesYes
EIGRPYesYes
OSPFYesYes
BGPYesYes

Two more numbers are worth locking in. A /30 is the traditional point-to-point link mask: it holds 4 addresses and 2 usable hosts, one per router interface. RFC 3021 allows a /31 on a point-to-point link, giving 2 usable addresses with no network or broadcast reserved, but classic CCNA designs still show /30. And a /32 is a single host route, used for loopbacks and host-specific entries.

Part 7

Key terms

VLSM

Variable-Length Subnet Masking; using different masks on different subnets of one parent block.

FLSM

Fixed-Length Subnet Masking; dividing a block into equal-sized subnets.

Largest-first allocation

Reserving the biggest blocks before the smaller ones so each lands on an aligned boundary.

Aligned boundary

A network address that is a multiple of its block size; required for a valid subnet.

Route summarisation

Advertising many contiguous subnets as one shorter-prefix (supernet) route.

Summary route

The single route whose prefix is the longest common prefix of the subnets it represents.

Classless protocol

A routing protocol that carries a subnet mask in its updates (RIPv2, EIGRP, OSPF, BGP).

Point-to-point link

A two-router connection, traditionally a /30 (2 usable hosts) or a /31 under RFC 3021.

Part 8 · Your turn

Review

Check what you have learned with these review questions.

Review · 6 questions

Sources

Sources & references

  1. Fuller, V. & Li, T. RFC 4632: Classless Inter-Domain Routing (CIDR) (2006) (prefix aggregation and summarisation). rfc-editor.org/rfc/rfc4632.
  2. Pummill, R. & Manning, B. RFC 1878: Variable Length Subnet Table For IPv4 (1995) (the canonical VLSM host-count table). rfc-editor.org/rfc/rfc1878.
  3. Rekhter, Y. et al. RFC 3021: Using 31-Bit Prefixes on IPv4 Point-to-Point Links (2000). rfc-editor.org/rfc/rfc3021.
  4. Cisco. CCNA (200-301) Exam Topics, Network Fundamentals — IPv4 Addressing, VLSM, and route summarisation. cisco.com.

Target exams: CCNA 200-301 v1.1 · CyberOps Associate 200-201. Last content verification: 2026-10-11.