← Common fixesTroubleshooting

OSPF taking the wrong path

OSPF doesn't count hops; it sums the cost of each outgoing interface along the path and picks the lowest total. If it's using the slow link, the cost math is making that path look cheaper (often because default costs don't reflect real bandwidth). You fix it by setting cost so the path you want is genuinely lower.

What it means

OSPF cost defaults to reference-bandwidth ÷ interface-bandwidth. With the default 100 Mbps reference, every link at or above 100 Mbps gets cost 1, so a fast core path and a slow backup can tie, or a fewer-segment slow path can total less. The router then forwards over the link with the lower summed cost, which may be your backup.

Most common causes

  • Default costs don't reflect bandwidth. A low reference bandwidth flattens fast links to the same cost, so OSPF can't tell the core from the backup. Raise the reference bandwidth consistently, or set costs by hand.
  • Backup link cost too low. The direct backup link has a lower or equal cost to the multi-hop primary, so it wins. Raise the cost on the backup interface.
  • Inconsistent reference bandwidth. Different `auto-cost reference-bandwidth` values across routers produce asymmetric, surprising path choices. Keep it the same everywhere.

How to fix it

  1. Map the two paths and their per-interface costs (`show ip ospf interface`).
  2. Raise the cost on the backup link (`ip ospf cost <n>`) so the primary totals lower, without making the backup unusable.
  3. Confirm the route now points at the primary next-hop (`show ip route <dest>`).
  4. Verify failover: the backup should take over if the primary drops.