DSCP and TOS Converting Table
Posted On Jul 20, 2008 at at 6:06 PM by DophiFor QoS configuration, we usually have to convert various marking types. There are two marking types I usually have to face and setup, one is Differentiated Services Code Point (DSCP) RFC2474 and another one is Type of Server (TOS) RFC791. Because some devices only support DCSP values, while other network devices may support a different method of marking or matching traffic, it's important to know how to convert different values.
In order to know how to convert values between DSCP and TOS, we can refer to the bits map for DSCP and TOS first.
IPv4 TOS Bits
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
PRECEDENCE | PRECEDENCE | PRECEDENCE | D | T | R | 0 | 0 |
• Bits 0-2: PRECEDENCE
– 111 = Network Control
– 110 = Internetwork Control
– 101 = Critical
– 100 = Flash Override
– 011 = Flash
– 010 = Immediate
– 001 = Priority
– 000 = Routine
• Bit 3: DELAY (D), 0 = normal delay, 1 = low delay
• Bit 4: THROUGHPUT (T), 0 = normal throughput, 1 = high throughput
• Bit 5: RELIABILITY (R), 0 = normal reliability, 1 = high reliability
• Bits 6-7: Reserved for future use (RFC-1122 adds bits 6 and 7 to the TOS field, eliminating the MBZ field.)
DSCP Bits
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
DSCP | DSCP | DSCP | DSCP | DSCP | DSCP | 0 | 0 |
• Bits 0-5: Differentiated Service Code Point.
• Bits 6-7: Reserved for future use
As the tables show DCSP and TOS values above, we can make a DSCP-to-TOS mapping table.
In addition, DCSP value can be assigned as a number (6 bits, 0-63) or text string name in Cisco IOS. Available names are default (000000), ef (101110), Assured Forward (af11 till ad43), and Class Selector (cs1 till cs7). Without help command, it's difficult to remember each number mapped to a string name. But, we can convert the text string name into number format with a simple formula. This is a simple formula I usually use to convert them.
AF11 = 001, 01, 0 = 001010 (Binary) = 10 (Decimal)
AF12 = 001, 10, 0 = 001100 (Binary) = 12 (Decimal)
AF21 = 010, 01, 0 = 010010 (Binary) = 18 (Decimal)
This formula just simply divides the numbers of a text string into two parts. The first number is converted to 3 bits binary and second one is converted into 2 bits binary. In the end of binary, I add a "0" to fill in. Finally, we can convert binary to decimal and get a DSCP value.