Sub topic 11
Floating static routes as backup paths
This chapter assumes you know CIDR prefix notation, the difference between a router and a host, and basic router command-line use. It also assumes you have met administrative distance (AD), the trust rating a router gives each route source, where a lower value wins.
The idea
A router that knows the same prefix from two sources installs only the source with the lowest AD. A floating static route uses this rule on purpose. You configure a static route and give it an AD higher than the dynamic protocol's AD. The router keeps it out of the routing table while the dynamic route exists. When the dynamic route disappears, the static route is installed and traffic keeps flowing. It "floats" below the preferred route until it is needed.
Default AD values on Cisco IOS:
| Route source | Default AD |
|---|---|
| Connected interface | 0 |
| Static route | 1 |
| OSPF | 110 |
| RIP | 120 |
A normal static route has AD 1, so it would beat OSPF. To make it a backup, set its AD above 110, for example 200.
Worked example
Router R1 reaches 10.2.0.0/16 over two paths. The primary path is learned by OSPF through 192.168.1.2. The backup path is a second link through 192.168.2.2, for example a slower circuit.
! Cisco IOS: primary path learned by OSPF (default administrative distance 110)
router ospf 1
router-id 1.1.1.1
network 10.1.0.0 0.0.255.255 area 0
! Backup static route with administrative distance 200, used only if the OSPF route disappears
ip route 10.2.0.0 255.255.0.0 192.168.2.2 200The number at the end of the ip route line is the AD. Without it the default is 1, and the static route would replace the OSPF route.
Verifying it
Check which source won with these commands:
! Cisco IOS: inspect the routing table
show ip route
show ip route static
show ip route ospf
show ip route 10.2.5.7In normal operation, show ip route 10.2.5.7 shows the OSPF route. show ip route static shows nothing for 10.2.0.0/16, because the floating route is not installed. It still exists in the configuration. After the OSPF route is lost, the same commands show the static route with [200/0], meaning AD 200 and metric 0.
Common errors
- AD not higher than the dynamic protocol. If you set 100 and the primary is OSPF at 110, the static route wins and the dynamic route is never used. Choose a value above the protocol's AD, and leave room if you run several protocols.
- The primary route does not disappear. The floating route installs only when the dynamic route is removed. If the link is up but the path beyond it is broken, OSPF still advertises the route and the backup never activates. A failure that the protocol cannot detect needs other tools, such as faster failure detection or route tracking.
- Backup next hop that is down. A static route with only a next-hop address can be installed even if that next hop is unreachable. Check the backup path in advance.
- Slow switchover. Failover waits for the dynamic protocol to remove the route. Timers and convergence behavior decide how long traffic is lost.
Exercise
Exercise
R1 learns 10.2.0.0/16 from OSPF (AD 110). You add the static route "ip route 10.2.0.0 255.255.0.0 192.168.2.2 90" as a backup. During normal operation, which route does R1 use, and what should you change?
Show answer
R1 uses the static route, because AD 90 is lower than OSPF's 110. The backup is not floating at all. Change the AD to a value above 110, for example 200, so the static route is installed only when the OSPF route is lost.
Exercise
The primary link is up, but a router two hops beyond it has failed. OSPF still lists the route. Does the floating static route take over? Why or why not?
Show answer
No. The floating route is installed only when the OSPF route is removed from the routing table. While the route stays, R1 keeps using it, so traffic is lost until OSPF removes the route or you add a mechanism that detects the failure.