This is how I setup an ICMP-echo IP SLA on my Cisco Router to monitor when my internet goes out. If it goes down, I re-route traffic (I’ve excluded this part of the config). When it comes back up, I set the routing/NATing back to the original state (again, excluded from this post).
IP SLA Configuration:
ip sla 10 ! Connection Monitor icmp-echo 8.8.8.8 source-interface GigabitEthernet0/0 frequency 10 ip sla schedule 10 life forever start-time now
Configure Cisco Embedded Event Manager (EEM) to handle an UP or DOWN state of SLA 10:
event manager applet primary_circuit_down event track 10 state down action 1.0 syslog msg "Primary Circuit is DOWN" ! You can insert other commands here to do something useful... event manager applet main_circuit_up event track 10 state up action 1.0 syslog msg "Primary Circuit Appears UP" ! You can insert other commands here to do something useful...
This is the SLA configuration overview:
ciscorouter#sh ip sla conf IP SLAs Infrastructure Engine-III Entry number: 10 (Primary Circuit Monitor) Owner: Tag: Operation timeout (milliseconds): 5000 Type of operation to perform: icmp-echo Target address/Source interface: 8.8.8.8/GigabitEthernet0/0 Type Of Service parameter: 0x0 Request size (ARR data portion): 28 Verify data: No Vrf Name: Schedule: Operation frequency (seconds): 10 (not considered if randomly scheduled) Next Scheduled Start Time: Start Time already passed Group Scheduled : FALSE Randomly Scheduled : FALSE Life (seconds): Forever Entry Ageout (seconds): never Recurring (Starting Everyday): FALSE Status of entry (SNMP RowStatus): Active Threshold (milliseconds): 5000 Distribution Statistics: Number of statistic hours kept: 2 Number of statistic distribution buckets kept: 1 Statistic distribution interval (milliseconds): 20 Enhanced History: History Statistics: Number of history Lives kept: 0 Number of history Buckets kept: 15 History Filter Type: None
Statistics of the IP SLA:
ciscorouter#sh ip sla stat IPSLAs Latest Operation Statistics IPSLA operation id: 10 Latest RTT: 32 milliseconds Latest operation start time: 17:42:41 EDT Fri Mar 30 2012 Latest operation return code: OK Number of successes: 103 Number of failures: 0 Operation time to live: Forever