IP SLA track configuration
Topology:
Basic configuration, Interface addresses and static routing:
- R1 interface addresses configuration:
R1(config)#int gi0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.252
R1(config-if)#no sh
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
R1(config-if)#int gi0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.252
R1(config-if)#no sh
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
- ISP1 addresses configuration:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname ISP1
ISP1(config)#int gi0/0
ISP1(config-if)#ip address 192.168.2.2 255.255.255.252
ISP1(config-if)#no sh
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
ISP1(config-if)#int gi0/1
ISP1(config-if)#ip address 172.16.20.1 255.255.255.0
ISP1(config-if)#no sh
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
- ISP2 addresses configuration:
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname ISP2
ISP2(config)#int gigabitEthernet 0/0
ISP2(config-if)#ip address 192.168.1.2 255.255.255.252
ISP2(config-if)#no sh
%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up
ISP2(config)#int gigabitEthernet0/1
ISP2(config-if)#ip address 172.16.20.2 255.255.255.0
ISP2(config-if)#no sh
%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up
- Configure static routing to 172.16.20.0/24 through ISP1 and ISP2 from R1:
We configure Static routes to 172.16.20.0 with the default administrative distance so that ISP1 will be our primary line and ISP2 is backup (secondary), to do so, we set the administrative distance of 20 > 1 for static route through ISP2 (ISP1 has an administrative distance of 1 by default)
R1(config)#ip route 172.16.20.0 255.255.255.0 192.168.1.2
R1(config)#ip route 172.16.20.0 255.255.255.0 192.168.2.2 20
we can verify from the routing table of R1:
IP SLA Tracking configuration:
- Step1: define the IP SLA:
In this example, IP SLA operation 1 is created.
To configure an IP SLA ICMP Echo operation, enter the following:
icmp-echo [ip-address | hostname] {{[source-ip ip-address] [nexthop-ip ip-address]}}
- ip-address | hostname – Destination IP address or hostname.
- nexthop-ip ip-address – (Optional) If ip-address is entered, enter the IP address of the next hop.
- source-ip ip-address – (Optional) If ip-address is entered, enter the source IP address. When a source IP address is not specified, the IP SLAs ICMP Echo operation chooses the IP address nearest to the destination.
To set the rate at which a specified IP SLA operation repeats, enter the following:
frequency [seconds]
- seconds – The number of seconds between the IP SLAs operations. The range is from 10 to 500 seconds.
Note: A single IP SLA operation will repeat at a given frequency for the lifetime of the operation. If you configure the frequency, the timeout must be configured as well. The new frequency value configured by this command will impact on the current frequency interval.
To set the amount of time an IP SLA operation waits for a response to its request packet, enter the following:
- milliseconds – Length of time the operation waits to receive a response from its request packet, in milliseconds (ms). The range is from 50 millisecond to 5000 milliseconds.
To configure the scheduling parameters for a single IP SLA operation, enter the following:
ip sla schedule [operation] life forever start-time now
operation 1 is configured to run indefinitely and scheduled to start immediately.
R1(config)#ip sla 1
R1(config-ip-sla)#icmp-echo 192.168.1.2 source-interface Gi0/0
R1(config-ip-sla-echo)#timeout 5000
R1(config-ip-sla-echo)#frequency 10
R1(config)#ip sla schedule 1 life forever start-time now
- Step2: Track the defined ip SLA:
R1(config)# track 1 ip sla 1 reachability
The above output shows that the track status is down. Every IP SLAs operation maintains an operation return-code value. This return code is interpreted by the tracking process. The return code may return OK, OverThreshold, and several other return codes.
Different operations may have different return-code values, so only values common to all operation types are used. The below table shows the track states as per the IP SLA return code.
- Step3: Apply the track on static route (to the primary ISP):
R1(config)#ip route 172.16.20.0 255.255.255.0 192.168.1.2 track 1
The track number keyword and argument combination specifies that the static route will be installed only if the state of the configured track object is up. Hence if the track status is down the secondary route will be used to forward all the traffic.
Author: Bilel
Ref:
1- firewall.cx
2- Cisco.com