Timedora

4 Route Selection and Troubleshooting

Learn how routers install routes, select paths for destinations, and troubleshoot route-selection problems.

and forwarding

A router may learn routes from connected interfaces, static configuration, and dynamic protocols such as OSPF. and are separate steps: the router first decides which candidate routes to keep in its routing table, then uses a packet's destination address to select among those installed routes.

Metrics and route sources

A routing protocol uses its own to compare paths it has learned to the same destination. OSPF uses cost and prefers the path with the lowest total cost. Metrics are protocol-specific: an OSPF cost cannot be directly compared with a RIP .

When different sources offer routes to the same prefix, the router uses to choose the preferred source. A lower value is preferred. On Cisco IOS, common defaults are connected 0, static 1, OSPF 110, and RIP 120; values can differ by platform or configuration. is local to the router and is not the protocol .

For example, if static and OSPF routes both offer 10.20.0.0/16, the default static route is preferred because its AD is 1 rather than 110. If OSPF has two paths to that same prefix, OSPF compares their costs and selects the lower-cost path. If a preferred route disappears, the router can install another valid candidate.

Cisco IOS route output commonly shows [AD/]. For example, O 10.20.0.0/16 [110/25] indicates an OSPF route with AD 110 and (cost) 25. A static route may appear as S ... [1/0].

Choose the most specific matching route

Once routes are installed, determines which matching route is used for forwarding. The router selects the most specific matching prefix, meaning the one with the largest prefix length. A lower AD on a less-specific route does not override this process.

Consider a routing table containing 10.20.0.0/16 from static configuration with AD 1, 10.20.1.0/24 from OSPF with AD 110, and the static default route 0.0.0.0/0 with AD 1. For destination 10.20.1.7, the router selects 10.20.1.0/24 because it is the longest matching prefix. For 10.20.8.7, the /24 does not match, so the /16 is selected. A destination matching neither specific route may use the default route.

Follow the route-selection procedure

Use this order to determine which route is selected:

  1. Check the destination address and list every route whose prefix contains it.

  2. Apply to select the most-specific matching prefix.

  3. If multiple candidate routes have that same prefix, compare their sources' ADs; the lower AD wins.

  4. Within a routing protocol, use that protocol's to identify its preferred path. Equal-cost paths may be installed together if the platform supports them.

  5. Confirm that the selected route is usable: its next hop must resolve and its outgoing interface must be available.

The distinction between AD and matters: AD compares sources offering the same destination prefix, while chooses among matching prefixes during forwarding. A /24 can therefore be used for its address range even if a /16 route has a lower AD.

Troubleshoot missing or unexpected routes

On Cisco IOS, show ip route displays installed routes, while show ip route <destination> helps inspect the route used for a particular destination. Check the route code, prefix length, [AD/], next hop, and outgoing interface.

If an expected OSPF route is missing, use show ip ospf neighbor to check neighbor state. OSPF interface and database commands can help distinguish a neighbor problem from a route that is present in the OSPF database but not installed in the routing table.