Using IP SLA
Once you have configured an IP SLA operation, you can verify the configuration with the show ip sla configuration [operation-number] command. As an example, the following configuration commands are used to define IP SLA operation 100[md]an ICMP echo test that pings target 172.25.226.1 every 5 seconds.
Switch(config)# ip sla 100 Switch(config-ip-sla)# icmp-echo 172.25.226.1 Switch(config-ip-sla)# frequency 5 Switch(config-ip-sla)# exit Switch(config)# ip sla schedule 100 life forever start-time now
Example 2 shows the output of the show ip sla configuration command.
Example 2Displaying the Current IP SLA Configuration
Switch#show ip sla configuration IP SLAs, Infrastructure Engine-II Entry number: 100 Owner: Tag: Type of operation to perform: echo Target address: 172.25.226.1 Source address: 0.0.0.0 Request size (ARR data portion): 28 Operation timeout (milliseconds): 5000 Type Of Service parameters: 0x0 Verify data: No Vrf Name: Schedule: Operation frequency (seconds): 5 Next Scheduled Start Time: Start Time already passed Group Scheduled : FALSE Randomly Scheduled : FALSE Life (seconds): Forever Entry Ageout (seconds): never Recurring (Starting Everyday): FALSE Status of entry (SNMP RowStatus): Active Threshold (milliseconds): 5000 Distribution Statistics: Number of statistic hours kept: 2 Number of statistic distribution buckets kept: 1 Statistic distribution interval (milliseconds): 20 History Statistics: Number of history Lives kept: 0 Number of history Buckets kept: 15 History Filter Type: None Enhanced History:
You can use the show ip sla statistics [aggregated] [operation-number] command to display the IP SLA test analysis. By default, the most recent test results are shown. You can add the aggregated keyword to show a summary of the data gathered over the life of the operation. Example 3 shows the statistics gathered for ICMP echo operation 100.
Example 3Displaying IP SLA Statistics
Switch#show ip sla statistics 100 Round Trip Time (RTT) for Index 100 Latest RTT: 1 ms Latest operation start time: 15:52:00.834 EDT Fri May 28 2010 Latest operation return code: OK Number of successes: 117 Number of failures: 0 Operation time to live: Forever Switch# show ip sla statistics aggregated 100 Round Trip Time (RTT) for Index 100 Type of operation: icmp-echo Start Time Index: 15:43:55.842 EDT Fri May 28 2010 RTT Values Number Of RTT: 121 RTT Min/Avg/Max: 1/1/4 ms Number of successes: 121 Number of failures: 0
It isn’t too difficult to configure an IP SLA operation manually and check the results every now and then. But does IP SLA have any greater use? Yes, you can also use an IP SLA operation to make some other switch features change behavior automatically, without any other intervention.
For example, HSRP can track the status of an IP SLA operation to lower automatically decrement the priority value when the target device stops answering ICMP echo packets. To do this, begin by using the track command to define a unique track object-number index that will be bound to the IP SLA operation number.
Switch(config)# track object-number ip sla operation-number {state | reachability}
You can use the state keyword to track the return code or state of the IP SLA operation; the state is up if the IP SLA test was successful or down if it wasn’t. The reachability keyword is slightly different[md]the result is up if the IP SLA operation is successful or has risen above a threshold; otherwise, the reachability is down.
Next, configure the HSRP standby group to use the tracked object to control the priority decrement value. As long as the tracked object (the IP SLA operation) is up or successful, the HSRP priority stays unchanged. If the tracked object is down, then the HSRP priority is decremented by decrement-value (default 10).
Switch(config-if)# standby group track object-number decrement decrement-value
In Example 4, SwitchA and SwitchB are configured as an HSRP pair, sharing gateway address 192.168.1.1. SwitchA has a higher priority than SwitchB, so it is normally the active gateway. However, it is configured to ping an upstream router at 192.168.70.1 every 5 seconds; if that router doesn’t respond, SwitchA will decrement its HSRP priority by 50, permitting SwitchB to take over.
Example 4Tracking an IP SLA Operation in an HSRP Group
Switch(config)# ip sla 10 Switch(config-ip-sla)# icmp-echo 192.168.70.1 Switch(config-ip-sla)# frequency 5 Switch(config-ip-sla)# exit Switch(config)# ip sla schedule 10 life forever start-time now Switch(config)# track 1 ip sla 10 reachability Switch(config)# interface vlan10 Switch(config-if)# ip address 192.168.1.3 255.255.255.0 Switch(config-if)# standby 1 priority 200 Switch(config-if)# standby 1 track 1 decrement 50 Switch(config-if)# no shutdown
In some cases, you might need many IP SLA operations to take many measurements in a network. For example, you could use UDP jitter operations to measure voice call quality across many different parts of the network. Manually configuring and monitoring more than a few IP SLA operations can become overwhelming and impractical. Instead, you can leverage a network management application that can set up and monitor IP SLA tests automatically. To do this, the network management system needs SNMP read and write access to each switch that will use IP SLA. Tests are configured by writing to the IP SLA MIB, and results are gathered by reading the MIB.