Classless Static Routing (VLSM) on Cisco Router

This tutorial shows you how to Configure Classless Static Routing in Cisco Router. As shown in above image ‘CCNA-RS-IMG-5.0’ there are three routers in network connected with each other through SERIAL CABLES on SERIAL INTERFACE of Routers. Here we are having Variable Length Subnet Mask(VLSM) on each Network, means every network is having different subnet mask. Router R1 is having 50 Hosts, R2 – 100 hosts & R3 – 20 hosts respectively.

As per host requirement Subnetting the network as shown below

R1 - 192.168.10.0/26 -- 192.168.10.0 (Sub Network Address)
50 Hosts               
192.168.10.1 {
|   Address Can be Assigned to Hosts
192.168.10.62 }
192.168.10.63 (Broadcast Address)

Similarly for Routers R2 & R3

R2 - 192.168.20.0/25 -- 192.168.20.0 (Sub Network Address)
100 Hosts                
192.168.20.1 {
|   Address Can be Assigned to Hosts
192.168.20.126 }
192.168.20.127 (Broadcast Address)


R3 - 192.168.30.0/27 -- 192.168.30.0 (Sub Network Address)
20 Hosts                   192.168.30.1 {
|   Address Can be Assigned to Hosts
192.168.30.30 )
192.168.30.31 (Broadcast Address)

  • Router Configuration Wizard


R1> enable
R1# configure terminal
R1(config)# interface fastEthernet 0/0
R1(config-if)# ip address 192.168.10.1 255.255.255.192
R1(config-if)# no shutdown
R1(config-if)# exit


R1(config)# interface Serial 1/0
R1(config-if)# ip address 192.168.1.1 255.255.255.252
R1(config-if)# clock rate 64000
R1(config-if)# no shutdown
R1(config-if)# exit
R1(config)#


R2> enable
R2# configure terminal
R2(config)# interface fastEthernet 0/0
R2(config-if)# ip address 192.168.20.1 255.255.255.128
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)#


R2(config)# interface Serial 1/0
R2(config-if)# ip address 192.168.1.2 255.255.255.252
R2(config-if)# clock rate 64000
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)#


R2(config)# interface Serial 1/1
R2(config-if)# ip address 192.168.2.1 255.255.255.252
R2(config-if)# clock rate 64000
R2(config-if)# no shutdown
R2(config-if)# exit
R2(config)#


R3> enable
R3# configure terminal
R3(config)# interface fastEthernet 0/0
R3(config-if)# ip address 192.168.30.1 255.255.255.224
R3(config-if)# no shutdown
R3(config-if)# exit
R3(config)#


R3(config)# interface Serial 1/0
R3(config-if)# ip address 192.168.2.2 255.255.255.252
R3(config-if)# no shutdown
R3(config-if)# exit
R3(config)#

  • Configuring DHCP Server on each Router


R1> enable
R1# configure terminal
R1(config)# service dhcp (To enable DHCP Server on router)
R1(config)# ip dhcp pool LAN_1_Address
R1(dhcp-config)# network 192.168.10.0 255.255.255.192
R1(dhcp-config)# default-router 192.168.10.1
R1(dhcp-config)# dns-server 8.8.8.8
R1(dhcp-config)# exit
R1(config)# ip dhcp excluded-address 192.168.10.2 192.168.10.5 (To exclude IP range that we dont want assign to HOST)


R2> enable
R2# configure terminal
R2(config)# service dhcp (To enable DHCP Server on router)
R2(config)# ip dhcp pool LAN_2_Address
R2(dhcp-config)# network 192.168.20.0 255.255.255.128
R2(dhcp-config)# default-router 192.168.20.1
R2(dhcp-config)# dns-server 8.8.8.8
R2(dhcp-config)# exit
R2(config)# ip dhcp excluded-address 192.168.20.2 192.168.20.5 (To exclude IP range that we dont want assign to HOST)


R3> enable
R3# configure terminal
R3(config)# service dhcp (To enable DHCP Server on router)
R3(config)# ip dhcp pool LAN_3_Address
R3(dhcp-config)# network 192.168.30.0 255.255.255.224
R3(dhcp-config)# default-router 192.168.30.1
R3(dhcp-config)# dns-server 8.8.8.8
R3(dhcp-config)# exit
R3(config)# ip dhcp excluded-address 192.168.30.2 192.168.30.5 (To exclude IP range that we dont want assign to HOST)

  • Verifying Connectivity from PC in 192.168.10.0/26 Network to PC in 192.168.20.0/25 Network

C:\>ipconfig

FastEthernet0 Connection:(default port)

Link-local IPv6 Address.........: FE80::20A:41FF:FE0E:6467
IP Address......................: 192.168.10.6
Subnet Mask.....................: 255.255.255.192
Default Gateway.................: 192.168.10.1

C:\>ping 192.168.20.8

Pinging 192.168.20.8 with 32 bytes of data:


Reply from 192.168.10.1: Destination host unreachable.
Reply from 192.168.10.1: Destination host unreachable.
Reply from 192.168.10.1: Destination host unreachable.
Reply from 192.168.10.1: Destination host unreachable.


Ping statistics for 192.168.20.8:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),


As seen in above response we are not able to connect with another network.

  • Let us check in Router with IP Route Command


R1(config)# do show ip route


Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route


Gateway of last resort is not set


C 192.168.1.0/30 is directly connected, Serial1/0
C 192.168.10.0/26 is directly connected, FastEthernet0/0

As shown in above output the 192.168.20.0/25, 192.168.30.0/27 & 192.168.2.0/30 network are not present in Router R1 Routing Table, so it will not route the packet to that network. For that we need to add the Route to each & every Router in network so that they can connect with each other. Here we’ll add Classless (IP Having Variable length subnet mask) route to Router Routing Table. In Static Routing the Network Administrator should have knowledge of each & every network & Sub Network that he want’s to connect & have to manually add that Route in Router’s Routing table as shown below


R1# configure terminal
R1(config)# ip route Destination prefix Destination prefix mask Next's HOP Address
R1(config)# ip route 192.168.20.0 255.255.255.128 192.168.1.2 (Here 192.168.1.2 is Address of Interface from where it would connect to 192.168.20.0/25 Network)
R1(config)# ip route 192.168.30.0 255.255.255.224 192.168.1.2
R1(config)# ip route 192.168.2.0 255.255.255.252 192.168.1.2

Similarly for R2 & R3 Router

R2# configure terminal
R2(config)# ip route 192.168.10.0 255.255.255.192 192.168.1.1
R2(config)# ip route 192.168.30.0 255.255.255.224 192.168.2.2


R3# configure terminal
R3(config)# ip route 192.168.10.0 255.255.255.192 192.168.2.1
R3(config)# ip route 192.168.20.0 255.255.255.128 192.168.2.1
R3(config)# ip route 192.168.1.0 255.255.255.252 192.168.2.1

  • Verifying from Router


R1(config)# do show ip route


Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.1.0/30 is directly connected, Serial1/0
S 192.168.2.0/30 [1/0] via 192.168.1.2
C 192.168.10.0/26 is directly connected, FastEthernet0/0
S 192.168.20.0/25 [1/0] via 192.168.1.2
S 192.168.30.0/27 [1/0] via 192.168.1.2

As shown above the Routing table of Router R1 contains Route to all Network, so now it can PING or Connect to all the Network.

  • Verifying Connection from PC.


C:\>ipconfig


FastEthernet0 Connection:(default port)


Link-local IPv6 Address.........: FE80::20A:41FF:FE0E:6467
IP Address......................: 192.168.10.6
Subnet Mask.....................: 255.255.255.192
Default Gateway.................: 192.168.10.1


C:\>ping 192.168.20.8


Pinging 192.168.20.8 with 32 bytes of data:


Reply from 192.168.20.8: bytes=32 time=2ms TTL=126
Reply from 192.168.20.8: bytes=32 time=1ms TTL=126
Reply from 192.168.20.8: bytes=32 time=1ms TTL=126
Reply from 192.168.20.8: bytes=32 time=1ms TTL=126


Ping statistics for 192.168.20.8:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 2ms, Average = 1ms

Hence, Connection established.