Skip to main content

Classless and Classful Routing

In this simple lab, my objective is to see how classful routing affects the packet forwarding process. Classful routing is enabled using the no ip classless command (classless routing is enabled by default).

Classless routing: When a packet’s destination only matches a router’s default route, and does not match any other routes, forward the packet using that default route.
Classful routing: When a packet’s destination only matches a router’s default route, and does not match any other routes, only use the default route if this router does not know any routes in the classful network in which the destination IP address resides.
~CCNA ICND2 Official Cert Guide (3rd Ed) by Wendell Odom
I applied this config on my routers. As you can see I enabled classful routing on R1. I also configured default routes on both routers.

R1
hostname R1
!
interface FastEthernet0/0
 ip address 10.10.10.1 255.255.255.0
!
interface Serial0/0
 ip address 192.168.1.1 255.255.255.0
 clock rate 64000
!
no ip classless
ip route 0.0.0.0 0.0.0.0 Serial0/0

R2
hostname R2
!
interface FastEthernet0/0
 ip address 10.10.0.254 255.255.255.0
!
interface Serial0/0
 ip address 192.168.1.2 255.255.255.0
!
interface FastEthernet0/1
 ip address 8.8.8.1 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 Serial0/0

These are my configurations for the end hosts.
PC1
IP Address: 10.10.10.2
Default Gateway: 10.10.10.1
Subnet Mask: 255.255.255.0

PC2
IP Address: 10.10.0.1
Default Gateway: 10.10.0.254
Subnet Mask: 255.255.255.0

PC3
IP Address: 8.8.8.8
Default Gateway: 8.8.8.1
Subnet Mask: 255.255.255.0

Let's check R1's routing table:
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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 0.0.0.0 to network 0.0.0.0


     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, FastEthernet0/0
C    192.168.1.0/24 is directly connected, Serial0/0
S*   0.0.0.0/0 is directly connected, Serial0/0


With the description of classful routing above, if I ping from PC1 to PC2 (10.10.0.1), the default route will not be used and the ping will fail. That's because of the presence of route to 10.10.10.0/24 subnet in R1's routing table. Remember that 10.0.0.0/8 is one classful network in which the networks 10.10.0.0/24 and 10.10.10.0/24 both resides. But if I ping from PC1 to PC3 (8.8.8.8), the default route will be used because there is no route to any subnets in the network 8.0.0.0/8 in R1's routing table.

To confirm the theory:
C:\Users\win7>ping 10.10.0.1

Pinging 10.10.0.1 with 32 bytes of data:
Reply from 10.10.10.1: Destination host unreachable.
Reply from 10.10.10.1: Destination host unreachable.
Reply from 10.10.10.1: Destination host unreachable.
Reply from 10.10.10.1: Destination host unreachable.


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


C:\Users\win7>ping 8.8.8.8

Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=64ms TTL=62
Reply from 8.8.8.8: bytes=32 time=16ms TTL=62
Reply from 8.8.8.8: bytes=32 time=15ms TTL=62
Reply from 8.8.8.8: bytes=32 time=18ms TTL=62


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


Now if we disable classful routing thus enabling classless routing:
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#ip classless

Let's see if the ping will work now:
C:\Users\win7>ping 10.10.0.1

Pinging 10.10.0.1 with 32 bytes of data:
Reply from 10.10.0.1: bytes=32 time=42ms TTL=62
Reply from 10.10.0.1: bytes=32 time=22ms TTL=62
Reply from 10.10.0.1: bytes=32 time=20ms TTL=62
Reply from 10.10.0.1: bytes=32 time=18ms TTL=62


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




For those of you who want to try this lab, I used Microsoft Loopback Adapter and VPCS. If you don't know how to install them read this tutorial here and here.

On GNS3: Add interface to PC1 using NIO Ethernet and choose the connection for Microsoft Loopback Adapter. Add interface to PC2 using NIO UDP with Local Port = 30001 and Remote Port = 20001 and to PC3 with Local Port = 30002 and Remote Port = 20002.

Configure the IPv4 address parameters for PC1 in Network Connections in Control Panel.

On VPCS: Configure PC2 and PC3's IPv4 Address parameters:
PC2: ip 10.10.0.1 10.10.0.254 24
PC3: ip 8.8.8.8 8.8.8.1 24


Comments