IP SLA-dependent static routing

21012009

Just for reference really: I needed to have a static route whose presence depended on the IP reachability of a host. If the host wasn’t there, the static route should disappear, and default routing take over.

The configuration of this is made a bit confusing by the fact that Cisco changed the CLI commands from ‘rtr’ to ‘ip sla’ at some point.

The first section sets up the SLA monitor, telling it what to ping, how frequently, and what the timeout is.
The ‘ip sla monitor schedule’ command tells the SLA monitor to start and to run indefinitely.
The ‘track’ command simply references the IP SLA.
Finally, the static route references the track object. If the SLA fails because the pings aren’t succeeding, the track object goes down, and the static rout is removed from the table.

Verification of this can be done as follows. Note that I have two SLAs and two track objects – deliberately so that you can see one that is down and one that is up: