Classless routing vs classful routing

Router routes traffic based on the longest prefix, and cannot find any match traffic will be dropped.

Classless routing

The routing that we normally understand is classless routing.

Let’s explore the routing tables of R1 and R2.




R1 pings to because a specific static route is in the routing table


R1 can ping to the above two addresses because the default route is matched. So classless routing is this:

  1. Find the route with the longest prefix.
  2. If there is no match in the longest prefix it will match the default route

Classful routing


ip classless is turned on by default. To demonstrate classful routing we need to turn off ip classless and ip cef.


Let’s revisit R1’s routing table. With classful routing, routing decision changes.


No problem with because there is a specific match in the routing table.

No problem with because there is no big networks 172.30.x.x in the routing table and it matches the default route.

Problem with, because there is a big network which says: is variably subnetted, 4 subnets, 3 masks.

Now is under and because there is no specific route and it matches the big network the traffic is dropped due to no match is found. Router will not look into the default route when there is no match for


From the debug it says is unroutable. In this scenario specific route to has to be added to the routing table.


So classful routing:

  1. matches route with the longest prefix same as the classless routing.
  2. if there is a big network, and there is no specific route to this big network the traffic is drop.
  3. If there is no longest prefix route, and the address is not under any big network then router consults the default route.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s