Wednesday, 29 May 2013

Understanding "IP classless" command in Cisco Routers

IP Classless

Where the ip classless configuration command falls within the routing and forwarding processes is often confusing. In reality, IP classless only affects the operation of the forwarding processes in IOS; it doesn't affect the way the routing table is built. If IP classless isn't configured (using the no ip classless command), the router won't forward packets to supernets. As an example, let's again place three routes in the routing table and route packets through the router.
Note: If the supernet or default route is learned via IS-IS or OSPF, the no ip classless configuration command is ignored. In this case, packet switching behavior works as though ip classless were configured.
router# show ip route
.... is variably  subnetted, 2 subnets, 2 masks
D [90/4879540] via
D  [90/25789217] via
S* [1/0] via  
Remembering that the network includes the addresses through, and the network includes the addresses through, we can then try switching three packets through this routing table and see what the results are.
  • A packet destined to is forwarded to, since this is the longest prefix match.
  • A packet destined to is forwarded to, since this is the longest prefix match.
  • A packet destined to is forwarded to; since this network doesn't exist in the routing table, this packet is forwarded to the default route.
  • A packet destined to is dropped.
The surprising answer out of these four is the last packet, which is dropped. It's dropped because its destination,, is within a known major network,, but the router doesn't know about this particular subnet within that major network.
This is the essence of classful routing: If one part of a major network is known, but the subnet toward which the packet is destined within that major network is unknown, the packet is dropped.
The most confusing aspect of this rule is that the router only uses the default route if the destination major network doesn't exist in the routing table at all.
This can cause problems in a network where a remote site, with one connection back to the rest of the network, is running no routing protocols, as illustrated.
The remote site router is configured like this:
interface Serial 0
     ip address
   interface Ethernet 0
     ip address
   ip route
   no ip classless
With this configuration, the hosts at the remote site can reach destinations on the Internet (through the 10.x.x.x cloud), but not destinations within the 10.x.x.x cloud, which is the corporate network. Because the remote router knows about some part of the network, the two directly connected subnets, and no other subnet of 10.x.x.x, it assumes these other subnets don't exist and drops any packets destined for them. Traffic destined to the Internet, however, doesn't ever have a destination in the 10.x.x.x range of addresses, and is therefore correctly routed through the default route.
Configuring ip classless on the remote router resolves this problem by allowing the router to ignore the classful boundaries of the networks in its routing table and simply route to the longest prefix match it can find.
info source:

No comments:

Post a Comment