How to set up Internet connection (WAN) failover in Cisco IOS including e-mail notifications

Posted by

As a revision to my earlier post on the matter, here’s a better constructed way to achieve the same effect with a little more accuracy.

Here’s a diagram of the approximate topology that this will cater to:

Network Diagram
Network Diagram

I shall assert the following facts:

  1. The “ISP’s Router” is IP address
  2. The DSL model is IP address
  3. The source interface that connects to the ISP router is FastEthernet0/0
  4. There is an SMTP server that this router has permission to send via at
  5. Your e-mail address is

First we use “track” to create 2 track entries to do route tracking. The first defines a “reachability” track which will be used to monitor for and perform actions on the failure of the primary route. This also delays the actions it performs on failure and restore by 20 and 60 seconds respectively to negate the effect of temporary blips. The second is a stub which allows us to take the secondary route up or down.

track 1 rtr 123 reachability
 delay down 20 up 60
track 2 stub-object
 default-state down

Next we add the routes. There’s 2 default gateways added, each associated with the track entries. There is also a route to ensure that all traffic to the “ISP’s Router” is sent out of the fa0/0 interface. This is for monitoring.

ip route name FIBRE track 1
ip route 254 name ADSL_BACKUP track 2
ip route FastEthernet0/0

Now we use ip sla to provide the details for our reachability track regarding what it should test. In this case, it pings the “ISP’s Router” every 4 seconds:

ip sla 123
 icmp-echo source-interface FastEthernet0/0
 timeout 2000
 frequency 4
ip sla schedule 123 life forever start-time now

Finally we add some event handling to perform some actions on the failure and restore of the primary line. These bring up the second route and e-mail you a notification:

event manager applet TRACK-1-TIMEOUT
 event track 1 state down
 action 1.0 track set 2 state up
 action 1.1 mail server "" to "" from "monitor@router.local" subject "IP SLA 123 Timeout" body "Timeout on the primary line"
event manager applet TRACK-1-OK
 event track 1 state up
 action 1.0 track set 2 state down
 action 1.1 mail server "" to "" from "monitor@router.local" subject "IP SLA 123 Restored" body "Primary line restored"

That’s largely it. It contrasts with my earlier post in such that it ignores the effect of temporary blips in the line and also sends e-mail notifications.


Leave a Reply

Your email address will not be published.