The floating static route is a quick tool for directing traffic to destinations a different way through the network when default metrics work against us or there is a link failure. In conjunction with dynamic routing protocols, a network operator can use the floating static route and route table Administrative Distance to manipulate traffic flows.
In the diagram above you’ll see a small OSPF area with two exit points to the internet. The business has asked you as the network operator to have the primary route to the internet for the branch via R2 –> R3 –> R4. The secondary or backup internet connection is accessed via R2 –> R1. Lets say all links are equal speed/cost in terms of OSPF metrics and both internet gateways are advertising their respective default quad 0 (0.0.0.0/0) route into the OSPF area. If that’s the case then due to OSPF cost value R2 will install the secondary default route into its forwarding table instead of the primary. An option to direct internet bound traffic to R3/R4 would be to have R1 stop advertising its quad 0 into the OSPF domain, but then R2 doesn’t know about the secondary connection when the link between R2 and R3 fails. A quick way of getting around this issue is by utilizing a floating static route on R2.
By default a router uses Administrative Distance (AD) to choose best path through a network when there are two routes to the same destination. The AD value of a route is typically dependent on how the routing device received the route entry, and the lower the value the more preferred the route. The typical default routing protocol AD values are below, although this is not exactly the same for all vendors.
Administrative Distance Values:
- Static – 1
- EBGP – 20
- EIGRP – 90
- OSPF – 110
- iBGP – 200
Going back to the diagram above, if we need R2 to have a backup quad 0 route to R1, we can add a static route pointing to the next hop assigned to R1. But per the AD values list, a static route entry has a value of 1, which is preferred over the dynamic protocols. To get the static route to function as a less preferred option the route entry needs to be added into the route table with an AD value higher than the quad 0 routing table entry advertised by R3 through OSPF. OSPF has an AD value of 110 by default, so modifying the static route to the secondary internet connection with the value of 111 will successfully make the OSPF route more preferred.
As a result the R2 routing table will have a quad 0 default route with a next hop of R3. If the link between R2 and R3 ever goes down the default route pointing to R3 will dynamically be taken out of R2’s routing table and the backup ‘Floating’ static route will emerge. Once connectivity and OSPF adjacency come back the OSPF default route will once again take priority.
There are other ways to solve the problem but the floating static route is quick and overall straightforward. Someone asked me what this was once and I didn’t know what they were talking about. For some reason I’d never called this function a ‘Floating Static Route’ even though I’d used and seen it multiple times before. It’s a fitting name.