Ping - Specify ToS

When issuing an extended ping on a Cisco device, one of the options that you can specify is the Type of Service value. If you want to determine the value to be used based on the QoS DSCP value, you must convert the 6-bit DSCP value to the 8 bit DS field.

The following is an example of the various options available in an extended ping:

R1#ping Protocol [ip]: Target IP address: 192.168.12.2 Repeat count [5]: Datagram size [100]: 1500 Timeout in seconds [2]: Extended commands [n]: y Ingress ping [n]: Source address or interface: DSCP Value [0]: Type of service [0]: Set DF bit in IP header? [no]: y Validate reply data? [no]: Data pattern [0x0000ABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 1500-byte ICMP Echos to 192.168.12.2, timeout is 2 seconds: Packet sent with the DF bit set !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms R1#

Notice the Type of Service option that can be specified. Type of Service or ToS is the name of a particular field in the IPv4 header.

Now, when we have a DSCP value, what ToS value must be used here? Remember that the ToS value in the IP header is composed of 8 bits. The ToS value corresponds to the full 8-bit DS field. For this reason, we must convert the DSCP value to the ToS value in the 8-bit field. As shown below, the DS field is separated into two portions, the DSCP and the CU:

qos-ds-field.png

CU stands for “Currently Unused” so those two bits are always set to 0. Now, if the value of DSCP that you want to test is EF (46) for example, you need to determine what decimal value to use in the ToS option of the extended ping.

A decimal value of 46 is 101110 in binary, and it’s 6 bits because the DSCP portion of the DS field is 6 bits… However, for the purposes of generating a ping with a ToS value, we must put in the decimal value of the whole DS field, which is 8 bits. So you must add the two zeros at the end that correspond to the CU. This results in 10111000. If you convert that to decimal you get a value of 184.

Let's try another example. Let’s take a look at CS3 (24). The value of the DSCP in decimal is 24 which in binary is 011000. We add the two zeros of the CU portion and we get 01100000 as the value of the full ToS 8 bit field, which is a value of 96.

https://networklessons.com/quality-of-service/qos-llq-low-latency-queueing-cisco-ios#Verification https://networklessons.com/quality-of-service/ip-precedence-dscp-values#Differentiated_Services

Links to this page: