In networking, DSCP, TOS, CoS, and Precedence are terms related to Quality of Service (QoS) which is used to prioritize certain types of traffic to ensure the performance of critical applications over a network.
Don’t mix up TOS (Type of Service) and COS (Class of Service). TOS is found in the header of an IP packet (layer 3) and COS is found in the header of 802.1Q (layer 2) and is used for Quality of Service on layer 2 switching.
- DSCP (Differentiated Services Code Point): This is part of the IP header and uses 6 bits to classify traffic. DSCP values can be used to provide different levels of service to network traffic1.
- TOS (Type of Service): Originally defined in the IP header to specify the priority and request a route for high throughput, low delay, and high reliability. It has evolved over time and is now largely replaced by DSCP1.
- CoS (Class of Service): This is a 3-bit field found in an Ethernet frame’s VLAN tag (802.1Q). It’s used to prioritize traffic on LANs, especially for trunk links between switches1.
- Precedence: This is part of the older TOS field in the IP header and uses the first 3 bits of the TOS byte. It was used to define the priority of the packet, with higher values indicating more important packets1.
Here’s a bit more detail on how they work:
- IP Precedence: The first 3 bits of the TOS byte were used to define precedence. The higher the value, the more important the IP packet is. In case of congestion, routers would drop low-priority packets first1.
- Type of Service Bits: The next bits (after the precedence bits) in the TOS byte were intended to specify the type of service, such as delay, throughput, and reliability. However, these bits were not widely used and have been superseded by DSCP1.
- DSCP Values: DSCP replaced the TOS byte with a more granular and flexible system. It allows for 64 different traffic classes, which can be used to ensure that critical traffic gets the bandwidth and low-latency treatment it needs2.
In summary, these terms are all about prioritizing traffic to ensure that the most important data gets through the network efficiently, even when the network is congested. They are essential for networks that carry a mix of voice, video, and data traffic, where some types of traffic need to be prioritized over others to maintain quality.
DSCP to ToS conversion table
DSCP Class | DSCP (bin) | DSCP (hex) | DSCP (dec) | ToS (dec) | ToS (hex) | ToS (bin) | ToS Prec. (bin) | ToS Prec. (dec) | ToS Delay Flag | ToS Throghput Flag | ToS Reliability Flag | TOS String Format |
be | 000000 | 0x00 | 0 | 0 | 0x00 | 00000000 | 000 | 0 | 0 | 0 | 0 | |
cs1 | 001000 | 0×08 | 8 | 32 | 0×20 | 00100000 | 001 | 1 | 0 | 0 | 0 | Priority |
af11 | 001010 | 0×0A | 10 | 40 | 0×28 | 00101000 | 001 | 1 | 0 | 1 | 0 | Priority |
af12 | 001100 | 0×0C | 12 | 48 | 0×30 | 00110000 | 001 | 1 | 1 | 0 | 0 | Priority |
af13 | 001110 | 0×0E | 14 | 56 | 0×38 | 00111000 | 001 | 1 | 1 | 1 | 0 | Priority |
cs2 | 010000 | 0×10 | 16 | 64 | 0×40 | 01000000 | 010 | 2 | 0 | 0 | 0 | Immediate |
af21 | 010010 | 0×12 | 18 | 72 | 0×48 | 01001000 | 010 | 2 | 0 | 1 | 0 | Immediate |
af22 | 010100 | 0×14 | 20 | 80 | 0×50 | 01010000 | 010 | 2 | 1 | 0 | 0 | Immediate |
af23 | 010110 | 0×16 | 22 | 88 | 0×58 | 01011000 | 010 | 2 | 1 | 1 | 0 | Immediate |
cs3 | 011000 | 0×18 | 24 | 96 | 0×60 | 01100000 | 011 | 3 | 0 | 0 | 0 | Flash |
af31 | 011010 | 0×1A | 26 | 104 | 0×68 | 01101000 | 011 | 3 | 0 | 1 | 0 | Flash |
af32 | 011100 | 0×1C | 28 | 112 | 0×70 | 01110000 | 011 | 3 | 1 | 0 | 0 | Flash |
af33 | 011110 | 0×1E | 30 | 120 | 0×78 | 01111000 | 011 | 3 | 1 | 1 | 0 | Flash |
cs4 | 100000 | 0×20 | 32 | 128 | 0×80 | 10000000 | 100 | 4 | 0 | 0 | 0 | FlashOverride |
af41 | 100010 | 0×22 | 34 | 136 | 0×88 | 10001000 | 100 | 4 | 0 | 1 | 0 | FlashOverride |
af42 | 100100 | 0×34 | 36 | 144 | 0×90 | 10010000 | 100 | 4 | 1 | 0 | 0 | FlashOverride |
af43 | 100110 | 0×26 | 38 | 152 | 0×98 | 10011000 | 100 | 4 | 1 | 1 | 0 | FlashOverride |
cs5 | 101000 | 0×28 | 40 | 160 | 0xA0 | 10100000 | 101 | 5 | 0 | 0 | 0 | Critical |
ef | 101110 | 0×2E | 46 | 184 | 0xB8 | 10111000 | 101 | 5 | 1 | 1 | 0 | Critical |
cs6 | 110000 | 0×30 | 48 | 192 | 0xC0 | 11000000 | 110 | 6 | 0 | 0 | 0 | Internetworkcontrol |
cs7 | 111000 | 0×38 | 56 | 224 | 0xE0 | 11100000 | 111 | 7 | 0 | 0 | 0 | Networkcontrol |
DSCP Usage best practices
DSCP | Binary | Class | Usage |
---|---|---|---|
0 | 0 | Best Effort | Default traffic, no special QoS treatment. |
8 | 1000 | Class Selector 1 (CS1) | Background traffic, less priority than best effort. |
16 | 10000 | Assured Forwarding 1 (AF11) | Low priority data, less sensitive to delay. |
24 | 11000 | Assured Forwarding 2 (AF21) | Medium priority data, moderate sensitivity to delay. |
32 | 100000 | Assured Forwarding 3 (AF31) | High priority data, sensitive to delay. |
40 | 101000 | Assured Forwarding 4 (AF41) | Critical data, very sensitive to delay. |
46 | 101110 | Expedited Forwarding (EF) | Real-time traffic like voice and video, requires low latency and jitter. |
48 | 11000000 | Network Control | Reserved for network control traffic. |
56 | 11100000 | Network Control | Network control with the highest priority |
Here are some commonly used DSCP values and their typical applications:
- Best Effort (0): This is the default DSCP value and is used for standard, non-critical traffic that doesn’t require special handling.
- Expedited Forwarding (EF – 46): This value is used for low-latency, low-loss, and low-jitter traffic, such as voice over IP (VoIP) and video conferencing.
- Assured Forwarding (AF): These values provide different levels of assurance for delivery:
- AF11 (10): Low priority with low drop probability.
- AF12 (12): Low priority with medium drop probability.
- AF13 (14): Low priority with high drop probability.
- AF21 (18): Medium priority with low drop probability.
- AF22 (20): Medium priority with medium drop probability.
- AF23 (22): Medium priority with high drop probability.
- AF31 (26): High priority with low drop probability.
- AF32 (28): High priority with medium drop probability.
- AF33 (30): High priority with high drop probability.
- AF41 (34): Highest priority with low drop probability.
- AF42 (36): Highest priority with medium drop probability.
- AF43 (38): Highest priority with high drop probability.
- Class Selector (CS): These values are used for backward compatibility with IP precedence:
- CS1 (8): Typically used for background traffic.
- CS2 (16): Used for standard traffic.
- CS3 (24): Used for critical applications.
- CS4 (32): Used for real-time applications.
- CS5 (40): Used for signaling.
- CS6 (48): Used for network control.
- CS7 (56): Used for network control with the highest priority.