In the classification process of QoS, the most important thing is to configure different priorities for different packets, and sort the packets of inbound switches by priority, then, the switch executes the corresponding QoS behavior based on the priority value. The first step of data packet priority sorting is to classify data packets. Classification Rules can use the priority bits of the 802.1p priority field and the ToS (Type of Service) field of the IP packet header in VLAN frames to identify traffic with different priority characteristics; you can also set a stream classification policy by the Network Manager, such as integrating the source address, Destination Address, MAC address, IP protocol, or application port number to classify streams. Generally, the classification is based on the header information of the encapsulated message. It is rare to use the content of the packet as the classification standard. The classification result has no range restrictions. It can be a narrow range determined by a quintuple (Source Address, source port number, Protocol Number, destination address, and destination port number, it can also be all packets sent to a certain network segment. 10.1.2 priority in L2 VLAN frames the priority in L2 frames is specific to VLAN frames because normal L2 frames do not carry priority fields. The priority in a VLAN frame is what we call the 802.1p priority (defined by the IEEE 802.1p Protocol). It is located in the "PRI" subfield of the "802.1Q Tag" field in the VLAN frame, as shown in 10-1. Figure 10-1 The 802.1p priority field IEEE 802.1p in a VLAN frame is an extended protocol of the IEEE 802.1Q (VLAN label technology) standard. They work collaboratively. The emergence of IEEE 802.1p enables L2 switches to provide traffic priority and Dynamic Multicast filtering services. The traffic priority specification works on the MAC layer, the multicast traffic filtering function ensures that the traffic does not exceed the L2 switching network range. The IEEE 802.1Q standard defines the labels added to an Ethernet MAC frame, but does not define or use priority fields, this field is defined in the Ethernet protocol header of an Ethernet MAC frame modified using IEEE 802.1p. The 802.1p priority lies in the layer-2 VLAN frame header, which is suitable for scenarios where the layer-3 packet header does not need to be analyzed, but QoS needs to be ensured in the layer-2 environment. The four-byte 802.1Q Tag header contains two bytes of TPID (Tag Protocol Identifier, Tag Protocol Identifier, value: 0x8100) and two bytes of TCI (Tag Control Information, label control information), see Figure 10-1. In the TCI section, the PRI subfield is the 802.1p priority, also known as the CoS priority. It consists of three digits, with a value range of 0 ~ 7. A total of 8 priorities are supported. The highest priority is 7, which is applied to network management and key network traffic. For example, Route Selection Information Protocol (RIP) and Open Shortest Path priority (OSPF) protocol route table update; priority 6 and 5 are mainly used for delay-sensitive applications, which correspond to interactive voice and video respectively. Priority 4 to 1 are mainly used for controlled-load) applications, streaming multimedia, and business-critical traffic, such as SAP data and background traffic. Priority 0 is the default value and is automatically enabled if other priority values are not set. 10.1.3 priority of layer-3 IP packets the layer-2 VLAN frame priority described above is relatively simple, which is identified by three sub-fields of PRI. There are eight priorities, but in layer-3 IP packets, the description of priority is much more complicated, and there are two different priority types and different identification methods in different periods. 1. In the early RFC 791 standard, the IP address priority of the ToS field is determined by the Type of Service (ToS) field. ToS is a field (one byte in total) in the IP header of an IP packet. It is used to specify the IP packet priority. The device will first forward packets with a high ToS value. The ToS field has a total of eight bytes, including three parts: 0 ~ 2 A total of three digits are used to define the IP address priority (IP Precedence), ToS, And the last fixed 0 BITs, as shown in 10-2. Figure 10-2 Structure of the ToS field in the IP header l IP Precedence part of the IP priority Part Three in total, value range: 0 ~ 7 (the higher the value, the higher the priority ). The eight values are routine (normal, with a value of 000), priority (priority, with a value of 001), and immediate (fast, with a value of 010) flash (flash speed, value: 011), flash-override (rapid, value: 100), critical (Key, value: 101), internetwork control (inter-network control, value: 110) and network control (network control, value: 111), corresponding to numbers 0 ~ 7. Among the above IP priority values, 6 and 7 are generally reserved for the use of network control data, such as routing; 5 is recommended for the use of voice data; 4 is recommended for video conferencing and video streaming; 3. Recommended for voice control data; 1 and 2 recommended for data services; 0 is the default value. When configuring the IP priority, you can use 0 ~ 7. You can also use the corresponding priority name. L in the ToS field of the IP header, the four digits following the IP priority field are the ToS section, representing the service type to be provided for the corresponding packet (the characteristic requirements of the packet are highlighted ). In RFC 791, only 3rd ~ Five bits, representing the latency, Throughput, and Reliability of the IP packet respectively) requirements for these three features (only one of the three packets may be set to 1, indicating that the IP packet has special requirements in the corresponding aspect ). Later, the RFC1349 standard was extended to 6th bits, indicating the characteristics of the IP package in terms of path overhead (cost. It should be noted that, although the ToS part has four digits, only one of the four digits in each IP package can be 1, so there are actually only five values (including all 0 values ). The names and values corresponding to these five values are: normal (General Service, value: 0000), min-monetary-cost (minimum overhead, value: 0001, minimum path overhead), max-reliability (maximum reliability, 0010, maximum reliability), max-throughput (maximum throughput, value: 0100, maximum transmission rate) min-delay (minimum latency, with a value of 1000 to minimize transmission latency ). 2. in the new RFC 2474 standard, the DSCP priority and PHB of the DS field redefined the ToS field in the original IP packet header and changed it to the DS (Differentiated Services, differential service) field, it is also a total of 8 bytes ). In general, 0th ~ Five digits (six digits in total) are used to indicate the priority of DSCP (Differentiated Services Code Point). The value range is 0 ~ 63. A total of 64 priority values can be identified (the greater the value, the higher the priority). The last two values are retained for displaying Congestion Notification (ECN), as shown in 10-3.
Figure 10-3 The DS field structure in the IP header was later defined in the ietf rfc 2597 standard PHB (Per-Hop Behavior, Hop-by-Hop Behavior ), the PHB value can be used to determine the forwarding behavior of IP packets at the gateway. The PHB value is 0th ~ 4-digit ID, 0th ~ Two digits are used to identify the PHB Class value. A total of eight values are represented as CS0 ~ CS7 corresponds to the eight IP address priority values defined in RFC 791, while ~ Four digits are used to identify the PHB Class Selector value. See figure 10-3. The PHB category value and PHB Category Selection value form a PHB value. The DSCP value is composed of five digits of PHB plus 5th digits (fixed to 0), but the three digits in the PHB category cannot all be 0. RFC 2597 defines four types of PHB (called af phb) that ensure Forwarding (Assured Forwarding, AF ). It uses 0th ~ 2-bit defines the PHB category, and the 3rd and 4 digits in the DS field represent the "discard priority" of the message, expressed with AF (x, y), where x represents the stream classification, y indicates the corresponding discard priority. [Note] the so-called "ensure forwarding" means that the Administrator is allowed to provide as much transmission quality as possible without exceeding the permitted rate of the line, however, data packets may be discarded when the traffic exceeds the user's line rate. In ensuring the forwarding of PHB, four PHB categories (namely, "stream classification") are defined. Their values are 001, 010, 011, and 100 (corresponding to CS1 ~ CS4), which itself represents the different priorities of the stream (the greater the value, the higher the forwarding priority), and then through the discard priority values of 3rd and 4 (take the three values not 0, the values are 01, 10, and 11 respectively. The higher the value, the higher the discard priority. They form a group of four AF levels for the four PHB categories. Their corresponding AF values and corresponding DSCP values are shown in Table 10-1 (the 5th-bit value is fixed to 0 at this time ). Table 10-1 four af phb grades discard priority Class 1 Class 2 Class 3 Class 4 low discard priority AF11 (DSCP 10): 001010AF21 (DSCP 18): 010010AF31 (DSCP 26 ): 011010AF41 (DSCP 34): 100010 discard priority AF12 (DSCP 12): 001100AF22 (DSCP 20): 010100AF32 (DSCP 28): 011100AF42 (DSCP 36 ): 100100 High Discard priority AF13 (DSCP 14): 001110AF23 (DSCP 22): 010110AF33 (DSCP 30): 011110AF43 (DSCP 38): 100110 and later in RFC 3246 standard, define an accelerated Forwarding (Expedited Forwarding, EF) PHB, corresponding to CS5, that is, 0th ~ In the DS Field ~ The two-digit value is 101, 3rd ~ The value of 4 bits is fixed to 11 and the value of 5th bits is fixed to 0, so that the corresponding DSCP value is 46 (101110 ). Ef phb features low latency, low overhead, and low jitter. It is suitable for voice, video, and other real-time services and generally has a queue with higher priority than other communication types. In addition to the AF and EF described above, there is also a default PHB, that is, the best service type, which corresponds to the DSCP value of 000000, that is, the decimal 0. In addition, CS6 and CS7 are defined. CS6 is used for inter-network control. The corresponding DSCP is 110000, that is, 48 in decimal format. CS7 is used for intra-network control, and the corresponding DSCP value is 111000, that is, 56 in decimal format. When configuring the DSCP priority, you can use the corresponding DSCP names, such as CS6, CS7, AF11, and AF12 (in CS1 ~ Each CS4 contains a set of DSCP values, so you must specify a specific DSCP name). You can also use the corresponding DSCP decimal values, such as 48 and 56. 3. the relationship between IP priority and DSCP priority is backward compatible with IP priority. When a device that supports DSCP receives packets that only support IP priority in ToS, by default, there is a ing relationship between them, as shown in table 10-2. Of course, if the device only supports the IP address priority of ToS, The DSCP priority value in the packet cannot be identified by default, in this case, you must configure the Ding between the DSCP priority and the IP address priority on the receiving device. Table 10-3 Relationship between IP priority and DSCP priority value