Friday, May 14, 2010

Using the PING TOS field

The extended ping command can be useful when testing MQC policies. The IP header TOS value of packets can be explicitly set, and hence MQC configuration can subsequently be tested.

The extended ping command expects the TOS value to be set using a decimal value (see below).


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

If you only know or are given the DSCP marking the question then arises 'How to i derive the TOS value from the DSCP marking?

This can easily be calculated when remembering the DSCP marking denotes the decimal value of the first 6 bits of the IP TOS header field. The last 2 bits of the TOS field are not used, so will always be zero.

As an example DSCP 46 equates to 101110 binary. To convert to a TOS value simply append the last two zero bits and convert back to decimal. Therefore 101110 becomes10111000 and when converted back to decimal this becomes 184. This is the decimal TOS representation of DSCP 46.

5 comments:

kishor said...

very good example for calculating the tos value.........

Paul said...

Easier way is to multiply the DSCP value by 4 to get the TOS value. Because adding two binary 0's to a value is merely quadrupling it. In this case 46 x 4 = 184, woohoo.

richsd1 said...

Hi Paul
DSCP * 4 = TOS. I like it. Thanks

Paul said...

But that's a good idea though, I never thought of using the ping cmd to do this.

se3s2a said...

IS VERY GOOD..............................