Tuesday, 7 February 2012

Classful vs Classless Packet Forwarding


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.

router# show ip route
....
     172.30.0.0/16 is variably  subnetted, 2 subnets, 2 masks
D        172.30.32.0/20 [90/4879540] via  10.1.1.2
D       172.30.32.0/24  [90/25789217] via 10.1.1.1
S*   0.0.0.0/0 [1/0] via 10.1.1.3  
Remembering that the 172.30.32.0/24 network includes the addresses 172.30.32.0 through 172.30.32.255, and the 172.30.32.0/20 network includes the addresses 172.30.32.0 through 172.30.47.255, we can then try switching three packets through this routing table and see what the results are.
  • A packet destined to 172.30.32.1 is forwarded to 10.1.1.1, since this is the longest prefix match.
  • A packet destined to 172.30.33.1 is forwarded to 10.1.1.2, since this is the longest prefix match.
  • A packet destined to 192.168.10.1 is forwarded to 10.1.1.3; since this network doesn't exist in the routing table, this packet is forwarded to the default route.
  • A packet destined to 172.30.254.1 is dropped.
The surprising answer out of these four is the last packet, which is dropped. It's dropped because its destination, 172.30.254.1, is within a known major network, 172.30.0.0/16, 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.

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.

Source: http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094823.shtml

No comments:

Post a Comment