Variable Length Subnet Masking

As described previosuly neither RIPv1 or IGRP routing protocols have a field for subnet information, so the subnet information gets dropped. What this means is that if a router running RIP 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 called classful routing, and RIP and IGRP are both considered classful routing protocols.

Classless routing protocols, however, do support the advertisement of subnet information. Therefore, you can use VLSM with routing protocols such as RIPv2, EIGRP, and OSPF. The benefit of this type of network is that you save a lots of IP address space with it. With the IPv4 address space nearly depleted, this can be of great value.

VLSM enables you to have more than one mask for a given class of address, whether its a class A, B, or C network number.

VLSM was originally defined in RFC 1812, allows you to apply different subnet masks to the same class address space Classful protocols, such as RIPv1 and IGRP, do not support VLSM. To deploy VLSM requires a routing protocol that is classless—BGP, EIGRP, IS-IS, OSPF, or RIPv2, for instance.

VLSM provides Two major advantages:

  • More efficient use of address space
  • Ability to perform route summarisation

when you perform classful subnetting, all subnets have the same number of hosts because they all use the same subnet mask. This leads to inefficiencies. For example, if you borrow 4 bits on a Class C network, you end up with 14 valid subnets of 14 valid hosts. A serial link to another router only needs 2 hosts, but with classical subnetting, you end up wasting 12 of those hosts. Even with the ability to use NAT and private addresses, where you should never run out of addresses in a network design, you still want to ensure that the IP Addressing scheme that you create is as efficient as possible.

Calculating an efficient addressing scheme using VLSM.

In order to create an efficient addressing scheme using VLSM follow these steps;

  • Find the largest segment in the area—the segment with the largest number of devices connected to it.
  • Find the appropriate subnet mask for the largest network segment.
  • Write down your subnet numbers to fit your subnet mask.
  • For your smaller segments, take one of these newly created subnets and apply a different, more appropriate, subnet mask to it.
  • Write down your newly subnetted subnets.
  • For even smaller segments, go back to step 4.

Lets look at an example

Example of VLSM



Above image shows several branch offices using subnetted Class C (/26) addresses that provide each branch with 62 possible host IPs. The branches are connected to the central office via point-to-point WAN links. The ideal mask to use for such a link is /30 because it provides only 2 hosts, one for each end of the link. The problem arises when the routing protocols are configured: Prior to VLSM, the /30 networks could not be used because the /26 networks existed in the same system and the classful routing protocols could only advertise one mask per class of address. All networks, including the little /30 links, had to use the same mask of /26. This wastes 60 IP addresses on each WAN link.


With the implementation of VLSM-capable routing protocols, we can deploy a /30 mask on the point-to-point links, and the routing protocols can advertise them as /30s along with the /26s in the branches because the subnet mask for each network is included in the routing updates.

VLSM has allowed us to make the point-to-point link networks the ideal size (two hosts on each) using /30 masks. This has allowed us to use a single subnetted Class C network for all the addressing requirements in this scenario.  We can also summarise these routes which is an added advantage.  By utilising VLSM we can be more efficient in our addressing, making networks the appropriate size without depleting the limited address space or limiting future growth.

Next – Route Summarisation