Floating static routes provide automatic failover by assigning a higher administrative distance to a backup route, keeping it dormant until the primary path fails. This topic covers how to configure a floating static route on a Layer 3 switch to redirect traffic through a secondary link when the default route becomes unavailable.
Floating Static Route
In our example right here, we're going to say that we have a backup link and it's meant for just being a backup link. We don't want it to be utilized unless our main link goes down, and that's where we would want to use something like a floating route.
In our scenario we're on this layer 3 switch right now, and what we want to do is create the backup link to the Pi. Currently, right now, the default route points to router 1, and we want to use that unless it goes down — then we'll point to this demo Pi.
I'm going to get onto the router here. I can do a show ip route and see how it's configured right now, and we see this static default route right there.
I'm going to get into the global configuration mode and configure another one. So ip route, and it's quad 0, so 0.0.0.0 space 0.0.0.0, and then the IP address we want to go to, so 10.1.10.21 is the IP address of that Pi.
Next, what we need to do is — we don't want this to take over the other static address or share with the other static address — so we've got to change the administrative distance. We can see that we just plug a number into here for the administrative distance. Now, since a static route has an administrative distance of one, it could be anything over one, so I'm just going to choose five. I'm going to hit enter.
Now let's see what our routing table looks like, and we can see that it still points to the other one.
If we were to take that down — let's go ahead and do a no ip route 0. I'm not sure if I've got this right, so I'm going to do a show run and take a look at the ip route here to make sure I get the command exactly. I'm going to type in no, and I'll come up here, and the one that I want to take out is this one right here, so I'm going to do no for that command. Now I do show ip route, and I can see the other one is installed with the administrative distance of five. So there you have it.
The other thing I could actually do to test this out is I can put this back in. So I'll do a do show ip route — that one's up — and then I can get into that interface and shut that down. Which interface is that? I take a look at my VLANs here. I believe it's VLAN 9, so I'm going to do a shutdown on this interface right here. So interface vlan nine, and I'm going to do a shutdown.
Let's take a look at that routing table now: show ip route. In fact, it has put that back into place. So we see that when the other interface goes down and it no longer has access to that network, then it will switch, and now it's directing this default route towards the Pi. If I want to bring that up I can do a no shut, and then take a look again, and we're back to normal here.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →