Classful Versus Classless Route Lookup

To route a packet, all routers must extract the destination IP address in the packet header. Older (or “classful”) routers take this address and compute its major Class A, B, or C network number (for example, the address 172.16.1.1 belongs to the major network 172.16.0.0). This major network number is matched in the routing table. If there is no matching major network number (and there is no default route in the routing table), the packet is dropped. If there is a match against the major network number, the router proceeds to match the subnet field. If there is no matching subnet field in the routing table, the packet is dropped. If there is a matching subnet field, the packet is routed as specified in the route entry. This “classful” routing behavior is described in more detail in Chapter 3.

Classless route lookups also refer to the destination IP address in the packet header. However, classless route lookups do not compute the major Class A, B, or C network number for the destination IP address. Instead, classless routing protocols use a rule called longest prefix match . By this rule, the destination IP address from the packet header is matched bit-by-bit against every destination IP address in the routing table. The route entry that has the longest bitwise match with the destination IP address is chosen for routing the packet.

To turn on classless route lookups, enter the following command in global configuration mode:

ip classless

To turn ...

Get IP Routing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.