The Routing Table (3.5)
As a network administrator, it is important to know the routing table in depth when troubleshooting network issues. Understanding the structure and lookup process of the routing table will help you diagnose any routing table issue, regardless of your level of familiarity with a particular routing protocol. For example, you might encounter a situation in which the routing table has all of the routes you would expect to see, but packet forwarding is not performing as expected. Knowing how to step through the lookup process of a destination IP address for a packet will enable you to determine whether the packet is being forwarded as expected, if and why the packet is being sent elsewhere, or whether the packet has been discarded.
Parts of an IPv4 Route Entry (3.5.1)
A routing table consists of directly connected networks and routes learned statically or dynamically. This section examines these two types of routing table entries.
Routing Table Entries (3.5.1.1)
The topology displayed in Figure 3-50 is used as the reference topology for this section.
Figure 3-50 Reference Topology
Notice that in the topology:
- R1 is the edge router that connects to the Internet. Therefore, it is propagating a default static route to R2 and R3.
- R1, R2, and R3 contain discontiguous networks separated by another classful network.
- R3 is also introducing a 192.168.0.0/16 supernet route.
Figure 3-51 displays the IPv4 routing table of R1 with directly connected, static, and dynamic routes.
Figure 3-51 Routing Table of R1
Directly Connected Entries (3.5.1.2)
As highlighted in Figure 3-52, the routing table of R1 contains three directly connected networks. Notice that two routing table entries are automatically created when an active router interface is configured with an IP address and subnet mask.
Figure 3-52 Directly Connected Interfaces of R1
Figure 3-53 displays one of the routing table entries on R1 for the directly connected network 172.16.1.0. These entries were automatically added to the routing table when the GigabitEthernet 0/0 interface was configured and activated.
Figure 3-53 Directly Connected Routes of R1
The entries contain the following information:
- Route source: Identifies how the route was learned. Directly connected interfaces have two route source codes. C identifies a directly connected network. Directly connected networks are automatically created whenever an interface is configured with an IP address and activated. L identifies that this is a local route. Local routes are automatically created whenever an interface is configured with an IP address and activated.
- Destination network: The address of the remote network and how that network is connected.
- Outgoing interface: Identifies the exit interface to use when forwarding packets to the destination network.
A router typically has multiple interfaces configured. The routing table stores information about both directly connected and remote routes. As with directly connected networks, the route source identifies how the route was learned. For instance, common codes for remote networks include:
- S: Identifies that the route was manually created by an administrator to reach a specific network. This is known as a static route.
- D: Identifies that the route was learned dynamically from another router using the EIGRP routing protocol.
- O: Identifies that the route was learned dynamically from another router using the OSPF routing protocol.
- R: Identifies that the route was learned dynamically from another router using the RIP routing protocol.
Remote Network Entries (3.5.1.3)
Figure 3-54 displays an IPv4 routing table entry on R1 for the route to remote network 172.16.4.0 on R3.
Figure 3-54 Remote Network Route Entry on R1
The entry identifies the following information:
- Route source: Identifies how the route was learned.
- Destination network: Identifies the address of the remote network.
- Administrative distance: Identifies the trustworthiness of the route source.
- Metric: Identifies the value assigned to reach the remote network. Lower values indicate preferred routes.
- Next hop: Identifies the IPv4 address of the next router to forward the packet to.
- Route timestamp: Identifies from when the route was last heard.
- Outgoing interface: Identifies the exit interface to use to forward a packet toward the final destination.
Dynamically Learned IPv4 Routes (3.5.2)
The structure or format of the routing table might seem obvious until you take a closer look. Understanding the structure of the routing table will help you verify and troubleshoot routing issues because you will understand the routing table lookup process.
Routing Table Terms (3.5.2.1)
A dynamically built routing table provides a great deal of information, as shown in Figure 3-55. Therefore, it is crucial to understand the output generated by the routing table. Special terms are applied when discussing the contents of a routing table.
Figure 3-55 Routing Table of R1
The Cisco IP routing table is not a flat database. The routing table is actually a hierarchical structure that is used to speed up the lookup process when locating routes and forwarding packets. Within this structure, the hierarchy includes several levels.
Routes are discussed in terms of:
- Ultimate route
- Level 1 route
- Level 1 parent route
- Level 2 child routes
Ultimate Route (3.5.2.2)
An ultimate route is a routing table entry that contains either a next-hop IPv4 address or an exit interface. Directly connected, dynamically learned, and local routes are ultimate routes.
In Figure 3-56, the highlighted areas are examples of ultimate routes. Notice that all of these routes specify either a next-hop IPv4 address or an exit interface.
Figure 3-56 Ultimate Routes of R1
Level 1 Route (3.5.2.3)
A level 1 route is a route with a subnet mask equal to or less than the classful mask of the network address. Therefore, a level 1 route can be a:
- Network route: A network route has a subnet mask equal to that of the classful mask.
- Supernet route: A supernet route is a network address with a subnet mask less than the classful mask, for example, a summary address.
- Default route: A default route is a static route with the address 0.0.0.0/0.
The source of the level 1 route can be a directly connected network, static route, or a dynamic routing protocol.
Figure 3-57 highlights how level 1 routes are also ultimate routes.
Figure 3-57Sources of Level 1 Routes
Figure 3-58 highlights level 1 routes.
Figure 3-58 Example of Level 1 Routes
Level 1 Parent Route (3.5.2.4)
As illustrated in Figure 3-59, a level 1 parent route is a level 1 network route that is subnetted. A parent route can never be an ultimate route.
Figure 3-59 Level 1 Parent Route
Figure 3-60 highlights the level 1 parent routes in the routing table of R1. The routing table basically provides a heading for the specific subnets it contains. Each entry displays the classful network address, the number of subnets, and the number of different subnet masks that the classful address has been subdivided into.
Figure 3-60 Level 1 Parent Routes of R1
Level 2 Child Route (3.5.2.5)
A level 2 child route is a route that is a subnet of a classful network address. As illustrated in Figure 3-61, a level 1 parent route is a level 1 network route that is subnetted.
Figure 3-61 Level 2 Child Routes
A level 1 parent route contains level 2 child routes, as shown in Figure 3-62.
Figure 3-62 Child Routes Are Ultimate Routes
Like a level 1 route, the source of a level 2 route can be a directly connected network, a static route, or a dynamically learned route. Level 2 child routes are also ultimate routes.
Figure 3-63 highlights the level 2 child routes in the routing table of R1.
Figure 3-63 Example of Level 2 Child Routes
The IPv4 Route Lookup Process (3.5.3)
Now that you understand the structure of the routing table, this section will help you understand the routing table lookup process.
Route Lookup Process (3.5.3.1)
When a packet arrives on a router interface, the router examines the IPv4 header, identifies the destination IPv4 address, and proceeds through the router lookup process.
In Figure 3-64, the router examines level 1 network routes for the best match with the destination address of the IPv4 packet.
Figure 3-64 Match Level 1 Routes
Specifically, the router proceeds as follows:
- If the best match is a level 1 ultimate route, then this route is used to forward the packet.
If the best match is a level 1 parent route, proceed to the next step.
In Figure 3-65, the router examines child routes (the subnet routes) of the parent route for a best match.
Figure 3-65 Match Level 2 Child Routes
- If there is a match with a level 2 child route, that subnet is used to forward the packet.
If there is not a match with any of the level 2 child routes, proceed to the next step.
In Figure 3-66, the router continues searching level 1 supernet routes in the routing table for a match, including the default route, if there is one.
Figure 3-66 Match Supernet and Then Default Route
- If there is now a lesser match with a level 1 supernet or default routes, the router uses that route to forward the packet.
- If there is not a match with any route in the routing table, the router drops the packet.
Best Route = Longest Match (3.5.3.2)
What is meant by the router must find the best match in the routing table? Best match is equal to the longest match.
For there to be a match between the destination IPv4 address of a packet and a route in the routing table, a minimum number of far left bits must match between the IPv4 address of the packet and the route in the routing table. The subnet mask of the route in the routing table is used to determine the minimum number of far left bits that must match. Remember that an IPv4 packet only contains the IPv4 address and not the subnet mask.
The best match is the route in the routing table that has the most number of far left matching bits with the destination IPv4 address of the packet. The route with the greatest number of equivalent far left bits, or the longest match, is always the preferred route.
In Figure 3-67, a packet is destined for 172.16.0.10.
The router has three possible routes that 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 and is therefore chosen to forward the packet. 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.
Figure 3-67 Matches for Packets Destined to 172.16.0.10
Analyze an IPv6 Routing Table (3.5.4)
The IPv6 routing table shares many similarities with the IPv4 routing table. It also consists of directly connected networks and routes learned statically or dynamically. However, the entries are displayed somewhat differently than IPv4 entries. This section examines the IPv6 routing table.
IPv6 Routing Table Entries (3.5.4.1)
Components of the IPv6 routing table are very similar to the IPv4 routing table. For instance, it is populated using directly connected interfaces, static routes, and dynamically learned routes.
Because IPv6 is classless by design, all routes are effectively level 1 ultimate routes. There is no level 1 parent of level 2 child routes.
The topology displayed in Figure 3-68 is used as the reference topology for this section.
Figure 3-68 Reference IPv6 Topology
Notice that in the topology:
- R1, R2, and R3 are configured in a full mesh topology. All routers have redundant paths to various networks.
- R2 is the edge router and connects to the ISP; however, a default static route is not being advertised.
- EIGRP for IPv6 has been configured on all three routers.
Directly Connected Entries (3.5.4.2)
The routing table of R1 is displayed in Figure 3-69 using the show ipv6 route command. Although the command output is displayed slightly differently than in the IPv4 version, it still contains the relevant route information.
Figure 3-69 IPv6 Routing Table of R1
Figure 3-70 highlights the connected network and local routing table entries of the directly connected interfaces. The three entries were added when the interfaces were configured and activated.
Figure 3-70 Directly Connected Routes on R1
As shown in Figure 3-71, directly connected route entries display the following information:
- Route source: Identifies how the route was learned. Directly connected interfaces have two route source codes (C identifies a directly connected network while L identifies that this is a local route).
- Directly connected network: The IPv6 address of the directly connected network.
- Administrative distance: Identifies the trustworthiness of the route source. IPv6 uses the same distances as IPv4. A value of 0 indicates the best, most trustworthy source.
- Metric: Identifies the value assigned to reach the remote network. Lower values indicate preferred routes.
Outgoing interface: Identifies the exit interface to use when forwarding packets to the destination network.
Figure 3-71 Directly Connected Routes on R1
Remote IPv6 Network Entries (3.5.4.3)
Figure 3-72 highlights the routing table entries for the three remote networks (i.e., R2 LAN, R3 LAN, and the link between R2 and R3). The three entries were added by the EIGRP.
Figure 3-72 Remote Networks Entries on R1
Figure 3-73 displays a routing table entry on R1 for the route to remote network 2001:DB8:CAFE:3::/64 on R3.
Figure 3-73 Remote Networks Entries on R1
The entry identifies the following information:
- Route source: Identifies how the route was learned. Common codes include O (OSPF), D (EIGRP), R (RIP), and S (Static route).
- Destination network: Identifies the address of the remote IPv6 network.
- Administrative distance: Identifies the trustworthiness of the route source. IPv6 uses the same distances as IPv4.
- Metric: Identifies the value assigned to reach the remote network. Lower values indicate preferred routes.
- Next hop: Identifies the IPv6 address of the next router to forward the packet to.
- Outgoing interface: Identifies the exit interface to use to forward a packet toward the final destination.
When an IPv6 packet arrives on a router interface, the router examines the IPv6 header and identifies the destination IPv6 address. The router then proceeds through the following router lookup process.
The router examines level 1 network routes for the best match with the destination address of the IPv6 packet. Just like IPv4, the longest match is the best match. For example, if there are multiple matches in the routing table, the router chooses the route with the longest match. A match is made by matching the far left bits of the packet’s destination IPv6 address with the IPv6 prefix and prefix-length in the IPv6 routing table.