VLSM subnetting allows us to create subnets based on our requirements and network size. It allows us to create subnets with different subnet masks.
There are two types of subnetting: FLSM and VLSM. FLSM is easy but produces subnets having the same number of IP addresses. The same-sized subnets do not scale all networks. Let us take an example. We have an IP subnet having 12 IP addresses. We have two networks. The first network has seven hosts. The second network has three hosts.
If we use FLSM, we can create the following subnets.
Subnets | Hosts in each subnet |
2 | 6 |
3 | 4 |
4 | 3 |
We need seven hosts in the first subnet and three in the second subnet. None of the above-listed combinations fulfill our requirements. If we use VLSM, we can create two subnets. The first will provide eight IP addresses. The second will provide four IP addresses. This example shows how VLSM allows us to utilize IP addresses based on our requirements.
VLSM Subnetting example
The following image shows a network.
The above network has the following requirements.
- The development department needs 74 IP addresses.
- The production department needs 52 IP addresses.
- The administration department needs 28 IP addresses.
- Three WAN links connect these departments.
- Each WAN link needs two IP addresses.
- The given default IP subnet is 192.168.1.0/24.
This tutorial is the ninth chapter of the tutorial series. Other chapters of this series are the following.
Chapter 01 Introduction to Subnetting
Chapter 02 Network Address Basic Concepts Explained with Examples
Chapter 03 The Subnet Mask and Slash Notation
Chapter 04 Convert Decimal IP address in Binary and Binary in Decimal
Chapter 05 Basic Subnetting in Computer Networks Explained
Chapter 06 Subnetting Tutorial - Subnetting Explained with Examples
Chapter 07 Subnetting Tricks Subnetting Made Easy with Examples
Chapter 08 FLSM Subnetting and VLSM Subnetting
Chapter 10 VLSM Subnetting Examples and Calculation Explained
Chapter 11 Route Summarization Advantages and Disadvantages
Chapter 12 Supernetting Tutorial: - Supernetting Explained with Examples
VLSM Subnetting step-by-step
In the first step, we calculate and arrange our IP requirements in descending order.
Each network needs two additional IP addresses, one for the network address and another for the broadcast address. All IP subnets reserve two IP addresses for these requirements. They use the first IP address for the network address and the last IP address for the broadcast address.
Since each network requires two additional IP addresses, we add two to the total host requirement of each network. After finalizing the host requirement, we find the block size that fulfills the host requirement.
A block size is the block of IP address we get when we convert a host bit into a network bit. The following table lists the block sizes we can have.
Host bit(s) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
Block size | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 |
Host bits | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
Block size | 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768 | 65536 |
Host bits | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Block size | 131072 | 262144 | 524288 | 1048576 | 2097152 | 4194304 | 8388608 | 16777216 |
The block size must be greater than or equal to the actual host requirement of the network.
Actual host requirement = Host requirement + Network address + broadcast address Block Size >= Actual host requirement
The following table lists the block sizes that meet our requirements.
Segment | Host requirement | Actual requirement | Block size |
Production | 52 | 54 | 64 |
Development | 74 | 76 | 128 |
Administration | 28 | 30 | 32 |
Wan link 1 | 2 | 4 | 4 |
Wan link 2 | 2 | 4 | 4 |
Wan link 3 | 2 | 4 | 4 |
In the next step, we arrange 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 |
VLSM is an extended version of FLSM. It uses the same steps FLSM uses. In FLSM, we break the default subnet into the same-sized subnets. In VLSM, we further divide the created subnets into small-sized subnets based on our requirements in descending order.
In this example, first, we will perform FLSM from the development segment.
The development segment's block size is 128. The given IP subnet belongs to class C. In class C, the first 24 bits are reserved network bits. We cannot use the reserved network bits. We can use only host bits for subnetting. The default class C IP subnet has 6 (8 - 2 reserved host bits [30 and 31] ) host bits available for subnetting. Subnetting always goes from left to right without skipping a bit. Hence, the first host bit we can use in subnetting is the 25th. If we convert this host bit (25th) into a network bit, we get two subnets having 128 IP addresses each.
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 |
It fulfills the development section's requirements. We can assign the first subnet to the development section and use the second subnet for the next VLSM subnetting.
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 |
Our next segment is the production department. Its block size is 64. If we convert the next host bit (26th), we get four subnets having 64 IP addresses each.
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 |
We cannot use the subnets 1 and 2. They contain the addresses we have already assigned to the development section. We can use the subnet 3 for the production section.
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 |
Our next segment is the administration department. Its block size is 32. If we convert the next host bit (27th), we get eight subnets having 32 IP addresses each.
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 |
We cannot use the subnets 1, 2, 3, 4, 5, and 6. They contain the addresses we have already assigned to the development and production sections. We can use subnet 7 for the administration section.
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 |
Our remaining segments are WAN links. Their block size is 4. If we convert the next three host bits (28, 29, and 30th), we get sixty-four subnets having 4 IP addresses each.
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
We cannot use the subnets 1 to 56. They contain the addresses we have already assigned to the development, production, and administration sections. We can use subnets 57, 58, and 59 for the 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 |
The following image shows the final allocation of IP addresses.
We have assigned IP addresses to all segments. The subnets 60, 61, 62, 63, and 64 are still available for further use.