Howto to quick test a DSCP based QoS system?
August 29, 2013
You’ve just completed your QoS system, which is based on DSCP for classifying and managing network traffic? Sure there are many sophisticated methods to validate your configuration, but there is also a really simple one which you can do from every Windows or Linux PC as a first check.
And you won’t believe it – the program is called ping
. On Linux use the option -Q
to set the DSCP value of the packets. From the manual:
-Q tos Set Quality of Service -related bits in ICMP datagrams. tos can be either decimal or hex number. Traditionally (RFC1349), these have been interpreted as: 0 for reserved (currently being redefined as congestion control), 1-4 for Type of Service and 5-7 for Precedence. Possible settings for Type of Service are: minimal cost: 0x02, reliability: 0x04, throughput: 0x08, low delay: 0x10. Multiple TOS bits should not be set simultaneously. Possible settings for special Precedence range from priority (0x20) to net control (0xe0). You must be root (CAP_NET_ADMIN capability) to use Critical or higher precedence value. You cannot set bit 0x01 (reserved) unless ECN has been enabled in the kernel. In RFC2474, these fields has been redefined as 8-bit Differentiated Services (DS), consisting of: bits 0-1 of separate data (ECN will be used, here), and bits 2-7 of Differentiated Services Codepoint (DSCP).
On Windows the same is achieved with -v
In both cases you need to provide the Type of Service (TOS) byte. While this is not the wished DSCP value, the ToS byte (or 8-bits) encompasses DSCP. DSCP only uses the first 6 bits of the ToS byte and ignores bits 7 and 8. You’re asking ??hey?? 😉
There is a quite easy way to get from one to the other: DSCP * 4 = TOS, or you can use following table.
Most VoIP systems use AF31(DSCP 26) for signaling (e.g. SIP) and EF (DSCP 46) for voice/media (e.g. RTP). This means for testing we use
ping -Q 104 <ip_address> # for DSCP 26
ping -Q 184 <ip_address> # for DSCP 46
After calling these commands you can easily check your counters if the increment correctly. After this put some load on the connection/link e.g. with FTP or SCP and let the ping run, it should be stable and with a low latency. If not the VoIP stuff with also not work. 😉
This quick test can also help you by an other problem. You need to deploy a system which relies on the fact that the DSCP value in not being stripped away in transit. For this you use the above command and let Wireshark run.
First you need to add the DSCP colum. Just select a packet and then select the DSCP header and use the right mouse button to get to the “Apply as Column” menu entry.
After this you can just look at the DSCP values. If they travel across the network everything is Ok.
10 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress
Entries and comments feeds.
Valid XHTML and CSS.
40 queries. 0.071 seconds.
This is fantastic, I can’t tell you how many bits of over complicated Linux crap i downloaded to achieve this. As an experienced engineer, I am mortified that no one else out there has pointed this simple method out.
Well done.
Comment by Richard — January 13, 2014 #
On Windows doesnt work, from the ping help:
-v TOS Type Of Service (IPv4-only. This setting has been deprecated and has no effect on the type of service field in the IP Header).
Comment by victor — May 14, 2014 #
It works on Windows 7 (and yes only for IPv4), just tried it.
Comment by robert — May 14, 2014 #
On Windows 7, doing “ping -v 0 remote-host” versus “ping -v 255 remote-host” made no difference in WireShark. I still see DSCP as 0x00 either way.
Comment by darren — August 26, 2014 #
See this KB:
http://support.microsoft.com/kb/248611
The other user must have modified the registry entry per the KB, as by default ping won’t be able to change the TOS.
Comment by darren — August 26, 2014 #
[…] Howto to quick test a DSCP based QoS system? […]
Pingback by Cisco QoS - My Blog — September 6, 2015 #
This is nice work superb for me
Comment by prashant — June 29, 2017 #
Hi, well done!
I experimented that it does not work on Linux CentOS 7 with decimals, but works with the binary ping -Q 0xb8 instead of ping -Q 184 for a DSCP of 46.
Comment by theted — May 3, 2018 #
On OSX, you must use the “-z” flag. (This may be the same for other BSD distros as well.)
ping -z
Comment by Hobadee — November 22, 2018 #
Hi,
according to https://www.msxfaq.de/netzwerk/qos/qoswin.htm#manuelle_cscp_tags I have changed those registry keys:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
“DisableUserTOSSetting”=dword:00000000
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\QoS]
“Do not use NLA”=”1”
But still in Windows 10 I cannot use the “-v” argument for ping.
The “-z” argument on macOS works fine.
Comment by pingpong — February 22, 2019 #