Octet

What are the different ways to write a static route on IOS, and which one should you use on Ethernet?

Show the answer

Say this first

Next hop only, exit interface only, or both (fully specified). On Ethernet use a next hop or, better, both. Exit interface only on a multi-access link makes the router ARP for every destination and depend on proxy ARP. On a point-to-point link such as a serial, PPP or tunnel interface, exit interface only is fine because there is only one possible neighbor.

Go deeper

The three forms

Cisco IOS
ip route 192.0.2.0 255.255.255.0 10.0.12.2
ip route 192.0.2.0 255.255.255.0 GigabitEthernet0/0/1
ip route 192.0.2.0 255.255.255.0 GigabitEthernet0/0/1 10.0.12.2
FormHow it resolvesWatch out for
Next hoprecursive lookup of 10.0.12.2can resolve through another route, even the default
Exit interfacetreated as directly connectedARP per destination on Ethernet
Fully specifieduses that interface and that neighbornone; best on Ethernet

Useful options at the end of the line

Cisco IOS
ip route 0.0.0.0 0.0.0.0 198.51.100.1 250 name BACKUP-LTE
ip route 0.0.0.0 0.0.0.0 203.0.113.1 track 1 name ISP1
ip route 10.99.0.0 255.255.0.0 10.0.12.2 tag 500
  • A number is the AD (floating static).
  • track ties the route to an IP SLA or interface tracking object.
  • tag marks the route for route-maps during redistribution.
  • name is a comment that shows up in the config.
  • permanent keeps the route even when the interface goes down. Use it rarely.

When the route leaves the table

A static is installed only while its next hop resolves and its interface is up. Fully specified routes leave the table as soon as their interface goes down. Next hop only routes can survive by resolving the next hop through some other route, which is a common surprise.

Traps

  • Pointing a default route at an Ethernet interface with no next hop. It works in a lab and hurts in production.
How did you do?Book 3.3 Internet (IP)