lunedì 27 giugno 2011

The Routing Table: A Closer Look

In this chapter, we will be using a simple three router network, as shown in the figure. R1 and R2 share a common 172.16.0.0/16 network with 172.16.0.0/24 subnets. R2 and R3 are connected by the 192.168.1.0/24 network. Notice that R3 also has a 172.16.4.0/24 subnet that is disconnected, or discontiguous, from the 172.16.0.0 network that R1 and R2 share. The effects of this discontiguous subnet will be examined later in this chapter when we look at the route lookup process.



Parent and Child Routes: Classful Networks

The figure shows the configuration of the 172.16.3.1/24 interface on R2 and the output from the show ip route command. Notice that there are actually two additional entries in the routing table. One entry is the parent route and the other entry is the child route


When the 172.16.3.0 subnet was added to the routing table, another route, 172.16.0.0, was also added. The first entry, 172.16.0.0/24, does not contain any next-hop IP address or exit interface information. This route is known as a level 1 parent route. Level 2 child routes are also considered ultimate routes because they will contain the next-hop IP address and/or exit interface. A level 1 parent route exists only when there is at least one level 2 child route.

A level 1 parent route is a network route that does not contain a next-hop IP address or exit interface for any network. A parent route is actually a heading that indicates the presence of level 2 routes, also known as child routes. A level 1 parent route is automatically created any time a subnet is added to the routing table. In other words, a parent route is created whenever a route with a mask greater than the classful mask is entered into the routing table. The subnet is the level 2 child route of the parent route. In this case, the level 1 parent route that was automatically created is:

172.16.0.0/24 is subnetted, 1 subnets

A level 2 route is a route that is a subnet of a classful network address. Like a level 1 route, the source of a level 2 route can be a directly connected network, a static route, or a dynamic routing protocol. In this case, the level 2 route is the actual subnet route that was added to the network when we configured the FastEthernet 0/0 interface:

C 172.16.3.0 is directly connected, FastEthernet0/0

Parent and Child Routes: Classless Networks

For this discussion, we will use the topology shown in the figure. Using RouterX with the VLSM configuration shown, we can examine the effect of VLSM on the routing table. RouterX has three directly connected networks. All three subnets belong to the classful network 172.16.0.0/16 and are therefore level 2 child routes.
 


Regardless of the addressing scheme used by the network (classless or classful), the routing table will use a classful scheme.

There are several distinct differences with this parent route and its child routes compared to the classful example discussed earlier. First, the parent route of 172.16.0.0 now contains the classful mask /16. In the classful example earlier, the classful mask was not displayed.

Also notice that the parent route states that the child routes are "variably subnetted". Like the classful example, the parent route displays the number of subnets, but now it also includes the number of different masks of the child routes.

The final difference between classful and classless networks exists in the child routes. Each child route now contains the subnet mask for that specific route. In the non-VLSM example, both child routes shared the same subnet mask and the parent displayed their common subnet mask. With VLSM, the various subnet masks are displayed with the specific child routes.

Steps in the Route Lookup Process

Let's examine in more depth how the routers determine the best routes to use when sending packets and why classful routing protocols do not work with discontiguous designs.

The best match or longest match is the route in the routing table that has the most number of left-most matching bits with the destination IP address of the packet. The route with the most number of equivalent left-most bits, or the longest match, is always the preferred route. For example, in the figure we have a packet destined for 172.16.0.10. Many possible routes could match this packet. Three possible routes are shown that do match this packet: 172.16.0.0/12, 172.16.0.0/18, and 172.16.0.0/26. Of the three routes, 172.16.0.0/26 has the longest match. Remember, for any of these routes to be considered a match there must be at least the number of matching bits indicated by the subnet mask of the route.


Example:

In this example, there is a match between the destination IP address 192.168.1.0 and the level 1 ultimate route 192.168.1.0/24. Because there is not a longer, more specific match, the packet is forwarded out the exit interface Serial 0/0/0.



Classful and Classless Routing Behavior

The next step in the route lookup process (Step 3) looks at routing behavior. Routing behavior influences the process of searching for the preferred route using the no ip classless or ip classless commands.

Classless and classful routing behaviors are not the same as classless and classful routing protocols. Classful and classless routing protocols affect how the routing table is populated. Classful and classless routing behaviors determine how the routing table is searched after it is populated. In the figure, the routing sources (including classful and classless routing protocols) are the inputs used to populate the routing table. The routing behavior, specified by the ip classless or no ip classless commands, determines how the route lookup process will proceed at Step 3.

As you can see, routing protocols and routing behaviors are completely independent of each other. The routing table could be populated with routes from a classless routing protocol like RIPv2 yet implement classful routing behavior because the no ip classless command is configured.


Prior to IOS 11.3, no ip classless was the default behavior for Cisco routers. The command no ip classless means that the route lookup process uses classful routing table lookups by default. The commands no ip classless and ip classless are global configuration commands and can be viewed by typing show running-config. In IOS versions 11.3 and later, the command ip classless is the default, implementing a classless route lookup process.

Classful Routing Behavior - Search Process

In our routing table lookup process, when classful routing behavior is in effect (no ip classless) the process will not continue searching level 1 routes in the routing table. If a packet doesn't match a child route for the parent network route, then the router drops the packet. Let's see an example.



In this example, R2 receives a packet destined for PC3 at 172.16.4.10. The routing process searches the routing table and finds a 16-bit match with the parent route 172.16.0.0, as shown in the figure. If a match is made in the parent route, the child routes are checked. Now let's look at the actual bit-matching process that is taking place as the child routes are checked.

Notice that none of the 24 left-most bits of the child routes matches the destination IP address of 172.16.4.10. At most, only 21 bits match. There is no match with the level 2 child routes. So what happens next? Router R2 drops the packet.

Because router R2 is using classful routing behavior, no ip classless, the router will not search beyond the child routes for a lesser match

The routing table process will not use the default route, 0.0.0.0/0, or any other route.

A common error is to assume that a default route will always be used if the router does not have a better route. In our example, R2's default route is not examined nor used, although it is a match.

Classless Routing Behavior - Search Process

Starting with IOS 11.3, Cisco changed the default routing behavior from classful to classless. The ip classless command is configured by default. The show running-config command displays the routing behavior. Classless routing behavior means that the routing process no longer assumes that all subnets for a major classful network can only be reached within the child routes of the parent. Classless routing behavior works well for discontiguous networks and CIDR supernets.

Let's revisit our sample topology and look at the bit matching that happens when classless routing behavior (ip classless) is in effect.


Again, R2 receives a packet destined for PC3 at 172.16.4.10. Just as it did with the classful routing behavior, the router searches the routing table and finds a 16-bit match with the parent route 172.16.0.0 as shown in the last figure. If there is a match with a parent route, then the child routes are checked. As before, none of the 24 left-most bits of the child routes matches the destination IP address of 172.16.4.10. At most, only 21 bits match. There is no match with the level 2 child routes.

Because we are using classless routing behavior (ip classless), the router continues searching the routing table, beyond this parent route and its child routes. The routing process will continue to search the routing table for a route with a subnet mask fewer than the 16 bits of the previous parent route. In other words, the router will now continue to search the other routes in the routing table where there may be fewer bits that match, but still a match.

How about the default route? How many bits need to match?

S* 0.0.0.0/0 is directly connected, Serial0/0/1

The mask is /0, which means that zero or no bits need to match. A default route will be the lowest-bit match. In classless routing behavior, if no other route matches, the default route will match. In this case the router will use the default route, because it is the best match. The packet will be forwarded out the Serial 0/0/1 interface.

Conclusion

Remember that classful and classless routing behaviors are independent from classful and classless routing protocols. A router could be configured with classful routing behavior (no ip classless) and a classless routing protocol, such as RIPv2. A router could also be configured with classless routing behavior (ip classless) and a classful routing protocol, such as RIPv1.

In today's networks, it is recommended to use classless routing behavior so that supernet and default routes can be used whenever needed.

In this chapter, you learned that there are level 1 and level 2 routes. A level 1 route can be either an ultimate route or a parent route. A level 1 ultimate route is a route with a subnet mask equal to, or less than the default classful mask of the network; and either a next hop address or an exit interface. For example, a route learned through RIP with the network address of 192.168.1.0 and a /24 network mask is a level 1 ultimate route. These routes are displayed in the routing table as a single route entry, such as:

R 192.168.1.0/24 [120/1] via 172.16.2.2, 00:00:25, Serial0/0/0

Another type of level 1 route is a parent route. A level 1 parent route is automatically created when a subnet route is added to the routing table.

The subnet route is known as a level 2 child route. The parent route is a header for level 2 child routes. Here is an example of a level 1 parent route and a level 2 child route:

172.16.0.0/24 is subnetted, 1 subnets
R 172.16.1.0 [120/1] via 172.16.2.1, 00:00:07, Serial0/0/0


The subnet mask of the child routes are displayed in the parent route unless VLSM is used. With VLSM, the parent route displays the default classful mask and the subnet mask is included with the individual VLSM route entries.

Before examining any level 2 child routes (subnets) for a match there must first be a match with the level 1 parent route. The classful mask of the parent determines how many bits must match the parent route. If there is a match with the parent route, then the child routes will be searched for a match.

What happens when there is a match with the parent route but none of the child routes? If the router is using classful routing behavior, no other routes will be searched and the packet will be discarded. Classful routing behavior was the default routing behavior on Cisco routers prior to IOS 11.3. Classful routing behavior can be implemented using the no ip classless command.

Starting with IOS 11.3 classless routing behavior became the default. If there is a match with a parent route but none of the child routes, the routing table process will continue to search other routes in the routing table including a default route should one exist. Classless routing behavior is implemented by using the ip classless command.

Nessun commento:

Posta un commento