L3 · igp · draft
Static routing
Static routes and floating static routes
Installs an operator-authored next hop for a prefix, and uses a worse preference only when a better route of the same length disappears.
Presenter modeEmbed this figure
Why it exists
Dynamic protocols need neighbours, timers and a shared metric. Many edges have one uplink and one set of destinations that never change. Writing the next hop once is cheaper than running a protocol for nothing.
Router requirements treat static routing as a first-class mechanism: a prefix, a next hop, and a configurable preference against dynamic sources. Floating statics are that preference used as a backup. STATIC ROUTINGRFC 1812 · PROPOSED STANDARD · June 1995
A next hop written by hand
A router has no dynamic protocol for a remote prefix. The operator installs a static route; forwarding looks only at the destination address in the IPv4 header.
Edge has a connected LAN and an uplink. Nothing advertises 198.51.100.0/24 into this box, so without an operator entry the destination is unreachable. Host · 10.1.1.10. Edge: RIB connected + uplink only. ISP · next hop. 198.51.100.0/24.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Host · 10.1.1.10 | host | — |
| Edge | router | RIB: connected + uplink only |
| ISP · next hop | cloud | — |
| 198.51.100.0/24 | zone | — |
| Host · 10.1.1.10 — Edge | link | up |
| Edge — ISP · next hop | link | up · 203.0.113.1 |
| ISP · next hop — 198.51.100.0/24 | link | up |
Edge has a connected LAN and an uplink. Nothing advertises 198.51.100.0/24 into this box, so without an operator entry the destination is unreachable.
What changed
- Edge: RIB → connected + uplink only
- Emphasis: No route to remote
How it works
Forwarding reads the IPv4 Destination Address and selects the longest matching prefix. A static route is one more candidate in that table, authored by configuration rather than by a protocol. Internet Header FormatRFC 791 · INTERNET STANDARD · September 1981
When two routes cover the same prefix length, administrative preference decides. A floating static uses a worse preference so it stays unused until the preferred source withdraws. Administrative PreferenceRFC 1812 · PROPOSED STANDARD · June 1995
A longer prefix always wins over a shorter one, regardless of source. A /32 static overrides a /16 from OSPF because longest match runs before distance is compared. Classless Inter Domain Routing (CIDR)RFC 1812 · PROPOSED STANDARD · June 1995
On the wire
Constructed examples, encoded from the field table below them — not captured traffic.
- Link layer
- Ethernet with EtherType 0x0800, or whatever the medium uses to say "IPv4 follows". RFC 791
- IPv4 header
- Version, length, differentiated services, fragmentation control, TTL, protocol, addresses. RFC 791
- Payload
- Whatever the protocol field names — 1 for ICMP, 6 for TCP, 17 for UDP, 89 for OSPF, 103 for PIM. RFC 791
Configure it
ip route 198.51.100.0 255.255.255.0 203.0.113.1Destination prefix and next-hop address. Forwarding matches the IPv4 Destination Address against this prefix.
RFC 1812 §7.4
ip route 10.9.0.0 255.255.0.0 203.0.113.5 210Same-length backup with administrative distance 210 so OSPF (110) wins while present.
Common mistake: Leaving the distance at the default (1). The static then permanently overrides the IGP.
RFC 1812 §5.2.4.4
ip route 10.9.0.0 255.255.0.0 Null0 254Intentional discard for holes under a summary you advertise. Prefer this over an accidental loop via default.
Verify
show ip route 198.51.100.50- Selected next hop and source (static).
show ip route static- Configured statics, including distance.
Caveats
- Exit-interface statics on Ethernet ARP for remote destinations; prefer next-hop IP.
- Distance values are platform conventions, not RFC constants.
When it breaks
Symptom first, because that is what you have when it happens.
The static appears in the table and traceroute dies one hop past this router, or never leaves it.
Narrow it down
- Confirm the next-hop address is reachable (ping / show to the next hop, not only to the destination).
- Check whether the next hop resolves through another static or a default that loops.
- On Ethernet, verify ARP for the next hop completes.
Cause
The route is installed against a next hop that cannot be used. Recursive resolution fails silently from the destination’s point of view.
Fix
Point the static at a connected next hop or a next hop that resolves through a working route. Remove recursive chains that depend on the route they are trying to support.
Next Hop AddressRFC 1812 · PROPOSED STANDARD · June 1995The primary path is down and the backup static never takes over.
Narrow it down
- Compare administrative distances of the primary source and the static for the same prefix.
- Confirm the primary route actually left the table — a stuck adjacency or redistributed copy can keep a “better” entry alive.
- Check tracking or BFD if the static is meant to withdraw when the uplink dies.
Cause
The floating static is not worse than what remains, or the primary source never withdrew. Distance only matters between candidates that are both present.
Fix
Raise the static’s distance above every remaining source of that prefix, or ensure the primary is truly gone before expecting failover.
Administrative PreferenceRFC 1812 · PROPOSED STANDARD · June 1995A working IGP appears ignored for one destination while the rest of the table looks correct.
Narrow it down
- Look for a longer prefix to that destination from any source, especially a host static.
- Compare prefix lengths before comparing administrative distances.
- Check whether a leftover troubleshooting static was left behind.
Cause
Longest match selected a more specific static. Distance never competed because the prefixes were different.
Fix
Remove or shorten the stray specific, or make it intentional and documented.
Classless Inter Domain Routing (CIDR)RFC 1812 · PROPOSED STANDARD · June 1995A static via an Ethernet interface without a next-hop address generates ARP for remote destinations and saturates the segment.
Narrow it down
- Inspect the static: exit interface only versus next-hop address.
- Check ARP tables for many incomplete or unexpected entries toward remote prefixes.
- Confirm the media is multi-access rather than true point-to-point.
Cause
Exit-interface statics treat the destination as on-link. On Ethernet that means ARP for every remote address.
Fix
Rewrite the static with an explicit next-hop IP on that interface. Reserve exit-interface form for true point-to-point links.
After advertising a summary, destinations inside the hole bounce until TTL expires instead of failing fast.
Narrow it down
- Compare the advertised aggregate against prefixes actually held.
- Check for a discard/Null route covering the summary.
- Trace a hole address and see whether it follows a default back out.
Cause
The summary claims reachability the site does not have, and without a local discard the packet follows a less-specific default.
Fix
Install a discard route for the summary so uncovered addresses die here.
Design notes
Prefer next-hop address over exit-interface alone on multi-access media. An exit interface without a next hop forces the router to ARP for every destination as if it were on-link.
Use discard routes under summaries you originate. An accidental gap under an advertised aggregate should fail here with a counter, not bounce toward a default.
Static routes do not detect that the far side of a path is down unless something else withdraws them. BFD or a tracked object is what turns a static into a route that can leave the table when the path dies.
Misconceptions
- “Static routes always beat dynamic protocols.”
- Only when configured with a better administrative preference for the same prefix length. Floating statics deliberately lose until the preferred source is gone. Administrative PreferenceRFC 1812 · PROPOSED STANDARD · June 1995
- “A better administrative distance overrides a longer prefix.”
- Longest match runs first. A /32 from anywhere beats a /8 with the best distance, because the two were never compared on preference. Classless Inter Domain Routing (CIDR)RFC 1812 · PROPOSED STANDARD · June 1995
- “If show ip route prints the static, forwarding works.”
- The line proves configuration and RIB presence, not that the next hop resolves or that the far path is up. Recursive failure and silent drops both look like a healthy static entry.
More walkthroughs
A worse static waits for the better route to diefailure
An OSPF-learned route and a higher-distance static share one prefix. While OSPF is up the static is present but unused; when OSPF withdraws, the static becomes the forwarding entry.
Both candidates cover 10.9.0.0/16. Preference between them is administrative: OSPF at distance 110 beats a static configured at 210 on the same prefix length. Edge: Active OSPF · AD 110, Candidate static · AD 210. OSPF path. Backup link. 10.9.0.0/16.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Edge | router | Active: OSPF · AD 110 · Candidate: static · AD 210 |
| OSPF path | cloud | — |
| Backup link | cloud | — |
| 10.9.0.0/16 | zone | — |
| Edge — OSPF path | link | up · OSPF AD 110 |
| Edge — Backup link | link | up · static AD 210 |
| OSPF path — 10.9.0.0/16 | link | up |
| Backup link — 10.9.0.0/16 | link | up |
Both candidates cover 10.9.0.0/16. Preference between them is administrative: OSPF at distance 110 beats a static configured at 210 on the same prefix length.
What changed
- Edge: Active → OSPF · AD 110
- Edge: Candidate → static · AD 210
- Emphasis on Edge ↔ OSPF path
A next hop that resolves to nowherefailure
A static points at a next-hop address that itself has no usable route, or at an exit interface with no ARP target. The route looks installed and traffic disappears.
Configuration says 203.0.113.0/24 via 10.255.0.1. The route appears in the table. Nothing has verified that 10.255.0.1 is reachable through a connected or recursively resolved path. Edge: Static 203.0.113.0/24 → 10.255.0.1. Unresolved NH. Null / drop. 203.0.113.0/24.
- Link
- Blocking
- Packet in flight
- Discarded
- Emphasis
Text equivalent of this diagram
| Element | Kind | State |
|---|---|---|
| Edge | router | Static: 203.0.113.0/24 → 10.255.0.1 |
| Unresolved NH | cloud | — |
| Null / drop | zone | — |
| 203.0.113.0/24 | zone | — |
| Edge — Unresolved NH | link | up · via 10.255.0.1 |
| Edge — Null / drop | link | up · Null0 |
| Unresolved NH — 203.0.113.0/24 | link | down |
Configuration says 203.0.113.0/24 via 10.255.0.1. The route appears in the table. Nothing has verified that 10.255.0.1 is reachable through a connected or recursively resolved path.
What changed
- Edge: Static → 203.0.113.0/24 → 10.255.0.1
- Emphasis on Edge
Terms
- Longest prefix match
- The forwarding rule: among all routes containing a destination, the one fixing the most bits is used. Metric and administrative distance only compare routes to the same prefix and never override this.
- Administrative distance
- A local, configurable preference between routing protocols offering the same prefix. It never crosses the wire and runs only after longest-prefix match has chosen the prefix.
- Floating static
- A static route configured with a worse administrative preference than the preferred source for the same prefix length, so it stays unused until that source withdraws.