Octet

What is a recursive route lookup, and what can go wrong with it?

Show the answer

Say this first

When a route's next hop is not on a connected subnet, the router has to look up the next hop as well to find the real neighbor and exit interface. BGP routes with loopback next hops and static routes pointing at a distant address work this way. CEF resolves the chain in advance, so forwarding is still one lookup. The risk is that the next hop resolves through a route you did not intend, such as the default route, and the route stays up when the real path is gone.

Go deeper

Example

Cisco IOS
ip route 192.0.2.0 255.255.255.0 10.255.0.3

10.255.0.3 is R3's loopback, learned from OSPF.

Output
R1# show ip route 192.0.2.0
Routing entry for 192.0.2.0/24
  Known via "static", distance 1, metric 0
  Routing Descriptor Blocks:
  * 10.255.0.3
      Route metric is 0, traffic share count is 1
R1# show ip route 10.255.0.3
Routing entry for 10.255.0.3/32
  Known via "ospf 1", distance 110, metric 3, type intra area
  Last update from 10.0.12.2 on GigabitEthernet0/0/1, 00:20:15 ago
  Routing Descriptor Blocks:
  * 10.0.12.2, from 10.255.0.3, 00:20:15 ago, via GigabitEthernet0/0/1
      Route metric is 3, traffic share count is 1

Two lookups: 192.0.2.0/24 gives next hop 10.255.0.3, and 10.255.0.3/32 gives 10.0.12.2 out Gi0/0/1. show ip cef 192.0.2.0 detail shows the entry as recursive via 10.255.0.3, resolved to 10.0.12.2.

What goes wrong

  • Resolving through the default route. If OSPF loses 10.255.0.3, IOS can resolve the next hop through 0.0.0.0/0 instead, so the static stays installed and sends traffic toward the internet edge.
  • Recursion through itself. A next hop that is only reachable through the route that needs it cannot resolve, so the route is not installed. A GRE tunnel whose destination is learned through the tunnel hits the same problem and logs %TUN-5-RECURSIVE while it flaps.
  • Slow failover. The static only leaves the table when the IGP withdraws the route to its next hop.

Why CEF makes this cheap

CEF links the 192.0.2.0/24 entry to the 10.255.0.3 entry. If the IGP path to 10.255.0.3 changes, only that one entry is updated and every prefix that recurses through it follows at once. That hierarchy is what BGP Prefix Independent Convergence builds on.

Traps

  • Assuming the router does two lookups for every packet. CEF has already resolved the chain.
How did you do?Book 3.3 Internet (IP)