Static routing is the first routing you ever configure and the last routing you stop using. Dynamic protocols get the attention, but every real network still leans on hand-configured routes for default gateways, stub sites, backup paths, and steering a single prefix. The commands look trivial, which is exactly why people get burned by the parts that are not: recursion, floating administrative distance, and the difference between a next-hop static and a fully specified one. This article configures all of them on a live Cisco IOS XE lab and shows the failure modes, not just the happy path. It is part of the IP Routing complete guide.
The three ways to write a static route
Every ip route statement names a destination network and mask, then tells the router how to reach it. There are three forms, and the difference between them is not cosmetic:
Here are a next-hop static and a host route configured on R1, confirmed in the running config and the table:
R1#show run | include ip route
ip route 3.3.3.3 255.255.255.255 10.0.13.2
ip route 3.3.3.3 255.255.255.255 10.0.12.2 250
ip route 10.0.30.0 255.255.255.128 10.0.12.2
R1#show ip route 3.3.3.3
Routing entry for 3.3.3.3/32
Known via "static", distance 1, metric 0
Routing Descriptor Blocks:
* 10.0.13.2
Route metric is 0, traffic share count is 1The 3.3.3.3/32 entry is a host route: a /32 static pointing at one specific device. Host routes are how you reach a loopback, pin management traffic to a path, or blackhole a single address. The bracket shows [1/0]: administrative distance 1, metric 0. Static routes always have metric 0, which is why AD is the only lever you have to rank them.
The default route: 0.0.0.0/0
The most common static route in the world is the default: a route to 0.0.0.0/0 that catches everything not matched more specifically. On switch SW1 it points at its gateway:
SW1#show run | include ip route
ip route 0.0.0.0 0.0.0.0 10.0.20.1
SW1#show ip route | begin Gateway
Gateway of last resort is 10.0.20.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 10.0.20.1
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.0.20.0/24 is directly connected, Vlan10
L 10.0.20.10/32 is directly connected, Vlan10Two things to read here. The Gateway of last resort is 10.0.20.1 line now names a next hop, where a router without a default says "not set." And the route itself is flagged S*: the S is static, the asterisk marks it as a candidate default route. Because 0.0.0.0/0 is the shortest possible prefix (length 0), longest prefix match guarantees any real route beats it, which is precisely why it is the route of last resort.
Floating static routes: a backup that only appears when needed
A floating static is a static route with a deliberately high administrative distance, so it stays out of the table while a preferred route (usually from a dynamic protocol) is present, and floats in only when that route disappears. This is the standard pattern for a backup WAN link. The trick is choosing the AD correctly, and this is where people go wrong.
On R1, 3.3.3.3/32 is reachable three ways: a primary static, a floating static, and via OSPF. Watch what happens across a failure. First, both statics are configured, the primary is fully specified and the floating one has AD 250:
R1#show ip route 3.3.3.3 | include Known|via|\*
Known via "static", distance 1, metric 0
* 10.0.13.2, via Ethernet0/2The primary static (AD 1) is installed. Now the primary's link goes down (Ethernet0/2 is shut) and we re-check:
### after e0/2 shutdown: fully-specified static withdrawn, OSPF 110 beats floating 250:
R1#show ip route 3.3.3.3
Routing entry for 3.3.3.3/32
Known via "ospf 1", distance 110, metric 21, type intra area
Last update from 10.0.12.2 on Ethernet0/1, 00:00:15 ago
Routing Descriptor Blocks:
* 10.0.12.2, from 3.3.3.3, 00:00:15 ago, via Ethernet0/1This is the gotcha. The floating static was set to AD 250, but OSPF's AD is 110. When the primary failed, both the floating static (250) and OSPF (110) were available, and OSPF won because 110 is lower. The engineer who set 250 probably wanted the static as the backup, but they positioned it below OSPF in the trust order, so OSPF, not the static, took over. A floating static's AD must be chosen relative to every other source that can offer the same prefix, not just the primary.
Fix it by giving the floating static an AD that beats OSPF, say 105, which is above the primary static's 1 but below OSPF's 110:
### floating re-created at AD 105 (below OSPF 110): installs:
R1#show ip route 3.3.3.3
Routing entry for 3.3.3.3/32
Known via "static", distance 105, metric 0
Routing Descriptor Blocks:
* 10.0.12.2
Route metric is 0, traffic share count is 1Now the static installs when the primary is gone, because 105 beats OSPF's 110. The Known via "static", distance 105 line is the proof. The lesson: a floating static route's administrative distance is a ranking against the entire set of possible sources, so map out what else knows the prefix before you pick the number.
The recursion gotcha
The reason the primary static above was written as fully specified (Ethernet0/2 10.0.13.2) rather than next-hop only is failover behavior. A next-hop-only static route is recursive: the router keeps it in the table as long as it can still resolve the next-hop IP through some other route. That sounds fine until the direct link fails but the next hop is still reachable the long way around, at which point the static never withdraws and can send traffic in circles.
A fully specified static (interface plus next hop) is bound to the interface. When that interface goes down, the route is withdrawn immediately and cleanly, which is exactly what let OSPF and the floating static take over above. On point-to-point links you can use exit-interface-only statics safely; on Ethernet, always add the next hop as well so ARP resolves against a specific neighbor. The practical rule: for anything that needs to fail over, write the primary static as fully specified so it disappears the instant its link does.
Verifying and troubleshooting statics
Three commands cover almost all static-route troubleshooting:
show ip route staticlists only the statics that made it into the table. A static you configured that is missing here failed to install (usually its next hop is unreachable, or a longer prefix beat it).show ip route <destination>shows the winning route and its AD, so you can see whether your floating static is at the right distance.show running-config | include ip routeshows what you actually configured, which sometimes differs from what you meant to configure.
If a static is in the running config but not the routing table, the number one cause is an unresolvable next hop: the router cannot find a route to the next-hop IP, so it cannot install the recursive static. Fully specifying the interface often fixes it.
When static routing is the right choice
Static routes get dismissed as "not real routing," which is wrong. They are the correct tool in several common situations:
- Stub networks. A branch site or a small office with a single path to the rest of the network has nothing to gain from a dynamic protocol. One default route out and one summary route back is simpler, uses no CPU or bandwidth for updates, and cannot be destabilized by a protocol flap somewhere else.
- The internet edge. Most enterprises point a default route at their ISP rather than accepting a full BGP table, because they only have one or two exits and do not need to make per-prefix decisions.
- Backup paths. A floating static over a cellular or secondary link gives you automatic failover without extending your dynamic protocol across a link you do not fully trust.
- Steering specific traffic. A single more-specific static can pull one destination onto a preferred path without touching the rest of your routing design, thanks to longest prefix match.
The flip side: static routes do not react to topology changes beyond the directly attached link. If a failure happens two hops away, a static route pointing through that path keeps forwarding into a black hole. That is the boundary where you reach for a dynamic protocol, and it is why large networks run OSPF or EIGRP for the interior and keep static routes for the edges.
Key takeaways
Static routes come in three forms, and the choice matters: fully specified (interface plus next hop) is the robust default because it withdraws the instant its link fails. The default route 0.0.0.0/0 shows as S* and is always the least specific match. A floating static is just a static with a high AD, but its distance must be positioned against every source that can offer the prefix, not only the primary, or a dynamic protocol will quietly win the failover instead. And a next-hop-only static is recursive and can linger when you want it gone, so bind failover statics to their interface. Once you are comfortable here, the dynamic protocols in the IP Routing complete guide build on exactly the same table-selection rules, and FHRP handles the first-hop redundancy that statics alone cannot.