VLSM Subnetting Explained with Examples

This tutorial explains VLSM Subnetting step by step with examples including Classful Subnetting, Classless Subnetting, VLSM examples, Variable Length Subnet Mask, Fixed length subnet mask. Learn what VLSM is and how to optimize IP addresses with it in easy language.

VLSM is a process of dividing an IP network into the subnets of different sizes without wasting IP addresses. When we perform Subnetting, all subnets have the same number of hosts, this is known as FLSM ( Fixed length subnet mask). In FLSM all subnets use same subnet mask, this lead to inefficiencies.

This tutorial is the first part of our article “Network Addressing Explained with Subnetting and VLSM”. You can read other parts of this article here.

Basic of Network Addressing

This tutorial is the first part of this article. In this introductory part I explained how computers find each other in network with basic terminology of network addressing.

Subnetting Tutorial - Subnetting Explained with Examples

This tutorial is second part of this article. In this part I explained IP addressing and Subnetting in detail with examples. Later I will present an easy and unique method of Subnetting that will make it easier to understand.

In real life scenario, some subnets may require large number of host addresses while other may require only few addresses.

For example, assume that you are a network administrator at Laxmisoftwares. Company has three departments connected with wan links.

  • Development department has 74 computers.
  • Production department has 52 computers.
  • Administrative department has 28 computers.
  • All departments are connected with each other via wan link.
  • Each wan link requires two IP addresses.

FLSM Laxmisoftwares

With FLSM, to accumulate this requirement we have two choices, either purchase a class B IP address or purchase at least two class C IP addresses.

First choice (purchase a class B IP address)

Subnetting of this address would give us 128 subnets and 510 hosts in each subnet. Our network requires only 6 subnets and 160 addresses. We would have to pay for 65356 addresses while you need only 160 addresses. Every IP address adds more dollars in company bill. Would you consider this address space for company?

Second choice (purchase at least two Class C IP addresses)


Subnetting of first address would give us 2 subnets and 126 hosts in each subnet.

Subnetting of second address would give us 4 subnets and 62 hosts in each subnet.

Collectively we are getting 6 subnets and 500 hosts from these two address spaces. We are still wasting more than 300 IP address, and we would have to purchase two address spaces.

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.

VLSM Subnetting

In VLSM Subnetting, we do Subnetting of subnets according the network requirement.

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.

VLSM Example

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.

Subnet Subnet 1Subnet 2
Network ID
First host address192.168.1.1192.168.1.129
Last host address192.168.1.126192.168.1.254
Broadcast ID192.168.1.127192.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.

Requirement 74
Subnet mask255.255.255.128
Network ID192.168.1.0
First hosts192.168.1.1
Last hosts192.168.1.126
Broadcast ID192.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.

SubnetSubnet 1Subnet 2Subnet 3Subnet 4
Network ID064128192
First address165129193
Last address62126190254
Broadcast ID63127191255

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.

Subnet mask255.255.255.192
Network ID192.168.1.128
First hosts192.168.1.129
Last hosts192.168.1.190
Broadcast ID192.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.

SubnetSub 1Sub 2Sub 3Sub 4Sub 5Sub 6Sub 7Sub 8
Net ID0326496128160192224
First Host1336595129161193225
Broadcast ID316395127159191223255

Subnets 1 to 6 [ address from 0 to 191] are already occupied by previous segments. We can assign subnet 7 to this segment.

Subnet mask255.255.255.224
Network ID192.168.1.192
First hosts192.168.1.193
Last hosts192.168.1.222
Broadcast ID192.168.1.223

Step 6 :- Our last three segments require 2 hosts per subnet. Do subnetting for these.

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.

SubnetSubnet 57Subnet 58Subnet 59
Network ID224228232
First host225229233
Last host226230234
Broadcast ID227231235

Assign these subnets to wan links.

Wan Link 1

SegmentsWan Link 1
Subnet mask255.255.255.252
Network ID192.168.1.224
First hosts192.168.1.225
Last hosts192.168.1.226
Broadcast ID192.168.1.227

Wan Link 2

SegmentsWan Link 2
Requirement 2
Subnet mask255.255.255.252
Network ID192.168.1.228
First hosts192.168.1.229
Last hosts192.168.1.230
Broadcast ID192.168.1.231

Wan link 3

SegmentsWan Link 3
Subnet mask
Network ID
First hosts192.168.1.233
Last hosts
Broadcast ID192.168.1.235

We have assigned IP addresses to all segments, still we have 20 addresses available. This is the magic of VLSM.

Example of VLSM

Classful and classless, these two terms are also used for FLSM and VLSM.

Classful subnetting

FLSM is also known as classful subnetting as all subnets have same number of hosts. In classful subnetting all subnets use same subnet mask.

Classless subnetting

VLSM is also known as classless subnetting as all subnets may have different number of hosts depending upon network requirement.

Classful routing

RIPv1 and IGRP routing protocols do not have a field for subnet information. It means that if a router running RIP routing protocol, has a subnet mask of a certain value, it assumes that all interfaces within the classful address space have the same subnet mask. This is known as classful routing.

Classless routing

RIPv2, EIGRP and OSPF are known as classless routing protocols, as they have field for subnet information in their routing advertisement. VLSM only works with classless routing protocols.

ComputerNetworkingNotes CCNA Study Guide VLSM Subnetting Explained with Examples