Hello everyone,
In this series, we will introduce the most widely used QoS model in the live network – the DiffServ network model.
First, let's take a look at IP precedence and DSCP.
As is well known, there is a ToS field (8 bits) in the IP packet header, which is mainly used for packet priority control. In fact, packet priority control is divided into two modes, IP priority and DSCP.
The IP precedence uses the first 3 bits of the ToS field. There are 8 priority levels. From 0 to 7, 0 has the lowest priority and 7 has the highest priority.
But in the current network, 8 priority levels are not enough. Therefore, DSCP extends it to 6bit. It uses the first 6 bits of the ToS field to distinguish packets. A total of 64 priority levels, from 0 to 63, as IP precedence, 0 is the lowest priority level and 63 is the highest priority level.
In the DiffServ model,PHB(Per-hop Behavior) describes the externally observable forwarding treatment applied at a differentiated services-compliant node to a behavior aggregate. A DS node performs the same PHB for packets with the same DSCP value. The PHB defines some forwarding behaviors but does not specify the implementation mode.
At present, the IETF defines four types of PHBs: Class Selector (CS), Expedited Forwarding (EF), Assured Forwarding (AF), and best-effort (BE). BE PHB is the default.
PHB | DSCP Value | Description |
CS | XXX000, where X is 0 or 1. When Xs are all 0s, this PHB is the default PHB. For the CS PHB, the DSCP value is equal to the IP precedence value multiplied by 8. For example, CS6 = 6 x 8 and CS7 = 7 x 8. | The CS PHB indicates the same service class as the IP precedence value. |
EF | 101110 | The EF PHB defines that the rate at which packets are sent from any DS node must be higher than or equal to the specified rate. The EF PHB cannot be re-marked in the DS domain but can be re-marked on the edge nodes. The EF PHB functions the same as a virtual leased line to provide services with a low packet loss rate, delay, and jitter and a specific bandwidth. The EF PHB applies to real-time services that require a short delay, low jitter, and low packet loss rate, such as video, voice, and video conferencing. |
AF | XXXYY0, where X is 0 or 1. XXX indicates the IP precedence. YY indicates the drop precedence. The larger the value, the higher the drop priority. Currently, four AF classes with three levels of drop precedence in each AF class are defined for general use. An IP packet that belongs to an AF class i and has drop precedence j is marked with the AF codepoint AFij, where i ranges from 1 to 4 and j ranges from 1 to 3. | The AF PHB defines that traffic that exceeds the specified bandwidth (as agreed to by users and an ISP) can be forwarded. Traffic that does not exceed the bandwidth specification is forwarded as required, and the traffic that exceeds the bandwidth specification is forwarded at a lower priority. Carriers provide differentiated bandwidth resources for the AF PHB. After the AF PHB is allocated sufficient bandwidths, other data can consume the remaining bandwidths. The AF PHB applies to services that require a short delay, low packet loss rate, and high reliability, such as e-commerce and VPN services. |
BE | 000000 | The BE PHB focuses only on whether packets can reach the destination, regardless of the transmission performance. Traditional IP packets can be transmitted in BE mode. Any router must support the BE PHB. |
Since both the DSCP and the IP precedence use the first 3 bits of the ToS field, there is a correspondence between the DSCP priority and the IP precedence. as follows:
DSCP Name | DS Field Value (Dec) | IP Precedence: Description |
CS0 | 0 | 0: Best Effort |
CS1, AF11-13 | 8,10,12,14 | 1: Priority |
CS2, AF21-23 | 16,18,20,22 | 2: Immediate |
CS3, AF31-33 | 24,26,28,30 | 3: Flash - mainly used for voice signaling |
CS4, AF41-43 | 32,34,36,38 | 4: Flash Override |
CS5, EF | 40,46 | 5: Critical - mainly used for voice RTP |
CS6 | 48 | 6: Internetwork Control |
CS7 | 56 | 7: Network Control |
So, how could we switch between the CS, AF and IP precedence? Take a look at the example below:
Suppose we get the AF33, translate 33 into binary number, equals 011110
(Notice: 33 should be considered as two separate number, which is 3 and 3, the first 3 is translated into 011, the second one is translated into 110, because the last bit is always 0.).
Since the last three bits of the CS is 0, so the corresponding CS is 011000, that is CS3.
For the CS PHB, the DSCP value is equal to the IP precedence value multiplied by 8, so the corresponding IP precedence is 24/8=3.