Pcornel
Networking · Routing › Static Routing

IPv4

Cheat sheet · https://pcornel.dk/topic.php?topic=624

Back to the Topic

Answer

IPv4 static routing configures routes by hand with ip route <prefix> <mask> <next hop | interface> [distance]. It suits small networks, default routes towards a provider and backup paths.

Remember

A static route with a next hop is installed only if that next hop is reachable through another route. Its distance is 1, so it beats every protocol unless configured higher. On Ethernet, give a next hop address, not just the interface.

First checks

  • show ip route static — the static routes installed.
  • show running-config | include ip route — those configured.
  • show ip route <next hop> — whether the next hop is reachable.
  • show ip cef <prefix> — forwarding for the prefix.
  • show track — if the route is tied to a track object.

Commands

ip route <network> <mask> <next-hop>
Remote network via next hop
ip route <network> <mask> <interface>
Remote network via interface
ip route <host> 255.255.255.255 <next-hop>
One host
ip route 0.0.0.0 0.0.0.0 <next-hop>
Default/fallback for unknown prefixes
ip route <network> <mask> <next-hop> <administrative-distance>
Backup path
ip route

Verify in this order

static route configured → next hop resolvable through another route → track up (if used) → no better route for the same prefix → installed with distance 1 (or configured) → CEF forwards

Where it usually breaks

underlay/interface reachability → protocol adjacency/session → received/originated state → policy → best path/RIB → FIB/adjacency → traffic path

Static route selection order

OrderQuestionExample
1What is the destination IP?10.20.30.40
2Which installed route has the longest matching prefix?/32 beats /24 beats /16 beats /0
3If the same prefix is offered by multiple sources, which has preferred AD?Static default AD normally 1
4Can the selected next hop/interface resolve?Recursive route / interface state
5Is forwarding programmed and reachable?CEF/adjacency/ARP + return path

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=624

Confirmation

Confirm action

Continue?