Cisco IP Classless Command

When Cisco routers have to forward packets, they will check their routing table and they use longest prefix matching to find the best match. If you don’t have a best match then the router will use a default route (if you have one). Otherwise, the packet will be dropped.

The forwarding behavior that I described above is called classless routing and it has been the default since IOS 11.3. This is an ancient version, it went end-of-sale around 1998 so classless routing is the only thing that most people know about nowadays.

The other method is called classful routing and it works slightly different. Instead of trying to explain this with text it’s better to see it in action with some examples.

Don’t confuse classful and classless routing with classful and classless routing protocols. Those are two different things…

To demonstrate the difference between classless and classful routing I will use the following topology:

Cisco classful routing topology

R2 has four loopback interfaces that we will try to reach from R1. To do this, we’ll use some static routes on R1. Let’s take a look at the configuration…

When Cisco routers have to forward packets, they will check their routing table and they use longest prefix matching to find the best match. If you don't have a best match then the router will use a default route (if you have one). Otherwise, the packet will be dropped. The forwarding behavior that 


Configuration

Classless Routing

Let’s start with the default mode, classless routing. Here’s what the routing table of R1 looks like:

R1#show ip route static
172.16.0.0/24 is subnetted, 2 subnets
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

We have three static routes. Let’s try to ping each loopback interface on R2:

R1#ping 172.16.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/28/68 ms

This ping works because we have a specific 172.16.0.0 /24 route in the routing table. Let’s try 172.16.1.2:

R1#ping 172.16.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/30/80 ms

This ping also works because we have a specific 172.16.1.0 /24 route in the routing table. Let’s try 172.16.2.2:

R1#ping 172.16.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/30/72 ms

This ping works, there is no specific entry for it in the routing table but we can use the default route for it. Last but not least, let’s try 10.10.10.2:

R1#ping 10.10.10.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/33/72 ms

This ping also works because of the default route. So far everything is working as expected. Now let’s take a look at classful routing.

Classful Routing

First we have to disable classless routing on R1:

R1(config)#no ip classless

Also to make this work, you have to disable CEF (Cisco Express Forwarding):

R1(config)#no ip cef

Now we are ready for some tests. First of all, let me show you the routing table again:

R1#show ip route static 
     172.16.0.0/24 is subnetted, 2 subnets
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

Nothing has changed in the routing table, it’s exactly the same. Only the forwarding decisions of the router have changed. Let’s try those pings again:

R1#ping 172.16.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/24/60 ms
R1#ping 172.16.1.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 16/32/56 ms

The first two pings are successful because we have two matching entries in the routing table: 172.16.0.0 /24 and 172.16.1.0 /24. Before I try a ping to 172.16.2.2, let’s enable a debug:

R1#debug ip packet 
IP packet debugging is on

Now let’s try that ping:

R1#ping 172.16.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.2.2, timeout is 2 seconds:

Success rate is 0 percent (0/5)

This ping doesn’t work anymore and this is what the debug tells us:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

507 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Tags:


Forum Replies

  1. CAM: High speed memory that is primarily used for a switch’s layer 2 lookup information. This information allows the switch to decide which port to send a packet to (a known MAC address) or whether to flood it to all ports (unknown MAC address).

    TCAM: Not all switches have this. Think of this as an extension of CAM. It is used for very rapid decisions on ACLs and Quality of Service. On high end layer 3 switches, the TCAM can also contain the FIB, again, so specialized hardware can making routing decisions without interrupting the central CPU of the switch.

    ... Continue reading in our forum

  2. Thanks Rene,

    I have another question, in the above section where u have mention about ARP request construct, I think the behavior of switches are different

    The multilayer switch will check the routing table, notices that 192.168.20 /24 is directly connected and the following will happen:
    The destination MAC address changes from FFF (Multilayer switch Fa0/1 ) to BBB (ComputerB).
    The source MAC address changes from AAA (ComputerA) to GGG (Multilayer switch Fa0/2).===This seems to be Incorrect

    I LAB this up with 3 switches (all real hardware 3550/3560) [ c3560-ips

    ... Continue reading in our forum

  3. Hi Andrew!,

    Glad to see you around and yea! thanks for confirming my doubt.

    I have a few more doubts that i have no where to turn to and i hope you will enlightened me…

    My coreswitch has ip cef turn on my default.

    q1) I have been reading up abit on cisco about IP CEF and it seems like to enable/disable IP CEF, you have to do in at the ingress interface as the decision (e.g. load balance is done there). – is it right ?

    Assuming i have “no ip cef” and only wish to turn on ip cef on certain interfaces and ->
    q2) if i want to do to packet loadbalancing, should “ip

    ... Continue reading in our forum

    1. The ARP table is stored in RAM, and not in either CAM or TCAM

    2. Here is the Cisco definition of Epoch and how it is used:

    The term "epoch" refers to a period of time. A new epoch for a Cisco Express Forwarding table begins when a table rebuild is initiated. The time after this instant is in an epoch different from the time before, and the different epochs are numbered between 0 and 255. Through the use of epochs, the software can distinguish between old and new forwarding information in the same database structure and can retain the old Cisco Express Forwar
    ... Continue reading in our forum

89 more replies! Ask a question or join the discussion by visiting our Community Forum