Sub topic 14
Verifying and Troubleshooting Routes
This chapter assumes you know IPv4 addressing and CIDR prefixes, the difference between a router, a switch and a host, and basic command-line use on a router or Linux host. It also assumes you have read the earlier chapters on longest-prefix match, static routes, and administrative distance.
Start with the routing table
When traffic does not arrive, check the routing table first. It shows which routes the router has installed and where each one came from. Routes that lost the selection process are not installed, so they do not appear.
On a Cisco IOS router, these commands cover most checks:
! Cisco IOS: inspect the routing table
show ip route
show ip route static
show ip route ospf
show ip route 10.2.5.7The last command is the most useful. It shows the single route the router would use for that destination, and the protocol that supplied it.
In the output, the code at the start of each line tells you the source. S is static, O is OSPF, and S* is a static default route. The bracket [110/20] holds the administrative distance first and the metric second.
Ask the host which route it would use
On Linux, ip route get runs the forwarding lookup for one destination and prints the result.
# Show the routing table
ip route show
# Ask the kernel which route it would use for one destination
ip route get 10.2.5.7The output names the next hop (via), the outgoing interface (dev) and the source address the host will use. If the answer is the default route when you expected a specific one, the specific route is missing or has the wrong prefix length.
A repeatable troubleshooting flow
Work through the same questions in the same order each time.
- Does a route exist for the destination? Run
show ip route <destination>. If the router reports the network is not in the table and no default route exists, the packet is dropped. - Is the winning route the one you expected? Longest prefix wins first. Administrative distance only decides between routes with the same prefix. The metric only decides between routes from the same protocol.
- Is the next hop reachable? A route whose next hop has no route of its own, or sits on a down interface, will not forward traffic.
- Does the return path exist? The remote router also needs a route back to the source. One-way routing is a common cause of failed pings.
- Did the route change recently? A failed link may have triggered convergence, so a floating static route might now be active.
Common errors
| Symptom | Likely cause |
|---|---|
| Static route missing from the table | The next hop is unreachable, or the outgoing interface is down |
| Floating static route is always active | Its administrative distance is lower than or equal to the dynamic route's |
| Floating static route never takes over | Its distance is too high, or the dynamic route has not actually been withdrawn |
| Traffic takes an unexpected path | A more specific prefix exists elsewhere in the table |
| Ping works one way only | The remote router has no route back to the source |
Confirming a failover
To test a floating static route, note the route in the table, then shut the primary link and run show ip route 10.2.5.7 again. The code should change from O to S, and the distance should show 200. Restore the link and confirm that the OSPF route returns. If it does not, check that the OSPF adjacency came back up.
Exercise
On a router, show ip route 10.2.5.7 returns a static route with distance 1 via 192.168.1.2, but you expected traffic to follow an OSPF route with distance 110. Both routes are for 10.2.0.0/16. Why does the static route win, and what change makes OSPF win?
Show answer
With the same prefix length, the lower administrative distance wins, and a static route has a default distance of 1 against 110 for OSPF. To make OSPF the primary path, give the static route a distance higher than 110, for example 200, which turns it into a floating static route.