How to Configure VLSM in Cisco Packet Tracer

Variable Length Subnet Mask (VLSM) is a method of dividing a large network into multiple smaller subnetworks with a varied number of usable IP addresses. VLSM is used when the LANS within a network have a high variation in the number of host devices.

For instance, a large network may consist of four LANs: LAN A, LAN B, LAN C, and LAN D. LAN A may have 100 host devices, LAN B may have 50 host devices, LAN C may have 20 host devices, and LAN D may have just 5 host devices. In this case, given a large network like 192.168.2.0/24 to be used for the different LANs, subnetting it with a /26 prefix length will divide the network into 4 subnetworks with 62 usable hosts each. However, this is inefficient because the 62 IP addresses will not be enough for LAN A, which has 100 host devices, but will too much for LAN D, which has just 5 host devices.

To improve the utilization of IP addresses, VLSM helps to divide the large network into subnetworks with unequally usable IP addresses. LANs with a higher number of hosts will take subnetworks with a larger range of IP addresses, while LANs with fewer hosts will take subnetworks with a lower number of usable IP addresses.
In this post, I will be guiding you through a practical implementation of VLSM in a large network.
Let’s get started.

Network Topology

The network topology we will be making use of in this demonstration is shown below. As you can see, it consists of 4 LANs with different numbers of host devices. In this demonstration, we will subnet the network 192.168.5.0/24 into 4 different subnets so that the LAN with a larger number of hosts will receive a subnetwork with a higher number of usable IP addresses, and the LAN with a smaller number of hosts will receive a subnetwork with a lower number of usable IP addresses.

ALSO READ:  How to Configure Native VLAN on Cisco Router

Download the premade lab file (and unzip it) or recreate the network topology shown below on your packet tracer software.

network topology for demonstrating VLSM

What We Will Cover in this Post :

Lab Task

The objective of this Lab is to complete the following tasks;

  1. Subnet the 192.168.5.0/24 network to provide sufficient addressing for each LAN in the network topology above.
  2. Also, subnet for the point-to-point connection between R1 and R2.
  3. Assign the first usable address to the router’s interface in each LAN.
  4. Assign Ip address from the list of the usable address in each LAN to the PCs.
  5. Configure static routes on each router so that all PCs can ping each other.

Lab solution

The general step to doing VLSM is to subnet and  assign the largest subnet at the start of the address space, then the second largest, etc., until you have assigned each subnet.

  1. For LAN 2, you need to use the /25 prefix length. LAN 2 requires 64 usable IP addresses, and the /25 prefix length produces 27 minus 2 = 126 usable IP addresses. Remember that /26 produces 62 usable IP addresses, which will not be enough.
  2. For LAN 1, you need to use the /26 prefix length. LAN 1 requires 45 usable IP addresses, and /26 prefix length produces 62 usable IP addresses, which is enough.
  3. For LAN 3, you need to use the /28 prefix length. LAN 3 requires 14 usable IP addresses, and the /28 prefix length produces 14 usable IP addresses.
  4. For LAN 4, you need to use the /28 prefix length as well. LAN 4 requires 9 usable IP addresses, and the /28 prefix length produces 14 usable IP addresses, which is enough. Remember that the /29 prefix length produces six usable IP addresses, which will not be enough.
  5. For the point-to-point connection between the two routers, you need to use the /30 prefix length. The point-to-point connection requires two usable IP addresses, and a /30 prefix length produces two usable IP addresses.
ALSO READ:  How to Configure TFTP Server In Packet Tracer

After implementing VLSM subnetting, the new network topology with the network address and host address labeled is shown below:

LAb 5 solution

Configurations

Here are the configuration needed to be completed on each of the routers;

Configuring the interfaces of  the routers

R2

R2>enable
R2#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface g0/0
R2(config-if)#ip address 192.168.5.193 255.255.255.240
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
R2(config-if)#interface g0/1
R2(config-if)#ip address 192.168.5.209 255.255.255.240
R2(config-if)#no shutdown
R2(config-if)#
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
R2(config-if)#interface g0/0/0
R2(config-if)#ip address 192.168.5.225 255.255.255.252
R2(config-if)#no shutdown

 R1

R1>enable
R1#configure terminal
R1(config-if)#interface g0/1
R1(config-if)#ip address 192.168.5.129 255.255.255.192
R1(config-if)#interface g0/0
R1(config-if)#ip address 192.168.5.1 255.255.255.128
R1(config)#interface g0/0/0
R1(config-if)#ip address 192.168.5.226 255.255.255.252
R1(config-if)#no shutdown

Static Route configuration

R2

R2(config)#ip route 192.168.5.0 255.255.255.128 192.168.5.226
R2(config)#ip route 192.168.5.128 255.255.255.192 192.168.5.226
R2(config)#do show ip route
---------------------------------------------------------------------
---------------------------------------------------------------------
S 192.168.5.0/25 [1/0] via 192.168.5.226
S 192.168.5.128/26 [1/0] via 192.168.5.226
---------------------------------------------------------------------
---------------------------------------------------------------------

R1

R1(config)#ip route 192.168.5.208 255.255.255.240 192.168.5.225

R1(config)#do show ip route
---------------------------------------------------------------------
---------------------------------------------------------------------
S 192.168.5.192/28 [1/0] via 192.168.5.225
S 192.168.5.208/28 [1/0] via 192.168.5.225
---------------------------------------------------------------------

Configuring the host devices

The steps to configure each of the host devices are the same. The IP addresses are already labeled in the network topology above. So, I will only show you how to configure PC0.

ALSO READ:  How To Configure Two Routers In Cisco Packet Tracer | Static Route Configuration on Cisco Routers

configuring the interface of pC0

Follow the same way to configure every other host in the network as labeled in the network topology above.

Testing the configuration

As shown in the image bellow, I have pinged from PC1 to other host devices and I got reply

testing the configuration

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top