IP SLA and Cisco EEM

0
415

There are a lot of networks that utilize redundant ISP connections for obvious reasons. The problem though, then a link goes down, there are times a route can remain in the routing table, this causing failed routing. Using IP SLAs and Cisco EEM (Embedded Event Manager), you can automate this process of checking to make sure an ISP is up and acting accordingly.

First step in the process is monitoring the connection. I do this by pinging the gateway address at my ISP every 5 seconds. This simply will check for reachability:


 

track 1 ip sla 1 reachability

ip sla 1

icmp-echo 1.1.1.1┬ásource-interface Ethernet0/0 <– Use the interface on the Router that is facing the ISP

frequency 5

ip sla schedule 1 life forever start-time now


 

That will go through and handle the pinging of the ISP every 5 seconds to make sure the connection is still up. In the case of my last lab I worked on, I wanted the BGP process to shutdown the neighbor (ISP) when it was unable to be reached. Shutting down the neighbor removes the routes through that ISP from the routing table as well. Here is what my script looks like for EEM:


event manager applet ISP_DOWN

event track 1 state down

action 1.0 syslog msg “ISP is DOWN. Disabling Neighbor until link returns to active state.”

action 2.0 cli command “enable”

action 2.1 cli command “config t”

action 2.2 cli command “router bgp 100”

action 2.3 cli command “neighbor 1.1.1.1 shutdown”


 

event manager applet ISP_UP

event track 1 state up

action 1.0 syslog msg “ISP is UP. Re-Enabling BGP Neighbor.”

action 2.0 cli command “enable”

action 2.1 cli command “config t”

action 2.2 cli command “router bgp 100”

action 2.3 cli command “no neighbor 1.1.1.1 shutdown”


 

Depending on the result of the pings, the IP SLA will classify the link as up or down. When there is a status change, it will run the script that goes with that status change. I chose to include a syslog message as well so my logging could be referenced if I ever wanted to go back and check ISP outages. Give this one a shot and let me know if you have any questions!

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.