This topic is old news, but always a good thing to know if you have a constrained budget and limited time to make your network a little more robust. Do you have executives screaming at you because the internet is down and your business is losing tons of revenue by the minute because your services are hosted in the cloud? Then implement redundant links to the internet!
Many small branch offices don’t have redundant links. If those small branches don’t warrant redundant links, you can pretty much bet they don’t have a dedicated router (or pair of routers) either. More commonly, a firewall is used as the termination point for the connection to the Wild, Wild Internet of Things. This is perfectly fine for a small branch of part an organization that doesn’t need to scale quickly (in contrast, see: DMVPN for quick scaling), but once a branch scales beyond “small”, redundant internet links from different ISPs are absolutely necessary. With more and more services moving to a cloud-based platform, business requirements demand uninterrupted access to the internet.
A common firewall platform is the Cisco ASA, and there is a quick and easy way to achieve ISP redundancy using a feature called SLA monitoring.
When you configure a primary internet link connected to your ASA, you configure a default static route. This route is intended for all traffic with a destination IP address that is not in your routing table to flow to. The next-hop of the route points to your primary ISP gateway.
However, static routes are manual entries. In order to fail over to a backup link, the default static route would need to be manually changed to take priority over the primary default route. Moreover, there is no inherent mechanism to determine if a static route is up or down since it is not a dynamic routing protocol. Static routes remain in the routing table even if the next-hop gateway is unavailable! The only time a static route is removed from the routing table is if the associated interface’s link-state goes into a down state. So what happens if the ISP gateway goes down, or if problems occur on your primary ISP’s network? This is where SLA Monitoring comes in.
The SLA Monitoring feature associates a static route with a monitoring target. ICMP echo requests get sent to the target over the specified interface. If the monitored IP is unreachable for a specified amount of time, the static route is removed from the routing table, and the backup route can take over. Once the target becomes reachable from the primary interface again, the primary default route is inserted back into the routing table.
IMPORTANT NOTE: This is a viable solution for outbound traffic from your internal network. However, if you are hosting services that need to be reachable from the internet after a failure (email, web services, etc.), a more advanced solution needs to be put in place. If your primary connection fails, and your services are using public IP addresses from your primary provider, those services are no longer available when the backup takes over. A solution like BGP peering would need to be put in place in order to advertise your public IP space over both internet links — this is a topic for another post.
How to Configure IP SLA
So now that you know what the feature does, how do you implement it?
1. sla monitor sla_id
This configures the monitor process where you specify the parameters to be tracked.
2. type echo protocol ipIcmpEcho target_ip interface if_name
This configures the specific IP address that will be tracked for the monitoring process set up in step 1. The target_ip argument should be an IP address that can be reached from the interface specified in the if_name argument. For example, if you are setting up redundant internet links, you can do something like this for your primary link:
type echo protocol ipIcmpEcho 22.214.171.124 interface outside
126.96.36.199 is a public DNS server which is reachable from the primary interface outside, but the IP address can be any public IP which you see as critical.
3. sla monitor schedule sla_id life forever start-time now
This schedules the monitoring process. The command above is the typical use-case, but it is possible to schedule the monitoring process to begin at a later time and to only occur at specified times. Most of the time, you will want the process to run for an unspecified amount of time and start now. For more information on other options, please see the ASA Configuration Guide.
4. track track_id rtr sla_id reachability
This associates a tracked static route with the SLA monitoring process that was defined in steps 1-3. track_id is a number you assign with this command, while sla_id is the number you chose in step 1.
5. route if_name dest_ip mask gateway_ip track track_id
There are a lot of arguments here, but it is just your standard static routing configuration with the track argument added onto the end. This command defines the static route to be installed in the routing table while the tracked object is reachable. In other words, this static route should be your primary default route. For example, if I have an interface outside with an IP address 188.8.131.52, a gateway IP of 184.108.40.206, and a track_id of 1, the resulting command is:
route outside 0.0.0.0 0.0.0.0 220.127.116.11 track 1
If my monitored target IP becomes unreachable, this route will be removed from the routing table. That means we need to have a backup default route – using our backup interface – with a higher administrative distance. For example:
route backup 0.0.0.0 0.0.0.0 18.104.22.168 2
I chose 2 as the administrative distance here because it is higher than the default of 1 (which your primary link is using) and lower than 5, which is the AD for an EIGRP summary route. If you’re not using EIGRP or another routing protocol, then this number is arbitrary, but using 2 is still a good practice.
Now you’re all set! If the target IP of the monitoring process becomes unreachable, then the primary default route will be removed, and the backup default route will take over.