Our company may have two connection to the internet through 2 ISPs. If we want to use one connection as primary and other as backup, we can use IP SLA to monitor the link. It detects the link failure even if the connection between modem and ISP fails. So it helps to switch over to the backup path automatically as soon as the primary path is down.
Step1 : Configuring SLA process
R1(config)#ip sla 1
R1(config-ip-sla)#icmp-echo 8.8.8.8
R1(config-ip-sla-echo)#frequency 5 (Means, every 5 second send icmp-echo packet to the ip 8.8.8.8. This can by any reliable IP on internet)
R1(config-ip-sla-echo)#exit
Step2: Scheduling SLA process
R1(config)#ip sla schedule 1 start-time now life forever (Means, start the sla process now and don’t end)
Note: we can check the process using the following command
R1#show ip sla statistics
Step3: Create a track object to track the change. It is used to inform the router about the current condition
R1(config)#track 10 rtr 1 reachability (this will inform the router if any reachability problem occurs. rtr is the old name of IP SLA)
R1(config-track)#exit
Step4: Create two static route two both ISPs with some tweaks
R1(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/0 track 10
R1(config)#ip route 0.0.0.0 0.0.0.0 fastEthernet 0/1 2
Now router will select ISP1 as primary path because of administrative distance is lower. If the link to ISP1 is down, then router automatically switch the connection to ISP2