Learn how variable-length subnetting uses different prefix lengths to fit subnet sizes more closely, preserve address space, and support practical IPv4 network design.
What you will be able to do
- Explain why different subnets may need different prefix lengths.
- Describe how a subnet mask separates subnet and host portions of an IPv4 address.
- Interpret prefix length, address capacity, and assignable device addresses in a subnet.
- Choose suitable small subnet sizes for links while recognizing the limits of /30 and /31 prefixes.
01
Why variable-length subnetting matters
A subnet is a smaller network carved from a larger address block. Variable Length Subnet Masking, or VLSM, lets those smaller networks use different masks.
This matters because connected networks rarely need identical capacity. Giving every subnet the same large allocation can leave many addresses unused, while different allocations can match actual requirements more closely.
02
Prefixes describe the allocation
A classless prefix combines an address block with an explicit prefix length. The length states how many leading bits identify the network portion.
A subnet mask is a 32-bit value that marks which address bits belong to the subnet and which remain available for hosts. Prefix notation and masks describe the same boundary in different forms.
03
Borrowing host bits
Subnetting extends the original network boundary by borrowing bits from the former host portion. Those borrowed bits help distinguish multiple smaller subnetworks.
As the prefix becomes longer, fewer bits remain for hosts in each resulting subnet. This creates a relationship between the number of subnet choices and the capacity of each subnet.
04
Reading a /21 example
Consider the block 172.16.0.0/21. In this arrangement, five bits from the original host area are used for subnetting, leaving eleven host bits.
Eleven host bits produce 2048 addresses in each subnet. Of those, 2046 can be assigned to devices, with the remaining addresses serving the subnet's network and broadcast roles.
05
Finding where an address belongs
An address alone does not fully identify its subnet boundary. Pairing the address with its mask reveals which bits identify the subnet and therefore which subnet contains the address.
This pairing is also needed by routing and forwarding tables. They retain both the address prefix and its length, so a forwarding decision uses the intended boundary rather than an ambiguous address block.
06
Matching masks to network needs
VLSM allows a planner to assign a larger host capacity where many devices connect and a smaller capacity where only a few addresses are needed. Each allocation can use its own prefix length.
This differs from a uniform-mask plan. A uniform plan is simpler in one sense, but it can waste space when the subnet requirements are unequal. VLSM focuses each block on its actual need.
07
Interfaces need addresses on each network
A device or gateway attached to several networks has a distinct IP address for every connected network. Each interface participates in one network context, so one address cannot represent all of those connections.
This is useful when planning subnet allocations around gateways. The required addresses belong to the connected networks, and each network's prefix must provide enough room for its participants.
08
Small prefixes for point-to-point links
A /30 IPv4 subnet contains four addresses: one network address, one broadcast address, and two host addresses. That size can fit a link needing two device addresses.
A /31 subnet is more restrictive. It cannot serve a link that requires more than one address, so the link's address requirement must be checked before selecting that prefix.
09
The broader classless system
CIDR introduced classless allocation to improve address-space use and make routing scale better. VLSM works within this classless approach by allowing boundaries to follow requirements instead of fixed classes.
For example, 10.24.0.0/13 uses the mask 255.248.0.0. The prefix length is essential information, just as it is for the default route 0.0.0.0/0, which implementations must accept.
10
Lesson recap
VLSM assigns different masks to different subnets. This improves address-space efficiency when network requirements differ.
A prefix length and mask mark the boundary between subnet bits and host bits. An address paired with its mask identifies the subnet containing that address.
Borrowing host bits creates a longer prefix and smaller subnet capacity. In the /21 example, five bits are borrowed, leaving 2048 addresses and 2046 assignable device addresses per subnet.
Small links require careful sizing. A /30 provides two host addresses, while a /31 cannot support a link needing more than one address.
You are ready for Practice and Prove: compare subnet requirements, select matching prefix lengths, and explain how the mask supports each choice.