Cisco IP Classless Command

This topic is to discuss the following lesson:

Rene,

Hello, thanks for the explanation of this, it is nice to finally have an understanding of this command.

Chris

Hi Rene,

Great explanation but I think it should be 172.16.0.0/16 is subnetted, 2 subnets rather than /24.

correct me if i am wrong.

Hello Kapil

It is true that the 172.16.0.0 subnet is a class B address, and thus in clasful IP addressing it would have a prefix of /16 rather than /24. However, classless and classful routing should not be confused with classless and classful addressing or routing protocols.

Having said that, it can be confusing when the routing table states that:

R1#show ip route static
<strong>172.16.0.0/24 is subnetted, 2 subnets</strong>
S       172.16.0.0 [1/0] via 192.168.12.2
S       172.16.1.0 [1/0] via 192.168.12.2
S*   0.0.0.0/0 [1/0] via 192.168.12.2

For reference purposes, keep in mind that the bold line above is called a parent route, and the two lines below it are child routes.

It seems like what it is saying is that the 172.16.0.0/24 network is being subnetted into 2 subnets. That should mean that the prefix of the parent route should be smaller than that of the child routes. But here, both the parent and child prefixes are the same size (/24). Let’s experiment a bit. I tried creating different routing tables and found the following:

  1. When the child subnets are the same size, the prefix of the child subnets is indicated in the parent route:
Router#show ip route
Gateway of last resort is not set
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback1
C       172.16.2.0 is directly connected, Loopback2
C       172.16.32.0 is directly connected, Loopback3
Router#

Similarly in this example:

Router#show ip route
Gateway of last resort is not set
     10.0.0.0/25 is subnetted, 3 subnets
C       10.10.10.0 is directly connected, Loopback10
C       10.10.11.0 is directly connected, Loopback11
C       10.10.12.0 is directly connected, Loopback12
Router#
  1. When the child subnets are not the same size, that is they are variably subnetted, then the prefix of the parent route reverts to the classful prefix:
Router#show ip route
Gateway of last resort is not set
     172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks
C       172.16.1.0/24 is directly connected, Loopback1
C       172.16.2.0/24 is directly connected, Loopback2
C       172.16.5.0/25 is directly connected, Loopback4
C       172.16.32.0/24 is directly connected, Loopback3
Router#
  1. Finally, if the subnet mask is smaller than the classful mask of the network, no parent route is created but each route is displayed individually:
Router#show ip route
Gateway of last resort is not set
C    192.168.0.0/23 is directly connected, Loopback20
C    192.168.2.0/23 is directly connected, Loopback21
Router#

Keep in mind that all of the above is true only for 12.X versions of Cisco IOS. In version 15.X, the routing table includes a local route with a prefix of /32. This results in all routes always being variably subnetted, thus all parent routes will always display their classful prefixes. Here is an example of such a routing table:

Router#show ip route
Gateway of last resort is not set
     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       10.10.10.0/24 is directly connected, Loopback5
L       10.10.10.1/32 is directly connected, Loopback5
     172.16.0.0/16 is variably subnetted, 8 subnets, 2 masks
C       172.16.1.0/24 is directly connected, Loopback1
L       172.16.1.1/32 is directly connected, Loopback1
C       172.16.2.0/24 is directly connected, Loopback2
L       172.16.2.1/32 is directly connected, Loopback2
C       172.16.3.0/24 is directly connected, Loopback3
L       172.16.3.1/32 is directly connected, Loopback3
C       172.16.4.0/24 is directly connected, Loopback4
L       172.16.4.1/32 is directly connected, Loopback4
Router#

So to summarize, in version 12.X, if all child routes have the same prefix, parent routes always display that prefix. If they are variably subnetted, the classful prefix is displayed. If you are using IOS version 15.X, parent routes are always variably subnetted thus they display the classful prefix.

I hope this has been helpful!

1 Like

Thanks for the explanation … I think now I get it I have never worked on 12.X version of the IOS as it was already out of date by the time i started learning networking. So I thought it is weird.

Extremely detailed answer. Thanks again

Nice explanation Rene’. Makes perfect sense.

One comment about the configs for R1. I don’t see the static default route in the config.

Hello Andy

Yes you are correct, I will let Rene know.

Thanks very much for catching that!

Laz

Thanks Andy, just fixed this.

Hi guys,

Great explanation, thank you.

Quick question,

What is the default nowadays in Cisco Routers “Classful or Classless”.

Also what command can I use to view what mode it is using?

Hello Joseph

By default the classless feature is enabled. Before IOS version 11.3, the default was disabled. You can find out more info at this CLI command reference:


In order to see what mode you are in, you can take a look at the running configuration. If you see the no ip classless command exists, then you are running in classful mode. If the ip classless command exists or if there is no such command at all, then you are running in classless mode.

I hope this has been helpful!

Laz

1 Like