QoS/TOS/COS/dscp Introduction

Source: Internet
Author: User
Tags rfc

Strictly speaking, cos and ToS are only a tag mechanism of QoS.
The QoS range is too large, involving the marking and classification of the incoming data stream and the speed limit, the congestion avoidance and management of the network backbone, and the queue scheduling mechanism at the network egress.
Cos indicates the priority of L2 isl or 802.1Q data frames. The value ranges from 0 to 7;
TOS is the service type tag of layer-3 data packets, which is also 3 bits and ranges from 0 to 7. It can also be used as a priority tag. the other 5 actual indicators are delay, throughput, bit bit of reliability and other features are generally not used. to better control the data stream classification, the last three bit of TOS are extended by using dscp (differential Services Code Point). Therefore, the value range is from 0 to 63.
When implementing QoS policies, the CoS and TOS or dscp usually need a ing mechanism.

ToS:

0 1 2 3 4 5 6 7
+ ----- +
|
| Precedence | TOS | mbz |
|
+ ----- +
The service type (ToS) field includes a 3bit priority subfield (which has been ignored now), a 4bit TOS subfield and a 1bit unused bit, but must be set to 0. The 4bit TOS represents the minimum latency, maximum throughput, maximum reliability, and minimum cost. Only 1bit can be set in 4bit. If all 4bit values are 0, it means a General Service. Rfc1340 [reynoldsandpostel1992] describes how to set these service types for all standard applications. Rfc1349 [almquist1992] corrected the RFC and described the features of the TOS in more detail.

Dscp
Dscp is defined by rfc2474. It renames the 1 byte used by the TOS in the IPv4 header and the 1 byte of the Data class in the IPv6 Header, the new name is the DS field (differentiated services field ). The role of this field has not changed and is still used by QoS tools to mark data. The difference is that IPv4 uses 3 bits, while dscp uses 6 bits, and the minimum is 2 bits.
Rfc2474 defines a maximum of three bits as the Level/category selection code (class selector codepoints, CS). Its meaning is the same as that of IP address priority in IPv4 header, CS0 ~ Cs7 levels are equal to IP priority 0 ~ 7. However, it does not define the specific meaning and use rules of 3rd to 5th bits. Dscp uses 6 bits and can define 64 priorities (0-63 ).
AF
Assured Forwarding (AF) is forwarded by rfc2597 to CS1 ~ Cs4 for further definition. It uses 3rd and 4th bits as the discard priority mark. 01-low discard priority; 10-medium discard priority; 11-High Discard priority. In this way, the same type of data is divided into three levels based on the possibility of being discarded. The following table lists the AF service levels and their corresponding dscp values:
CS1 CS2 CS3 cs4
Low Drop af11 af21 af31 af41
001010 010010 011010 100010
Medium Drop af12 af22 af32 af42
001100 010100 011100 100100
High drop af13 af23 af33 af43
001110 010110 011110 100110
The definition of AF provides convenience for data classification. For example, a carrier can provide users with the 4th medium service agreement (SLA): platinum, gold, silver, copper, and assign bandwidth to the data of each service. Of course, the charges for different services are also different.
EF
Expedited forwarding (EF) is defined by rfc2598 and the dscp value is 46 (101110 ). The EF service is suitable for low packet loss rate, low latency, low jitter, and guaranteed bandwidth services, such as VoIP.
Others
Dscp = 000000 best effort forwarding service level (EF );
Cs = 6 Internetwork control, dscp = 48 (110000)
Cs = 7 intranetwork control, dscp = 56 (111000)
In the configuration command, either a decimal value or a binary value or a name can be used. For example, the 28,011 and af32 statements have the same meaning.

 

In RFC 791, the IP precedence of the OS bit is divided into eight priorities, which can be applied to stream classification. A larger value indicates a higher priority.
0 1 2 3 4 5 6 7
+ ----- +
| Precedence | T3 | T2 | T1 | t0 | M
----- +
111-Network Control
110-Internetwork Control
101-critic/ECP
100-Flash override
011-flash
010-immediate
001-priority
000-routine
However, during actual deployment in the network, these eight priorities are far from enough, so the TOS is redefined in RFC 2474. Define the first six digits as dscp, and the last two digits are retained.
0 1 2 3 4 5 6 7
+ --- +
| Dscp | Cu |
+ --- +
Dscp: Differentiated Services codepoin
Cu: currently unused
However, because dscp and IP precedence coexist, some compatibility problems exist, and dscp is less readable. For example, dscp 43 does not know what values correspond to IP precedence, therefore, dscp is further classified. Dscp is divided into four categories.
Class selector (CS) Aaa 000
Expedited for warding (EF) 101 110
Assured Forwarding (AF) Aaa bb0
Default (be) 000
1. The default dscp is 000 000.
2. The last three digits of CS dscp are 0, that is to say, CS still follows the IP precedence, but CS defines dscp = IP precedence * 8, for example, CS6 = 6*8 = 48, cs7 = 7*8 = 56
3. EF indicates accelerated forwarding. It can also be viewed as an IP address precedence of 5, which is a relatively high priority with a value of 101110 (46 ), however, the RFC does not define why the EF value is 46.
4. AF is divided into two parts: Part A and Part B. If Part A is 3 bits, it can still correspond to IP precedence. If Part B is 2 bits, it indicates discarding and three discarding priorities, it can be applied to red or wred. Currently, Part A has a maximum value of 8 for three bits, but currently only 1 ~ 4. In order to quickly convert to the 10th order, you can use the following method to first divide the 10th order value into an integer (AF), and convert the remainder to a binary value. The first two digits indicate the discard priority, for example, if the remainder of 34/8 = 4 is and the binary value is 010, 34 indicates that af4 discards the datagram whose priority is middle.
If you arrange cs ef af and be, you can find an interesting phenomenon, as shown in the following table. This table is the queue with the most application in reality. According to the precedence priority of the IP address, cs7 is ranked at the highest order to be the lowest. Generally, the usage of these queues depends on the Usage field of the table.
Corresponding service IPv4 priority/EXP/802.1 p dscp (Binary) dscp [DEC] [hex] ToS (hexadecimal) application packet loss rate
Be 0 0 0 0 Internet
AF1 Green 1 001 010 10 [0x0a] 40 [0x28] leased line L
AF1 Green 1 001 100 12 [0x0c] 48 [0x30] leased line m
AF1 Green 1 001 110 14 [0x0e] 56 [0x38] leased line h
Af2 Green 2 010 010 18 [0x12] 72 [0x48] IPTV VOD L
Af2 Green 2 010 100 20 [0x14] 80 [0x50] iptv vod m
Af2 Green 2 010 110 22 [0x16] 88 [0x58] IPTV VOD H
Af3 green 3 011 010 26 [0 A] 104 [0x68] IPTV broadcast L
Af3 green 3 011 100 28 [0x1c] 112 [0x70] IPTV broadcast m
Af3 green 3 011 110 30 [0x1e] 120 [0x78] IPTV broadcast H
Af4 green 4 100 010 34 [0x22] 136 [0x88] NGN/3G singaling L
Af4 green 4 100 100 36 [0x24] 144 [0x90] NGN/3G singaling m
Af4 green 4 100 110 38 [0x26] 152 [0x98] NGN/3G singaling H
EF 5 101 110 46 [0x2e] 184 [0xb8] NGN/3G voice
CS6 (INC) 6 110 000 48 [0x30] 192 [0xc0] Protocol
Cs7 (NC) 7 111 000 56 [0x38] 224 [0xe0] Protocol
1. CS6 and cs7 are used for protocol packets by default. For example, OSPF packets and BGP packets should be guaranteed first, Because protocol interruption may occur if these packets cannot be received. It is also the highest priority message in most manufacturers' hardware queues.
2. EF is used to carry voice traffic. Because voice requires low latency, low jitter, and low packet loss rate, it is the most important packet after Protocol packets.
3. af4 is used to carry the signaling traffic of speech. Here you may wonder why the voice here takes precedence over the signaling traffic? In fact, the signaling here is the call control of the phone, you can endure waiting for several seconds during the connection, but it is absolutely not allowed to interrupt the call. Therefore, voice must take precedence over signaling.
4. af3 can be used to carry the live video traffic of IPTV. the live video has a strong sense of continuity and high throughput.
5. af4 can be used to carry VOD traffic. Compared with live video VOD, af4 requires a low latency or buffer.
6. af5 can carry leased line services that are not very important, because compared with IPTV and voice, IPTV and voice are the most critical services of carriers and must be guaranteed first. Of course, for banks and other businesses that require diamond-level assurance, af4 or even EF can be arranged.
7. The least important business is Internet services, which can be transmitted in the be model.
In the hardware queue, how does one ensure that Protocol packets (data in CS6 and cs7) are transmitted preferentially? When creating a router, data in CS6 and cs7 is usually processed with PQ, which means that the data in the two queues must be transmitted with priority no matter whether or not the following data exists. Other ef-to-AF1 queues use wfq to ensure that all queues can receive bandwidth for transmission.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.