Cisco ASA and SLA Monitoring

| Comments

The Cisco ASA firewall can do three basic SLA monitoring tasks. They are:

  1. Continuously ping from the ASA even when nobody is logged in
  2. Change routes based on IP ping reachability
  3. Alert via syslog or SNMP when the SLA monitor fails

Unfortunately the ASA only has the ability to ping for its sla monitoring and is pretty limited in its capabilities.

Continuously ping from the ASA

Suppose for some reason you wish to have the ASA send a constant ping to something. This could be helpful to keep a tunnel alive, or send constant ping for some reason. This is actually required when making a VPN tunnel to Amazon AWS.

Suppose we want the ASA to ping every 3 seconds with a 1000 milliseconds (1 second) timeout. Here is the config for that:

sla monitor 100
  type echo protocol ipIcmpEcho interface OUTSIDE
    timeout 1000
    frequency 3
sla monitor schedule 100 life forever start-time now

In this case our SLA monitor ID is 100 and this will go forever starting now. There are some other options here to only have this go for a limited amount of pings or start at a different time.

Change routes based on IP ping availability

Let’s now build on the sla monitor commands above and add route tracking. First we need to make a tracking object. We can do that like this:

track 1 rtr 100 reachability

This will create a track ID of 1 and track sla monitor 100 for reachability.

Next we need to add the tracking to a route.

route OUTSIDE 1 track 1

Here we are telling the ASA to use this static route ONLY if the sla monitor pings are successful. If the monitor starts failing then the route will be removed from the routing table. The 1 track 1 command says this route has a weight of 1 and this will be in the routing table if track 1 is up.

We can set a fallback route for the ASA in the event that the sla monitor is failing. We can simply add a static route with a higher metric like so:

route OUTSIDE 20

With these two routes in place, the one with a weight of 1 will take precedence. Then when the ping fails it will be removed and the route with a weight of 20 will take over.

Alert via syslog or SNMP when the SLA monitor fails

When you have sla monitor, track, and a route with a track, syslogs will be created when the track changes state. You must have all of these things configured in order to see the syslogs.

When the track goes down, this is the syslog shown:

%ASA-6-622001: Removing tracked route, distance 1, table default, on interface OUTSIDE

When the track comes back up this is the syslog shown:

%ASA-6-622001: Adding tracked route, distance 1, table default, on interface OUTSIDE

Turn the syslogs into SNMP traps

You can turn the syslog into an SNMP trap by doing the following config:

logging list SLA-LIST message 622001
logging trap SLA-LIST
logging history SLA-LIST
snmp-server enable traps syslog

You’ll see the following trap when the track fails.

Apr 15 14:53:42
sysUpTime="128 days, 1:02:27"
E:"Syslog Trap"
E:"128 days, 1:02:27"

The varbind E: is hex encoded. Using a hex to ascii converter it then looks like this:

<166>%ASA-6-622001: Removing tracked route, distance 1, table default, on interface OUTSIDE

Show commands

The following commands will show the state of the SLA monitor.

show sla monitor operational-state

show track

Additional reading

asa, cisco, scripts