Routing Table : closer look w.lilakiatsakun Sample Routing Table Output Interface or next hop IP Static Route Dynamic Routing Protocol (RIP) Directly Connected Network Administrative Distance/Metric Routing Table structure Insert Routing Table Level 1 Routes (1) • A level 1 route is a route with a subnet mask equal to or less than the classful mask of the network address. – 192.168.1.0/24 is a level 1 network route, because the subnet mask is equal to the network's classful mask. – /24 is the classful mask for class C networks, such as the 192.168.1.0 network. Level 1 Routes (2) • Default route - A default route is a static route • • • with the address 0.0.0.0/0. Supernet route - A supernet route is a network address with a mask less than the classful mask. Network route - A network route is a route that has a subnet mask equal to that of the classful mask. The source of the level 1 route can be a directly connected network, static route, or a dynamic routing protocol. Level 1 Routes (3) • The level 1 route 192.168.1.0/24 can be further • defined as an ultimate route. An ultimate route is a route that includes: – a next-hop IP address (another path) – an exit interface • The directly connected network 192.168.1.0/24 is a • level 1 network route because it has a subnet mask that is the same as its classful mask. This same route is also an ultimate route because it contains the exit interface Serial 0/0/1. Parent and child Routes :Classful Network (1) Parent Routes Child Routes Parent and child Routes :Classful Network (2) • 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 parent route is created whenever a route with a mask greater than the classful mask is entered into the routing table (subnetting). The subnet is the level 2 child route of the parent route. Parent and child Routes :Classful Network (3) • 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. Parent and child Routes :Classful Network (4) • Level 1 Parent Route contains the following • • • • information : 172.16.0.0 - The classful network address for our subnet. /24 - The subnet mask for all of the child routes. If the child routes have variable length subnet masks (VLSM), the subnet mask will be excluded from the parent route and included with the individual child routes. is subnetted, 1 subnet - This part of the route specifies that this is a parent route and in this case has one child route, that is, 1 subnet. Parent and child Routes :Classful Network (5) • Level 2 Child Route contains the following • • • • information: C - The route code for directly connected network. 172.16.3.0 - The specific route entry. is directly connected - Along with the route code of C, this specifies that this is a directly connected network with an administrative distance of 0. FastEthernet0/0 - The exit interface for forwarding packets that match this specific route entry. Parent and child Routes :Classless Network Routing Table Look up Process (1) The router examines level 1 routes, including network routes and supernet routes, for the best match with the destination address of the IP packet. Routing Table Look up Process (2) If the best match is a level 1 ultimate route - a classful network, supernet, or default route - this route is used to forward the packet. Routing Table Look up Process (3) If the best match is a level 1 parent route, proceed to Step 2. Routing Table Look up Process (4) The router examines child routes (the subnet routes) of the parent route for a best match Routing Table Look up Process (5) If there is a match with a level 2 child route, that subnet will be used to forward the packet. Routing Table Look up Process (6) If there is not a match with any of the level 2 child routes, proceed to Step 3. Routing Table Look up Process (7) Is the router implementing classful or classless routing behavior? Routing Table Look up Process (8) Classful routing behavior: If classful routing behavior is in effect, terminate the lookup process and drop the packet. Routing Table Look up Process (9) Classless routing behavior: If classless routing behavior is in effect, continue searching level 1 supernet routes in the routing table for a match, including the default route, if there is one. Routing Table Look up Process (10) If there is now a lesser match with a level 1 supernet or default routes, the router uses that route to forward the packet. Routing Table Look up Process (11) If there is not a match with any route in the routing table, the router drops the packet. Longest Match: Level 1 Network Routes • 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. The router first examines level 1 routes for the best match. In our example, there is a match between the destination IP address 192.168.1.2 and the level 1 ultimate route of 192.168.1.0/24. R 192.168.1.0/24 [120/1] via 172.16.2.2, 00:00:25, Serial0/0/0 R1 uses this route and forwards the packet out interface Serial 0/0/0. Longest Match: Level 1 Parent and Level 2 child routes (1) Longest Match: Level 1 Parent and Level 2 child routes (2) • The first match that occurs is with the level 1 • • parent route, 172.16.0.0. Remember, with non-VLSM subnets the classful mask of the parent is now displayed. Before any child routes (subnets) are examined for a match, there must first be a match with the classful address of the parent route. • Because the first route entry is a level 1 parent route that matches the destination address (Step 1b of the route lookup process), the route lookup process moves to Step 2. Longest Match: Level 1 Parent and Level 2 child routes (3) • Because there is a match with the parent route, the level 2 child routes will be examined for a match. • However, this time the actual subnet mask of /24 is used for the minimum number of left-most bits that must match. Route look up with VLSM (1) Route look up with VLSM (2) • As with non-VLSM networks, if there is a match between the packet's destination IP address and the classful mask of the level 1 parent route, the level 2 child routes will be searched. • The only difference with VLSM is that child routes display • • their own specific subnet masks. These subnet masks are used to determine the number of left-most bits that must match the packet's destination IP address. For example, for there to be a match with the 172.16.1.4 child route, a minimum of 30 left-most bits must match because the subnet mask is /30. Routing behavior (1) • 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. Routing behavior (2) • 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. Classful Routing Behavior (1) Classful Routing Behavior (2) Classful Routing Behavior (3) Classful Routing Behavior (4) Classful Routing Behavior (5) • Because router R2 is using classful routing behavior, no ip classless, the router will not search beyond the child routes for a lesser match. Classful Routing Behavior (6) • 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 the example, R2's default route is not examined nor used, although it is a match. This is often a very surprising result when a network administrator does not understand the difference between classful and classless routing behavior. Classless Routing Behavior (1) Classless Routing Behavior (2) Is the router implementing classful or classless routing behavior? Classless Routing Behavior (3) Classful routing behavior: If classful routing behavior is in effect, terminate the lookup process and drop the packet. Classless Routing Behavior (4) Classless routing behavior: If classless routing behavior is in effect, continue searching level 1 supernet routes in the routing table for a match, including the default route, if there is one. Classless Routing Behavior (5) If there is now a lesser match with a level 1 supernet or default routes, the router uses that route to forward the packet. Classless Routing Behavior (6) If there is not a match with any route in the routing table, the router drops the packet. Classless Routing Behavior (7) Classless Routing Behavior (8) Classless Routing Behavior (9) Classless Routing Behavior (10) Classless Routing Behavior (11) Classless Routing Behavior (12) • Because we are using classless routing behavior (ip classless), the router continues searching the routing table, beyond this parent route and its child routes. Classless Routing Behavior (13) • 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. Classless Routing Behavior (14) • 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. Classful VS Classless routing behavior in the real world • 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.