This tutorial explains VLSM Subnetting in detail with practical examples. Learn what VLSM (Variable Length Subnet Masks) Subnetting is and how it is done step by step including the advantages of VLSM Subnetting and the differences between FLSM Subnetting and VLSM Subnetting.
Subnetting is the process of dividing a single large network in multiple small networks known as subnets. There are two types of Subnetting; FLSM Subnetting and VLSM Subnetting.
Differences between FLSM Subnetting and VLSM Subnetting
FLSM (Fixed Length Subnet Masks) Subnetting | VLSM (Variable Length Subnet Masks) Subnetting |
All subnets are equal in size. | Subnets are variable in size. |
All subnets have equal number of hosts. | Subnets have variable number of hosts. |
All subnets use same subnet mask. | Subnets use different subnet masks. |
It is easy in configuration and administration. | It is complex in configuration and administration. |
It wastes a lot of IP addresses. | It wastes minimum IP addresses. |
It is also known as classfull Subnetting. | It is also known as classless Subnetting. |
It supports both classfull and classless routing protocols. | It supports only classless routing protocols. |
Which Subnetting should be used is depend on objectives and type of addresses used in network. FLSM provides easier Subnetting at the cost of IP addresses while VLSM best utilizes IP addresses at the cost of simplicity. For private IP addresses, FLSM is the best choice. For public IP addresses, VLSM is the best option.
This tutorial is the fifth part of the article “IP Subnetting in Computer Network Step by Step Explained with Examples”. Other parts of this article are following.
Network Address Broadcast Address and IP Address Explained
This tutorial is the first part of the article. It explains IP addressing and network addressing such as IP address, subnet mask, IP address types and IP classes in detail.
Basic Subnetting in Computer Networks Explained
This tutorial is the second part of the article. It explains what Subnetting is and why it is necessary in computer network along with the advantages of Subnetting.
Subnetting Tutorial - Subnetting Explained with Examples
This tutorial is the third part of the article. It explains the Subnetting concepts and terms such as network id, broadcast id, total hosts, valid hosts, power of 2, block size and CIDR in detail.
Subnetting Tricks Subnetting Made Easy with Examples
This tutorial is the fourth part of the article. It explains how to solve or answer any Subnetting related question in less than a minute with 50+ Subnetting examples.
VLSM Subnetting Examples and Calculation Explained
This tutorial is the sixth part of the article. It explains VLSM Subnetting examples for Cisco exams and interviews.
Supernetting Tutorial: - Supernetting Explained with Examples
This tutorial is the last part of the article. It explains Supernetting in detail with examples.
Since I have already explained FLSM Subnetting with examples in previous parts of this tutorial, instead of repeating it again, in this part I will focus on VLSM Subnetting.
If you don’t know what FLSM is and how it is done, I highly recommend you take a pause here and learn FLSM Subnetting from the previous parts of this tutorial. For this part I assume that you have sound knowledge of FLSM Subnetting.
VLSM Subnetting
The biggest advantage of VLSM Subnetting is that, instead of forcing us to use a fixed size for all segments, it allows us to choose the individual size for each segment. This flexibility reduces the IP wastage. We can choose the size of subnet which closely matches with our requirement. Let’s understand it with an example.
VLSM Example
Do the VLSM Subnetting of following network.
In this network: -
- Development department has 74 computers.
- Production department has 52 computers.
- Administration department has 28 computers.
- All departments are connected with each other via wan links.
- Each wan link requires two IP addresses.
- The given address space is 192.168.1.0/24.
Before we perform VLSM Subnetting for this network, let’s understand how VLSM Subnetting actually works.
Basic concepts of VLSM Subnetting
VLSM Subnetting is the extended version of FLSM Subnetting. If you know how FLSM Subnetting works and how it is done, you already know the 90% of VLSM Subnetting. In FLSM, all subnets use same block size, thus Subnetting is required only one time. In VLSM, subnets use block size based on requirement, thus Subnetting is required multiple times.
The concept of VLSM Subnetting is relatively simple.
- Select block size for each segment. Block size must be greater than or equal to the actual requirement. Actual requirement is the sum of host addresses, network address and broadcast address.
- Based on block size arrange all segments in descending order.
- Do FLSM Subnetting for the block size of the first segment.
- Assign first subnet from subnetted subnets to the first segment.
- If next segment has similar block size, assign next subnet to it.
- If next segment has lower block size, do FLSM Subnetting again for the block size of this segment.
- From subnetted subnets exclude the occupied subnets. Occupied subnets are the subnets which provide the addresses which are already assigned.
- From available subnets, assign the first available subnet to this segment.
- Repeat above steps till the last segment of the network.
Let’s implement above steps in our example network.
Step by step VLSM Subnetting
The first step of VLSM Subnetting is selecting the appropriate block size for each segment. Following table lists all available block sizes.
2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 |
512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768 | 65536 |
131072 | 262144 | 524288 | 1048576 | 2097152 | 4194304 | 8388608 | 16777216 |
To learn how block size is calculated, please see the third part of this tutorial.
While selecting appropriate block size for a given segment, always select a size which is adequate for host addresses plus two additional addresses; network address and broadcast address.
Identity of a subnet and certain networking services depend on network address and broadcast address. In each subnet, the first address and the last address are always reserved for network address and broadcast address respectively.
Regardless the information about these two addresses is provided or not in question; always add these addresses in requirement while selecting the block size for a segment.
Actual requirement = Host requirement + Network address + broadcast address Block Size >= Actual requirement
Following table shows the selection of block size in our example.
Segment | Host requirement | Actual requirement | Block size |
Production | 52 | 54 | 64 |
Wan link 1 | 2 | 4 | 4 |
Development | 74 | 76 | 128 |
Wan link 2 | 2 | 4 | 4 |
Administration | 28 | 30 | 32 |
Wan link 3 | 2 | 4 | 4 |
The next step of VLSM Subnetting is arranging segments in descending order. Based on block size, following table arranges all segments in descending order.
Segment | Block size | Descending order |
Development | 128 | 1 |
Production | 64 | 2 |
Administration | 32 | 3 |
Wan link 1 | 4 | 4 |
Wan link 2 | 4 | 5 |
Wan link 3 | 4 | 6 |
The next step of VLSM Subnetting is doing FLSM Subnetting and selecting appropriate subnets for segments from the subnetted subnets.
A single FLSM Subnetting provides a single block size for all of its subnets. If different block size is required, we have to perform the FLSM Subnetting again for that block size. How many times we have to perform the FLSM Subnetting is depend on how many unique block sizes we need. For instance, our example network requires four unique block sizes 128, 64, 32 and 4. For four block sizes, we have to perform FLSM Subnetting four times.
FLSM Subnetting is always performed in descending order. For ordering, block size is used. In our example, first we have to perform FLSM Subnetting for block size 128 then for block size 64 then for block size 32 and finally for block size 4.
Following figure shows the FLSM Subnetting for all four block sizes and selected subnets for segments from each FLSM Subnetting.
Let’s understand above process in more detail.
First largest segment (Block size 128)
Our first segment needs a block size of 128. The FLSM Subnetting of /25 provides us two subnets with the block size 128.
FLSM Subnetting of 192.168.1.0/25
Subnet | Subnet1 | Subnet2 |
Network ID | 192.168.1.0 | 192.168.1.128 |
First host address | 192.168.1.1 | 192.168.1.129 |
Last host address | 192.168.1.126 | 192.168.1.254 |
Broadcast ID | 192.168.1.127 | 192.168.1.255 |
From Subnetted subnets assign first subnet to this segment.
Segment | Development |
Requirement | 74 |
CIDR | /25 |
Subnet mask | 255.255.255.128 |
Network ID | 192.168.1.0 |
First hosts | 192.168.1.1 |
Last hosts | 192.168.1.126 |
Broadcast ID | 192.168.1.127 |
Since our second segment (Production) needs different block size (64), instead of using second subnet (Subnet2) for it, let’s do Subnetting again.
Second largest segment (Block size 64)
The Subnetting of /26 provide us 4 subnets with block size 64.
Subnetting of 192.168.1.0/26
Subnet | Subnet 1 | Subnet 2 | Subnet 3 | Subnet 4 |
Network ID | 0 | 64 | 128 | 192 |
First address | 1 | 65 | 129 | 193 |
Last address | 62 | 126 | 190 | 254 |
Broadcast ID | 63 | 127 | 191 | 255 |
From this Subnetting, we cannot use subnet 1 and subnet 2 as they are already occupied.
Subnet 1 and Subnet 2 provide addresses from 0 to 127 which are already assigned in the development department.
We can use subnet 3 for this segment (production).
Segment | Production |
Requirement | 52 |
CIDR | /26 |
Subnet mask | 255.255.255.192 |
Network ID | 192.168.1.128 |
First hosts | 192.168.1.129 |
Last hosts | 192.168.1.190 |
Broadcast ID | 192.168.1.191 |
Third largest segment (block size 32)
The Subnetting of /27 provides us 8 network and 32 hosts.
Subnetting of 192.168.1.0/27
Subnet | Sub 1 | Sub 2 | Sub 3 | Sub 4 | Sub 5 | Sub 6 | Sub 7 | Sub 8 |
Net ID | 0 | 32 | 64 | 96 | 128 | 160 | 192 | 224 |
First Host | 1 | 33 | 65 | 95 | 129 | 161 | 193 | 225 |
Last Host | 30 | 62 | 94 | 126 | 158 | 190 | 222 | 254 |
Broadcast ID | 31 | 63 | 95 | 127 | 159 | 191 | 223 | 255 |
Exclude the already occupied subnets (Sub1 to Sub6) and assign the first available subnet (Sub7) to this segment.
Segment | Administration |
Requirement | 28 |
CIDR | /27 |
Subnet mask | 255.255.255.224 |
Network ID | 192.168.1.192 |
First hosts | 192.168.1.193 |
Last hosts | 192.168.1.222 |
Broadcast ID | 192.168.1.223 |
WAN Links (Block Size 4)
Last three segments require the block size of 4. The Subnetting of /30 gives us 64 subnets of block size 4.
Subnets of /30 Subnetting:-
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196, 200, 204, 208, 212, 216, 220, 224, 228, 232, 236, 240, 244, 248, 252, 256
Exclude already occupied subnets (0-56) and use first three available subnets 57, 58 and 59 for WAN links.
Subnet | Subnet 57 | Subnet 58 | Subnet 59 |
Network ID | 224 | 228 | 232 |
First host | 225 | 229 | 233 |
Last host | 226 | 230 | 234 |
Broadcast ID | 227 | 231 | 235 |
Assign subnet 57 to the WAN link 1.
Subnet | Subnet 57 |
Segments | Wan Link 1 |
Requirement | 2 |
CIDR | /30 |
Subnet mask | 255.255.255.252 |
Network ID | 192.168.1.224 |
First hosts | 192.168.1.225 |
Last hosts | 192.168.1.226 |
Broadcast ID | 192.168.1.227 |
Assign subnet 58 to the WAN link 2.
Subnet | Subnet 58 |
Segments | Wan Link 2 |
Requirement | 2 |
CIDR | /30 |
Subnet mask | 255.255.255.252 |
Network ID | 192.168.1.228 |
First hosts | 192.168.1.229 |
Last hosts | 192.168.1.230 |
Broadcast ID | 192.168.1.231 |
Assign subnet 59 to the WAN link 3.
Subnet | Subnet 59 |
Segments | Wan Link 3 |
Requirement | 2 |
CIDR | /30 |
Subnet mask | 255.255.255.252 |
Network ID | 192.168.1.232 |
First hosts | 192.168.1.233 |
Last hosts | 192.168.1.234 |
Broadcast ID | 192.168.1.235 |
We have assigned IP addresses to all segments. The subnets 60, 61, 62, 63 and 64 are still available for further use.
Following figure shows a summarize allocation of all addresses in given network.
That’s all for this part. In next part, I will explain few more VLSM examples in detail. If you have any feedback or suggestion about this tutorial, mail me. If you like this tutorial, please share it with friends through your favorite social platform.