Definition

Variable Length Subnet Mask (VLSM)

What is a Variable Length Subnet Mask (VLSM)?

Variable Length Subnet Mask (VLSM) is a subnet -- a segmented piece of a larger network -- design strategy where all subnet masks can have varying sizes. This process of "subnetting subnets" enables network engineers to use multiple masks for different subnets of a single class A, B or C network.

With VLSM, an IP address space can be divided into a well-defined hierarchy of subnets with different sizes. This helps enhance the usability of subnets because subnets can include masks of varying sizes.

A subnet mask helps define the size of the subnet and create subnets with very different host counts without wasting large numbers of addresses.

VLSM fundamentals

To fully understand VLSM, it's important to be familiar with several fundamental terms: subnet mask, subnetting and supernetting.

Subnet mask

Every device on a network has an IP address. A subnet mask splits this IP address into the host and network addresses. This helps define which part of the IP address belongs to the network, and which part belongs to the device.

The subnet mask is a 32-bit number, where all the host bits are set to 0, and the network bits are set to 1. So, the subnet mask consists of a sequence of 1s followed by a block of 0s, where the 1s represent the network prefix and the 0s mark the host identifier.

Subnetting

In subnetting (or subnetworking), a large network is logically or physically divided into multiple small networks or "subnets." The reason for subnetting a large network is to address network congestion and its negative impact on speed and productivity.

Subnetting also improves efficiency due to the way an address space is utilized in a small network. Finally, the divisions between subnets allow organizations to enforce access controls, which improves network security, and helps contain security incidents.

Supernetting

In supernetting, multiple contiguous networks are combined into a single large network known as a supernet (or supernetwork). Supernetting advertises many routes in one summarized advertisement or routing entry, instead of individually. This routing entry encompasses all the networks in the supernet, and provides route updates very efficiently.

Supernetting is especially useful in route aggregation to reduce the size of routing tables, and to reduce the size of routing updates exchanged by routing protocols.

FLSM subnetting vs. VLSM subnetting

For subnetting an IP address for a network, one of two approaches can be used: VLSM or Fixed Length Subnet Mask (FLSM). These methods differ in three key ways:

  • FLSM creates subnets of the same size and an equal number of host identifiers, while VLSM creates subnets with varying sizes with a variable number of hosts.
  • FLSM is a better choice for private IP addresses, while VLSM is more suitable for public IP addresses.
  • FLSM tends to use more IP addresses than are necessary, which leads to wastage. In VLSM, wastage is minimum because it uses a given IP address range more efficiently.

Implementing a VLSM subnet

In VLSM, each subnet chooses the block size based on its requirement. So, if requirements change, subnetting will be required multiple times.

In an organization with multiple departments, different departments may require a different number of IP addresses and subnets (some more and some less). To subnet the subnets in a way that minimizes IP address wastage, VLSM is preferable to FLSM.

Suppose the available IP address block is 192.168.1.0/24, and the requirement is to create four subnets for four departments:

Subnet A: 120 hosts

Subnet B: 50 hosts

Subnet C: 26 hosts

Subnet D: 2 hosts

Here are the steps to allocate the IPs for departments using VLSM:

  1. Select the block size for each segment. This must be greater than or at least equal to the sum of the host addresses, broadcast addresses and network addresses.
  2. List all possible subnets:
subnets
Step 2: List all possible subnets
  1. Keeping the block size in mind, arrange all the segments in descending order, i.e., list the highest first, then the second highest, and so on, all the way down to the subnet with the lowest requirement. For this example, the order would be:
       i. Subnet A: 120 hosts
       ii. Subnet B: 50 hosts
       iii. Subnet C: 26 hosts
       iv. Subnet D: 2 hosts
  2. Assign the appropriate subnet mask to each subnet. Identify the highest IP available and allocate it to the highest requirement. So, here, 192.168.1.0/25 has 126 valid IP addresses that can be assigned to the 120 hosts required by Subnet A.
  3. For the next segment, an IP is required that can handle 50 hosts. The IP subnet mask /26 is the next highest in the list. It can accommodate 64 hosts, so it should be assigned to the 50-host requirement of Subnet B.
  4. Similarly, the requirements of Subnet C can be fulfilled by the next IP subnet /27 because it has 32 valid host IPs that can accommodate the 26 hosts required by this subnet.
  5. Finally, for the two IP addresses required by Subnet D, the subnet /29 can be selected. Because the block size of the subnet mask must be greater than or equal to the sum of the host addresses, broadcast addresses and network addresses, the subnet mask /30 with only two hosts should not be selected.
subnets
Variable Length Subnet Mask (VLSM) is similar to Classless Inter-Domain Routing (CIDR) (see example illustrated above)

Using VLSM

To use VLSM, a network administrator must use a routing protocol that supports it, such as:

  • Routing Information Protocol v2 (RIPv2)
  • Open Shortest Path First (OSPF)
  • Intermediate System-to-Intermediate System (IS-IS)
  • Border Gateway Protocol (BGP)
  • Enhanced Interior Gateway Routing Protocol (EIGRP)

Classful routing protocols like RIPv1 and IGRP do not support VLSM, so before configuring the router for VLSM, network engineers must check whether the protocol supports VLSM

VLSM is similar in concept and intent to Classless Inter-Domain Routing (CIDR), which allows a single internet domain to have an address space that does not fit into traditional address classes. VLSM was originally defined in IETF RFC 1812.

Subnet segmentation illustrated
Example of subnet segmentation
This was last updated in October 2021

Continue Reading About Variable Length Subnet Mask (VLSM)

Dig Deeper on Network infrastructure

Unified Communications
Mobile Computing
Data Center
ITChannel
Close