I still remember, quite some time back, I used to find the concept of classless vs. classful routing, quite dificult to understand. To enable/disable classless routing, we can use the command [no] ip classless.
So, ip classless – enables classless routing; no ip classless, enables classfull routing. Furthermore, classless routing is enabled by default and unless you are running an ancient IOS version, you will not see this command in the show running-config output. You will however see it, should you enable classfull routing by using the no form of the command.
But before diving in, let’s review what are the five IPv4 ADDRESS CLASSES:
So from left to right we have the following (note the notation used to show the range):
- CLASS A: [0 – 126].x.y.z / Mask: 255.0.0.0
- CLASS B: [128 – 191].x.y.z / Mask: 255.255.0.0
- CLASS C: [192 – 223].x.y.z / Mask: 255.255.255.0
- CLASS D: [224 – 239].x.y.z / Multicast range; it doesn’t use a network mask!
- CLASS E: [240 – 255].x.y.z – this is a reserved range as initially defined
THE ROUTING TABLE STRUCTURE
On Cisco’s documentation, there are actually quite a few types of routes to be found in the routing table such as, parent routes, ultimate routes, glassful routes, etc. – different names based on different criteria. I have to say that based on my experiments, I do not necessarily agree strictly with some of the definitions Cisco provides.
From now on, I will also use the diagram below:
- A route pointing to a network shorter, or equal, to the classfull equivalent, is added as a single entry (see routes to 192.168.0.0/20 & 192.168.2.0 /24)
- A route pointing to a network with a longer prefix than its classfull equivalent, will be added as a subnet. Furthermore, in this case, the following is also true:
- an additional entry is automatically added as the “subnetted” network (parent route) should all child routes use the same mask (see routes to 192.168.10.0/30 & 192.168.10.4/30)
- an additional entry is automatically added as “variably subnetted” network (parent route) should child routes use different masks (see routes to 192.168.20.0/30 & 192.168.20.4/31)
THE FORWARDING PROCESS
As mentioned initially, the router by default will make classless forwarding decisions – meaning, it will not care of whether the destination is classless or classful. The router will lookup the route in the routing table and match based on the longest prefix. Should there be no matching route, the default route will be used, if one exist. Otherwise, the packet will get dropped.
With classfull routing however, the router will *always* try to match routes as part of a supernet (parent route). When a successful match occurs, the router will further try to match the destination network within that supernet. Should this process not be successful, the packet will be dropped. The default route will only be used when a parent route is not identified; the packet is also dropped when no default route is set.
To illustrate this I’ve done the following:
- enabled packet & routing debugging (debug ip packet & debug ip routing)
- enabled classfull routing (no ip classless)
- disabled cef (no ip cef)
Let’s run few traces now …