If OSPF already knows a route, does adding a static route change anything?
R1 learns 10.5.0.0/24 via OSPF. An engineer adds a static route for the same prefix pointing somewhere else. Which one forwards, and is the OSPF route gone?
1 Answer
The static wins the routing table, but nothing is "gone." For the same prefix/length, the router compares administrative distance — trustworthiness of the source: connected 0, static 1, eBGP 20, EIGRP 90, OSPF 110, RIP 120. AD 1 beats 110, so the static is installed and forwards. OSPF still knows the route in its LSDB; the moment the static is removed (or its interface dies), the OSPF route re-installs — this shadowing is invisible in show ip route (you see only the winner) but obvious in show ip ospf database. This mechanism is also a feature: set the static's AD worse than the protocol (ip route … 250) and it inverts into a floating backup instead of an override. Remember AD only breaks ties at equal prefix length — a /25 static and /24 OSPF route both stay, and longest-prefix-match picks per packet.