Classless Routing

Classless routing features two aspects:

• Classlessness can be a characteristic of a routing protocol.

• Classlessness can be a characteristic of a router.

Classless routing protocols carry, as part of the routing information, a description of the network portion of each advertised address. The network portion of a network address is commonly referred to as the address prefix. An address prefix can be described by including an address mask, a length field that indicates how many bits of the address are prefix bits, or by including only the prefix bits in the update (see Figure 2-2). The classless IP routing protocols are RIP-2, EIGRP, OSPF, Integrated IS-IS, and BGP-4.

Figure 2-2 Advertising an Address Prefix with a Classless Routing Protocol

Figure 2-2 Advertising an Address Prefix with a Classless Routing Protocol

22 bits

A classful router records destination addresses in its routing table as major class networks and subnets of those networks. When it performs a route lookup, it first looks up the major class network address and then tries to find a match in its list of subnets under that major address. A classless router ignores address classes and merely attempts a "longest match." That is, for any given destination address, it chooses the route that matches the most bits of the address. Take the routing table of Example 2-1, for instance, which shows several variably subnetted IP networks. If the router is classless, it attempts to find the longest match for each destination address.

Example 2-1 A Routing Table Containing Several Variably Subnetted IP Networks

Cleveland#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, 0 - OSPF, IA - OSPF inter area E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate default

Gateway of last resort is 192.168.2.130 to network 0.0.0.0

0 E2 192.168.125.0 [110/20] via 192.168.2.2, 00:11:19, Ethernet© 0 192.168.75.0 [110/74] via 192.168.2.130, 00:11:19, Serial© 0 E2 192.168.8.0 [110/40] via 192.168.2.18, 00:11:19, Ethernetl

192.168.1.0 is variably subnetted, 3 subnets, 3 masks 0 E1 192.168.1.64 255.255.255.192

[110/139] via 192.168.2.134, 00:11:20, Seriall 0 E1 192.168.1.0 255.255.255.128

[110/139] via 192.168.2.134, 00:00:34, Seriall 0 E2 192.168.1.0 255.255.255.0

[110/20] via 192.168.2.2, 00:11:20, Ethernet© 192.168.2.0 is variably subnetted, 4 subnets, 2 masks C 192.168.2.0 255.255.255.240 is directly connected, Ethernet©

C 192.168.2.16 255.255.255.240 is directly connected, Ethernetl

C 192.168.2.128 255.255.255.252 is directly connected, Serial0

Example 2-1 A Routing Table Containing Several Variably Subnetted IP Networks (Continued)

C 192.168.2.132 255.255.255.252 is directly connected, Seriall

0 E2 192.168.225.0 [110/20] via 192.168.2.2, 00:11:20, Ethernet©

0 E2 192.168.230.0 [110/20] via 192.168.2.2, 00:11:21, Ethernet©

0 E2 192.168.198.0 [110/20] via 192.168.2.2, 00:11:21, Ethernet©

0 E2 192.168.215.0 [110/20] via 192.168.2.2, 00:11:21, Ethernet0

0 E2 192.168.129.0 [110/20] via 192.168.2.2, 00:11:21, Ethernet©

0 E2 192.168.131.0 [110/20] via 192.168.2.2, 00:11:21, Ethernet0

0 E2 192.168.135.0 [110/20] via 192.168.2.2, 00:11:21, Ethernet©

0*E2 0.0.0.0 0.0.0.0 [110/1] via 192.168.2.130, 00:11:21, Serial0

0 E2 192.168.0.0 255.255.0.0 [110/40] via 192.168.2.18, 00:11:22, Ethernetl

Cleveland#

If the router receives a packet with a destination address of 192.168.1.75, several entries in the routing table match the address: 192.168.0.0/16, 192.168.1.0/24, 192.168.1.0/25, and 192.168.1.64/26. The entry 192.168.1.64/26 is chosen (see Example 2-2) because it matches 26 bits of the destination address—the longest match.

Example 2-2 A Packet with a Destination Address of 192.168.1.75 Is Forwarded Out Interface SI

Cleveland#show ip route 192.168.1.75

Routing entry for 192.168.1.64 255.255.255.192

Known via "ospf 1", distance 110, metric 139, type extern 1

Redistributing via ospf 1

Routing Descriptor Blocks:

* 192.168.2.134, from 192.168.7.1, 06:46:52 ago, via Seriall

Route metric is 139, traffic share count is 1

A packet with a destination address of 192.168.1.217 will not match 192.168.1.64/26, nor will it match 192.168.1.0/25. The longest match for this address is 192.168.1.0/24, as demonstrated in Example 2-3.

Example 2-3 The Router Cannot Match 192.168.1.217 to a More-Specific Subnet, So It Matches the Network Address 192.168.1.0/24

Cleveland#show ip route 192.168.1.217

flouting entry for 192.168,1.0 255.255.256.0

Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 10 Redistributing via ospf 1

RoutingDescriptor Blocks:

* 192.168.2.2, from 10.2.1.1, 06:48:18 ago, via Ethernet© Route metric is 20, traffic share count is 1

The longest match that can be made for destination address 192.168.5.3 is the aggregate address 192.168.0.0/16, as demonstrated in Example 2-4.

Example 2-4 Packets Destined for 192.168.5.3 Do Not Match a More-Specific Subnet or Network, and Therefore Match the Supernet 192.168.0.0/16

Cleveland#show ip route 192.168.5.3

Routing entry for 192.166.0.0 255,256,0.0, supernet

Known via "ospf 1", distance 110, metric 139, type extern 1 Redistributing via ospf 1

Routing Descriptor Blocks:

* 192.168.2.18, from 192.168.7.1, 06:49:26 ago, via Ethernetl Route metric is 139, traffic share count is 1

Finally, a destination address of 192.169.1.1 will not match any of the network entries in the routing table, as demonstrated in Example 2-5. However, packets with this destination address are not dropped, because the routing table of Example 2-1 contains a default route. The packets are forwarded to next-hop router 192.168.2.130.

Example 2-5 No Match Is Found in the Routing Table for 192.169.1.1; Packets Destined for This Address Are Forwarded to the Default Address, Out Interface SO

Cleveland#show ip route 192.169.1.1

% Network not in table

Beginning with IOS 11.3, Cisco routers are classless by default. Prior to this release, the IOS defaults were classful. You can change the default with the ip classless command.

The routing table in Example 2-1 and the associated examples demonstrates another characteristic of longest-match routing. Namely, a route to an aggregate address does not necessarily point to every member of the aggregate. Figure 2-3 shows the vectors of the routes in Examples 2-2 through 2-5.

Figure 2-3 The Vectors of Routes in the Routing Table of Example 2-1

192.168.0.0/16 via

192.168.2.18

192.168.0.0/16 via

192.168.2.18

192.168.2.130

192.168.1.0/24 via

192.168.2.2

192.168.2.130

192.168.1.0/24 via

192.168.2.2

You can consider network 192.168.1.0/24 an aggregate of all its subnets; Figure 2-3 shows that the route to this network address directs packets out interface E0. Yet routes to two of its subnets, 192.168.1.0/25 and 192.168.1.64/26, point out a different interface, SI.

NOTE In fact, 192.168.1.64/26 is itself a member of 192.168.1.0/25. The fact that there are distinct routes for these two addresses, both pointing out S1, hints that they are advertised by separate routers somewhere upstream.

Likewise, 192.168.1.0/24 is a member of the aggregate 192.168.0.0/16, but the route to that less-specific address is out El. The least-specific route, 0.0.0.0/0, which is an aggregate of all other addresses, is out SO. Because of longest-match routing, packets to subnets 192.168.1.64/26 and 192.168.1.0/25 are forwarded out SI, whereas packets to other subnets of network 192.168.1.0/24 are forwarded out E0. Packets with destination addresses beginning with 192.168, other than 192.168.1, are forwarded out El, and packets whose destination addresses do not begin with 192.168 are forwarded out SO.

Was this article helpful?

0 0
100 SEO Tips

100 SEO Tips

100 SEO Tips EVERY SEO Enthusiast Should Know. This Report 100 SEO Tips will help you to Utilize These Tips to Dominate The Search Engine Today.

Get My Free Ebook


Post a comment