Variable Length Subnet Mask
Variable Length Subnet Mask (VLSM) extends classic Subnetting. VLSM is a process of breaking down subnets into the smaller subnets, according to the need of individual networks. In above example company has requirement of 6 subnets and 160 host addresses. With VSLM you can fulfill this requirement with single class C address space.
Steps for VLSM Subnetting
- Find the largest segment. Segment which need largest number of hosts address.
- Do Subnetting to fulfill the requirement of largest segment.
- Assign the appropriate subnet mask for the largest segment.
- For second largest segments, take one of these newly created subnets and apply a different, more appropriate, subnet mask to it.
- Assign the appropriate subnet mask for the second largest segment.
- Repeat this process until the last network.
Now you know the steps of VLSM Subnetting. Let's understand it with above example. Our company requires 6 subnets and 160 hosts.
Step 1 :- Oder all segments according the hosts requirement (Largest to smallest).
Subnet | Segment | Hosts |
1 | Development | 74 |
2 | Production | 52 |
3 | Administrative | 28 |
4 | Wan link 1 | 2 |
5 | Wan link 2 | 2 |
6 | Wan link 3 | 2 |
Step 2 :- Do subnetting for largest segment. Our largest segment needs 74 host addresses. /25 provide us two subnets with 126 hosts in each subnet.
192.168.1.0/25
Subnet | Subnet 1 | Subnet 2 |
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 |
Step 3 :- Assign subnet mask to the largest segment. As you can see in above table, subnet 1 fulfill our largest segment requirement. Assign it to our 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 |
Step 4 :- Do subnetting for second largest segment from next available subnet. Next segment requires 52 host addresses. Subnetting of /25 has given us two subnets with 126 hosts in each, from that we have assigned first subnet to development segment. Second segment is available, we would do subnetting of this.
/26 provide us 4 subnets with 62 hosts in each subnet.
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 |
We cannot use subnet 1 and subnet 2 ( address from 0 to 127 ) as they are already assigned to development department. We can assign subnet 3 to our production department.
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 |
Step 5 :- Our next segment requires 28 hosts. From above subnetting we have subnet 3 and subnet 4 available. Do subnetting for the requirement of 28 hosts.
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 |
LastHost | 30 | 62 | 94 | 126 | 158 | 190 | 222 | 254 |
Broadcast ID | 31 | 63 | 95 | 127 | 159 | 191 | 223 | 255 |
Subnets 1 to 6 [ address from 0 to 191] are already occupied by previous segments. We can assign subnet 7 to this segment.
Segment | Administrative |
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 |
Step 6 :- Our last three segments require 2 hosts per subnet. Do subnetting for these.
192.168.1.0/30
Valid subnets are:-
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
From these subnets, subnet 1 to subnet 56 ( Address from 0 - 220) are already assigned to previous segments. We can use 224,228, and 232 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 these subnets to wan links.
Wan Link 1
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 |
Wan Link 2
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 |
Wan link 3
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, still we have 20 addresses available. This is the magic of VLSM.
Classful and classless, these two terms are also used for FLSM and VLSM.
Example
Looking at the diagram, we have three LANs connected to each other with two WAN links.
The first thing to look out for is the number of subnets and number of hosts. In this case, an ISP allocated 192.168.1.0/24. Class C
HQ = 50 host
RO1 = 30 hosts
RO2 = 10 hosts
2 WAN links
We will try and subnet 192.168.1.0 /24 to sooth this network which allows a total number of 254 hosts I recommend you get familiar with this table below. I never leave home without it!
Lets begin with HQ with 50 hosts, using the table above:
We are borrowing 2 bits with value of 64. This is the closest we can get for 50 hosts.
HQ – 192.168.1.0 /26 Network address
HQ = 192.168.1.1 Gateway address
192.168.1.2, First usable address
192.168.1.62- Last usable address. Total address space -192.168.1.2 to 192.168.1.62
192.168.1.63 will be the broadcast address (remember to reserve the first and last address for the Network and Broadcast)
HQ Network Mask 255.255.255.192 – we got the 192 by adding the bit value from the left to the value we borrowed = 128+64=192
HQ address will look like this 192.168.1.0 /26
RO1 = 30 hosts
We are borrowing 3 bits with value of 32; this again is the closest we can get to the number of host needed.
RO1 address will start from 192.168.1.64 – Network address
Now we add the 32 to the 64 we borrowed earlier = 32+64 = 96
RO1 = 192.168.1.65 Gateway address
192.168.1.66 – First usable IP address
192.168.1.94 – Last usable IP address
192.168.1.95 Broadcast address – total address space – 192.168.1.66 –192.168.1. 94
Network Mask 255.255.255.224 I.e. 128+64+32=224 or 192.168.1.64/27
RO2 = 192.168.1.96 Network address
We borrow 4 bits with the value of 16. That’s the closest we can go.
96+16= 112
So, 192.168.1.97- Gateway address
192.168.1.98 – First usable address
192.168.1.110 – Last usable address
192.168.1.111 broadcast
Total host address space – 192.168.1.98 to 192.168.1.110
Network Mask 255.255.255.240 or 192.168.1.96 /28
WAN links = we are borrowing 6 bit with value of 4
=112 + 4 =116
WAN links from HQ to RO1 Network address will be 192.168.1.112 /30 :
HQ se0/0 = 192.168.1.113
RO1 se0/0= 192.168.1.114
Mask for both links= 255.255.255.252 ( we got 252 by adding the bits value we borrowed i.e
124 +64 +32 +16+ 8 +4=252
WAN Link 2= 112+4=116
WAN Link from HQ to RO2 Network address = 192.168.1.116 /30
HQ = 192.168.1.117 subnet mask 255.255.255.252
RO2 = 192.168.1.118 Subnet mask 255.255.255.252
As I mentioned earlier, having this table will prove very helpful. For example, if you have a subnet with 50 hosts then you can easily see from the table that you will need a block size of 64. For a subnet of 30 hosts you will need a block size of 32.
Thus, as illustrated in the above example, VLSM allows organizations to create different sized internal networks.
Reference: