Objective

This article provides instructions on how to configure the IP SLA tracking settings for IPv4 static routes on your switch. In this scenario, the static route has been preconfigured.

Note: To learn how to configure an IPv4 static route on your switch, click here. For instructions on how to configure IP SLA tracking for IPv4 static routes through the web-based utility, click here.

Introduction

When using static routing, you may experience a situation where a static route is active, but the destination network is not reachable via the specified next hop. For example, if the static route in question has the lowest metric to the destination network and the status of the outgoing interface to the next hop is Up, however the connectivity is broken somewhere along the path to the destination network. In this case, the device can use the static route although it does not actually provide connectivity to the destination network. The Internet Protocol Service Level Agreement (IP SLA) Object tracking for static routes provides a mechanism to track the connectivity to the destination network via the next hop specified in the static route. If connectivity to the destination network is lost, the route state is set to Down, and if available, a different static route (which is in state Up) can be selected for routing traffic.

Similar to IP SLAs tracking for Virtual Router Redundancy Protocol (VRRP), IP SLAs object tracking for static routes also relies on IP SLAs operations to detect connectivity to destination networks. IP SLAs operation sends Internet Control Message Protocol (ICMP) packets to the address defined by the user (a host on the required destination network), and also defines the next hop to use for the ping operation. IP SLAs operation then monitors success or failure of replies from the host. A track object is used to track operation results and set the status to Up or Down, based on the success or failure of the ICMP destination. The track operation is assigned to a static route. If the track status is down, the static route state is set to Down. If track status is Up, the static route state remains Up.

The following describes the main terms used in this article:

- Operation - Each IP SLAs ICMP Echo operation sends a single ICMP Echo request to a target address at a configured frequency rate. It then waits for a response.

- Object State - Each tracking object maintains an operation state. The state is either Up or Down. After object creation, the state is set to Up. The following table specifies the conversion of the IP SLAs operation return code to the object state:

Operation Return Code

Track Operation State

OK

Up

Error

Down

Note: If the IP SLAs operation specified by the track argument is not configured or is its schedule is pending, its state is OK. An application that is bound to a non-existing tracking object will receive the Up state.

- SLA Operation State - This can be either Scheduled, which means the operation begins immediately or Pending, which means it has been created but not activated.

- Timeout value - Specifies the interval time of waiting for the ICMP echo reply message or an ICMP error message.

- Return Code - After an operation has been finished, the operation return code is set according to the following:

- ICMP Echo reply has been received - Return code is set to OK.

- ICMP Error reply has been received - Return code is set to error.

- No any ICMP reply has been received - Return code is set to error.

- Configured Source IP address or Source interface is not accessible - Return code is set to error.

- Tracker - Tracks the results of operations.

- Delay - When the result of an IP SLA operation indicates that the state of the tracking object should change to X from Y, the tracking object performs the following actions:

- The state of the tracking object is not changed and the tracking object starts the delay timer for the interval.

- If during the time that the timer is set, the original state (Y) is received again, the timer is canceled, and the state remains Y.

- If the delay timer is expired, the state of the tracking object is changed to X and the X state is passed to the associated applications.

Applicable Devices | Firmware Version

- SG550XG | 2.3.0.130 (Download latest)

Configure IP SLA Tracking for IPv4 Static Routes

Configure ICMP Echo Operations

Step 1. Log in to the switch console. The default username and password is cisco/cisco. If you have configured a new username or password, enter the credentials instead.

Note: To learn how to access an SMB switch CLI through SSH or Telnet, click here.

Note: The commands may vary depending on the exact model of your switch. In this example, SG550XG-24T is used.

Step 2. From the Privileged EXEC mode of the switch, enter the Global Configuration mode by entering the following:

SG550XG#configure

Step 3. To begin configuring an IP SLA operation and enter IP SLA configuration mode, enter the following:

SG550XG(config)#ip sla [operation]

- operation - This operation number is used to identify the IP SLA operation whose counters you want to clear. The range is from 1 to 64.

Note: You cannot configure a new IP SLAs operation with a number of an existing IP SLAs operation. You must first delete the existing IP SLAs operation.

Note: In this example, IP SLA operation 1 is created.

Step 4. (Optional) To remove an existing IP SLA operation, enter the following:

SG550XG(config)#noip sla [operation]

Step 5. To configure an IP SLA ICMP Echo operation, enter the following:

SG550XG(config-ip-sla)#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.

Note: In this example, the operation target IP address is 192.168.1.1, the source IP address is 192.168.100.126, and the next hop IP address is 192.168.100.1.

Step 6. To set the protocol data size in the payload of the request packet of an IP SLA operation, enter the following:

SG550XG(config-ip-sla-icmp-echo)#request-data-size [bytes]

- bytes - The size of payload of the request packet of the operation in bytes. The range is from 28 to 1472.

Note: The default request packet data size for an ICMP Echo operation is 28 bytes. This data size is the payload portion of the ICMP packet, which makes a 64-byte IP packet.

Note: In this example, the request data size is set to 32 bytes.

Step 7. To set the rate at which a specified IP SLA operation repeats, enter the following:

SG550XG(config-ip-sla-icmp-echo)#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.

Note: In this example, the frequency is set to 30 seconds.

Step 8. To set the amount of time an IP SLA operation waits for a response to its request packet, enter the following:

SG550XG(config-ip-sla-icmp-echo)#timeout [milliseconds]

- 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.

Note: In this example, the timeout is set to 1000 milliseconds.

Step 9. Enter the exit command to exit the IP SLA ICMP Echo context:

SG550XG(config-ip-sla-icmp-echo)#exit

Step 10. To configure the scheduling parameters for a single IP SLA operation, enter the following:

SG550XG(config-ip-sla)#ip sla schedule [operation] life forever start-time now

Note: In this example, operation 1 is configured to run indefinitely and scheduled to start immediately.

Step 11. (Optional) To display the information about all IP SLA operations or a specific operation, enter the following:

SG550XG#show ip sla operation [operation]

- operation - (Optional) The number of the IP SLAs operation for which the details will be displayed. The range is from one to 64.

Note: In this example, IP SLA information for operation 1 is displayed.

You should now have successfully configured and displayed the ICMP Echo statistics of a specific SLA operation on your switch.

Configure SLA Tracking

Step 1. From the Privileged EXEC mode of the switch, enter the Global Configuration mode by entering the following:

SG550XG#configure

Step 2. To track the state of an IP SLA operation and to enter tracking configuration mode, enter the following:

SG550XG(config)#track [object-id] ip sla [operation] state

- object-id - Object number representing the tracking object. The range is from 1 to 64.

- operation - Number of the IP SLAs operation you are tracking. The range is from 1 to 64.

- state - Tracks the operation state.

Note: In this example, object ID 1 is created and associated with operation 1.

Step 3. To configure a period of time in seconds to delay state changes of a tracking object, enter the following:

SG550XG(config-track)#delay {{up [seconds] down [seconds] | up [seconds] | down [seconds]}}

- up seconds - (Optional) Specifies a period of time in seconds to delay state changes from DOWN to UP. The range is from one up to 180 seconds.

- down seconds - (Optional) Specifies a period of time in seconds to delay state changes from UP to DOWN. The range is from one up to 180 seconds.

Note: In this example, the up delay is set to five seconds and the down delay is set to two seconds.

Step 4. (Optional) To clear the IP SLA counters, enter the following:

SG550XG(config)#clear ip sla counters [operation]

- operation - This operation number is used to identify the IP SLA operation whose counters you want to clear. The range is from one to 64.

Step 5. Enter the end command to go back to the Privileged EXEC mode:

Step 6. (Optional) To display the information about all tracking objects or a specific tracking object, enter the following:

SG550XG(config)#show track [track-id]

- object - (Optional) The number of the tracking object for which the details will be displayed. The range is from one to 64.

Note: In this example, IP SLA tracking information for object 1 is displayed.

Step 7. (Optional) In the Privileged EXEC mode of the switch, save the configured settings to the startup configuration file by entering the following:

SG550XG#copy running-config startup-config

Step 8. (Optional) Press Y for Yes or N for No on your keyboard once the Overwrite file [startup-config]  prompt appears.

You should now have successfully configured the IP SLA tracking settings for IPv4 static routes on your switch.

View a video related to this article...

Click here to view other Tech Talks from Cisco