Variable length subnet mask (VLSM) is a method that allows network administrators to divide an IP address space into subnets of different sizes, unlike simple same-size Subnetting. Variable Length Subnet Mask (VLSM) means subnetting a subnet. To simplify further, VLSM is the breaking down of IP addresses space into multiple level subnets and allocating it according to the individual need on a network.
As illustrated in Figure 1, 2 and 3 the traditional subnetting creates subnets of equal size. Each subnet in a traditional plan uses the same subnet mask.But Variable Length Subnet Masking allows a network space to be divided into different sizes. With VLSM, the subnet mask will vary on how many bits have been borrowed for a particular subnet.
The difference between VLSM and FLSM is that subnetting is not a single practice. With VLSM, the network is initially subnetted, and then the subnets are subnetted again and again to create subnets of various sizes.
In the process of using VLSM, always start by satisfying the host requirements of the largest subnet and continue subnetting until the host requirements of the smallest subnet are fulfilled.
Fixed length Subnet Mask (FLSM)
FLSM is a Traditional Subnetting method which causes wastes of IP Addresses. Using this method, the same number of addresses is allocated for each sub-network. If all the sub-network have the same requirements for hosts. These fixed size address blocks would be efficient. But, usually, that is not the case.
The topology shown in Figure 1 above requires 5 subnets, one for each of the four LANs, and one for WAN connection between routers. Using traditional subnetting with the address of 184.108.40.206/23, 1 bit can be borrowed from the third octet and 2 bits can be borrowed from the last octet of the host portion to meet the subnet requirement of 5 subnets. As shown in Figure 2, borrowing 3 bits creates 8 subnets and leaves 6 host bits with 62 usable hosts per subnet. This plan creates the desired subnets and meets the host necessity of the largest LAN.
Though this traditional subnetting meets the requirements of the largest LAN and divides the address space into enough number of subnets, So it results in the major waste of unused addresses.
For example, only two addresses are required for WAN subnet, But each subnet has 62 usable addresses, there are 60 unused addresses available in this subnets. This also limits the growth of network by reducing the total number of subnets available. This incompetent use of addresses is the feature of traditional subnetting. Traditional subnetting scheme to this scenario is not very professional and is full of waste. To avoid a waste of IP address subnetting a subnet, or using Variable Length Subnet Mask (VLSM), was designed. Figure 3 Show the pie chart for the above table of fixed length subnet masking.
The Chart in Figure 3 illustrates the traditional subnetting which divided the address space into equal sub-networks.
Go back to the example in Figure 1 and Figure 2 the network 220.127.116.11/23 was subnetted into eight subnets of equal size. Five subnets were allocated and three subnets were spare for future expansion. Four subsets were used for the LANs and one subnet for the WAN connections between the two routers. The wasted address space was in the all subnets but especially in the subnet used for the WAN connections; where only two addresses used out of sixty-two; one for each router interface. To avoid this waste, VLSM can be used to create smaller subnets according to hosts requirement. To create smaller subnets according to host requirement, the subnets will be subnetting again and again. In this example, the last subnet, 18.104.22.168, will be further subnets according to the host requirements of LAN-4 and for the WAN segment between both routers.
Remember that when the number of needed host addresses is known, the formula 2h-2 (where h equals the number of host bits remaining) can be used. The LAN-4 required 20 hosts and for 20 hosts 5 bits are required in the host portion. So there are 6 host bits in the subnetted 22.214.171.124/26 address space, 1 more bits can be borrowed; leaving 5 bits in the host portion, as shown in Figure 4. The subnetting at this point is exactly the same as those used for traditional subnetting. The bit is borrowed, and the resulting subnet ranges are determined. With borrowing 1-bit form 126.96.36.199/26 resulting two subnets 188.8.131.52/27 and 184.108.40.206/27.
The subnet 220.127.116.11/27 is assigned to LAN4. Now we required a subnet for the WAN segment between both routers. The WAN segment required two IP address. If we apply the formula of host 22-2=2, So we required 2 bits in the host portion; as shown in Figure 5 the subnet 18.104.22.168 is subnetted according to the requirement of the WAN segment.
The subnet 22.214.171.124 is subnetted into 8 more subnets each consisting of 2 usable host address; the first subset of these are assigned to WAN segment. This subnetting scheme reduces the number of addresses per subnet to a size appropriate for the WANs. Subnetting subnet 7 for LAN-4 and WANs. Subnetting with VLSM allows subnets 3, 4, 5, 6 to be available for future networks; as well as 7 additional subnets available for WANs segments. The chart in Figure 6 illustrates the subnetting with VLSM.