This is the fifth day of my participation in Gwen Challenge

Qos reviews

QoS (Quality of Service) technology is developed under this background. QoS refers to the quality of service (QoS), which aims to provide end-to-end service quality assurance for different service requirements. QoS does not increase network bandwidth, but is a tool to effectively utilize existing network resources. It allows unequal competition of network resources among different traffic flows. Voice, video and important data applications can be preferentially served in network devices. QoS technology is applied more and more in the Internet nowadays, and its role is more and more important.

DiffServ model

There are many kinds of QoS service models, among which the DiffServ (Differentiated Services) model is the most widely used.

The basic principle of the DiffServ model is to divide the traffic in the network into several classes, each of which receives different treatment, especially when the network is congested and different classes enjoy different levels of treatment. On the network, services of the same type are aggregated and sent in a unified manner to ensure the same QoS indicators, such as delay, jitter, and packet loss rate.

QoS packet classification mode

Simple traffic classification: QoS priority classification

Simple traffic classification uses simple rules to roughly classify packets based on a priority field.

External priority

Also known as packet priority and QoS priority, QoS information is recorded using some specific fields in the packet, such as 802.1P value of VLAN packets and DSCP value of IP packets. Note that the device processes the received packets only according to the internal priorities of the device and provides different QoS services for different services. Therefore, the external priorities are mapped to the internal priorities of the device.

Internal priority

Also known as Class of Service, Per Hop Behavior, or local priority, eight values are supported. The priorities in descending order are CS7, CS6, EF, AF4, AF3, AF2, AF1, and BE. Corresponds to the eight queues of the outgoing port in descending order. Therefore, the internal priority determines the queue to which packets belong inside the device. When the QoS service is configured for a queue, the same QoS service is configured for all packets forwarded through the queue.

Discarding priority

It determines the discarding order of packets when a queue is congested. It has no effect on the mapping between internal priorities and queues. There are three values of discarding priorities, Green, Yellow, and Red, as defined by IEEE in descending order. By default, packets with a higher priority are preferentially discarded when queues are congested.

However, whether packets are preferentially discarded depends on the configuration of parameters. For example, if you configure the WRED discard template to use 50% cache for Green and 100% cache for Red, packets marked Green are discarded before packets marked Red when queue congestion occurs.

Complex traffic classification — MQC traffic classification

Complex traffic classification uses complex rules. For example, packets are classified by quintuple (source IP address, source port number, protocol number, destination IP address, and destination port number). Packets with the same characteristics are classified into one group and QoS services are provided for these packets. Complex traffic classification can be implemented using Modular QoS Command Line Interface (MQC). MQC consists of three elements, namely, traffic classification, traffic behavior, and traffic policy. The three elements can be used together to process traffic in the following ways:

  1. Configure traffic classification and define packet matching rules.
  2. Configure the traffic behavior to determine the packet processing action. Different QoS functions can be implemented according to different traffic behaviors. This article provides detailed configuration guides for traffic statistics configuration, packet filtering configuration, and packet re-marking configuration based on MQC.
  3. Configure a traffic policy and bind the configured traffic classifier and traffic behavior to apply the traffic policy in the specified view.

Relationship between complex traffic classification and simple traffic classification

Complex traffic classification can also identify specific QoS priority packets, but it needs to be implemented by MQC traffic classification. In a word, the packet classification that needs to be configured with MQC traffic classification belongs to complex traffic classification. You do not need to configure MQC traffic classification. Simple traffic classification classifies packets according to the internal priority and discard priority of the external priority mapping of packets.

QoS service technology

Traffic policing, traffic shaping, and interface limiting

To enable limited network resources to serve users more effectively, service traffic entering network devices must be restricted. Traffic policing, traffic shaping, and interface limiting technologies specify the basic bandwidth (limiting) of different traffic passing through network devices, monitor the rate (measuring) of traffic entering network devices, and discard or cache the overspeed traffic (punishing) when the traffic exceeds the basic bandwidth (exceeding the speed limit). In this way, traffic can be limited and resource utilization efficiency can be improved to ensure better service for users.

Traffic policing: Limiting traffic to a specific bandwidth. When the service traffic exceeds the rated bandwidth, the excess traffic is discarded. This prevents unlimited bandwidth usage by individual services or users.

Traffic shaping: A traffic control measure that proactively adjusts the output rate of a flow to ensure that traffic is smoothly transmitted to downstream devices and avoid unnecessary packet discarding and congestion. Unlike traffic policing, which directly discards overspeed packets, traffic shaping can cache overspeed packets to evenly send out packets.

Interface limiting: Limits the total rate of all packets sent or received on an interface. Interface limiting can be implemented by traffic policing or traffic shaping.

Congestion avoidance

Congestion avoidance is a congestion control mechanism that monitors the usage of network resources (such as queues or memory buffers), proactively discards packets when congestion occurs or tends to worsen, and adjusts network traffic to relieve network overload.

Congestion management

Congestion management is a queue-based technology. When network congestion occurs, packets are cached in queues. In this case, congestion management provides a scheduling algorithm to arrange packet forwarding order to ensure that services requiring higher quality QoS services, such as delay-sensitive services, can be scheduled first.

This section describes how to process QoS services

Introduction of MQC

Modular QoS Command Line (MQC) is a Modular QoS Command Line Interface (MQC) that divides packets of a certain type into a class and provides the same service for the same type of packets. It can also provide different services for different types of packets.

The three elements of MQC

MQC consists of three elements: traffic classifier, traffic behavior, and traffic policy.

Flow classification

Traffic classification defines a set of traffic matching rules to classify packets.

The relationship between traffic classification rules can be classified into and or OR. By default, the relationship is OR.

And: If a traffic classifier contains ACL rules, the packet belongs to the traffic classifier only when it matches one ACL rule and all non-ACL rules. If no ACL rules exist in a traffic classification, packets must match all non-ACL rules to belong to the traffic classification.

Or: If a packet matches a rule in the traffic classification, the device considers that the packet belongs to this category.

Popular for

Traffic behavior defines the action for a certain type of packet.

Stream strategy

A traffic policy binds a specified traffic classifier to a traffic behavior and performs the action defined in the traffic behavior for the classified packets

MQC configuration process

  1. Configuring traffic classification: Classifies packets according to certain rules, which is the basis for providing differential services.
  2. Configure traffic behavior: Specify the traffic control action for the packets that meet the traffic classification rules.
  3. Configure a traffic policy: Binds a specified traffic class to a specified traffic behavior to form a complete policy.
  4. Apply traffic policies: Apply traffic policies in the corresponding view as required.

Application of flow policies

  • Apply a traffic policy to the interface

  • Apply a traffic policy to a VLAN

  • Apply traffic policies globally or on boards

  • Apply a traffic policy to the VPN instance

  • Apply traffic policies to QoS groups

Priority mapping configuration

Different packets use different QoS priorities, for example, 802.1P for VLAN packets, DSCP for IP packets, and EXP for MPLS packets. When packets pass through different networks, you need to configure the mapping of these priority fields on gateways connected to different networks to maintain packet priorities.

QoS priority field

Precedence * * * * fields

The ToS (Type of Service) field in the IP packet header consists of eight bits. The Precedence fields of the three bits identify the Precedence of IP**** packets

Bits 0 to 2 indicate the Precedence field, which represents eight Precedence of packet transmission. The values are 7, 6, 5, 4, 3, 2, 1, and 0 in descending order of Precedence. The highest priority is 7 or 6, which is usually reserved for routing or update network control communications. User-level applications can only use 0 to 5.

In addition to the Precedence field, the ToS field contains bits D, T, and R:

  • D bit indicates the Delay requirement (Delay 0 indicates normal Delay and 1 indicates low Delay).
  • T bits indicates Throughput. 0 indicates normal Throughput and 1 indicates high Throughput.
  • R bit indicates Reliability. 0 indicates normal Reliability and 1 indicates high Reliability.
  • Bits 6 and 7 in the ToS field identify the explicit congestion notification field ECN.

DSCP field

RFC1349 redefines the ToS field in IP packets by adding C bits, which represent the Monetary Cost. Later, the IETF DiffServ working group redefined bits 0 to 5 in the ToS field of IPv4 packet headers as DSCP in RFC2474, and renamed the ToS field as Differentiated Service bytes (DS).

The first six bits (0-5 bits) of the DS field are used to distinguish the service Code Point (DSCP), and the last two bits (6 and 7 bits) are reserved bits. The first three bits (0-2 bits) of the DS field are Class Selector Code points (CSCP). The same CSCP value represents a Class DSCP. The DS node selects the corresponding PER-hop Behavior (PHB) based on the DSCP value.

VLANThe frame header802.1 p * * * * priority

Generally, Layer 2 devices exchange VLAN frames. According to IEEE 802.1Q, the PRI**** field (802.1p priority) or Class of Service (CoS) field in the VLAN frame header identifies Service quality requirements.

The 802.1q header contains a 3-bit PRI field and a 1-bit CFI**** field. The PRI field defines eight CoS service priorities. The values are 7****, 6, 5, 4, 3, 2, 1, and ****0 in descending order of priority. The CFI**** field can be used to identify the discard priority of packets.

MPLS EXP field

For MPLS packets, the EXP field in the label information is used as the CoS field of MPLS packets, which is equivalent to the ToS field on an IP network to distinguish service levels of data traffic and support DiffServ on the MPLS network. The EXP field indicates eight transfer priorities. The values in descending order are 7****, 6, 5, 4, 3, 2, 1, and ****0.

Application scenarios of priority mapping

In this way, the device can provide different QoS services for the three types of services based on the priority of voice, video, and data.

  • Configure traffic policies in the inbound direction of SwitchA. Re-mark 802.1p and DSCP priorities for voice, video, and data services. The voice priority is the highest, video priority is the second, and data priority is the lowest.
  • SwitchA maps 802.1p priorities to service levels and colors in the inbound direction. SwitchA provides different QoS services for packets based on service levels and colors.
  • SwitchB maps DSCP priorities to service levels and colors in the inbound direction. SwitchB provides different QoS services for packets based on service levels and colors.

Priority mapping numerical reference documentation

Support.huawei.com/hedex/hdx.d…

Traffic regulation

Traffic Policing (TP) Monitors the rate at which different types of Traffic enter a network and punishes the excess Traffic to ensure that the incoming Traffic is limited within a reasonable range, protecting network resources and users’ interests.

Meter: Measures network traffic through token bucket mechanism and outputs measurement results to Marker.

Marker: According to the measurement results of Meter, the packet is dyed into green, yellow and red colors. By default, green and yellow packets are forwarded. Red **** packets are discarded.

Action: Perform some actions on the packet according to the staining result of the packet by Marker, including:

Pass: forwards the packet whose measurement result is Match.

Remark + pass: Changes the internal priority of a packet whose measurement result is Inconsistent and forwards the packet.

Discard: Discards packets whose measurement result is Inconsistent.

Application of traffic monitoring

Example of configuring traffic policing

Basic configuration

vlan batch 10 20 30

interface GigabitEthernet0/0/1

 port link-type access

 port default vlan 10



interface GigabitEthernet0/0/2

 port link-type access

 port default vlan 20



interface GigabitEthernet0/0/3

 port link-type access

 port default vlan 30
Copy the code

Configuring traffic Classification

Create traffic categories C1 to C3 to classify service flows from servers based on their VLAN ids

traffic classifier c1

 if-match vlan-id 10

traffic classifier c2

 if-match vlan-id 20

traffic classifier c3

 if-match vlan-id 30
Copy the code

Configuring traffic Behavior

Create traffic classes B1 to B3 to monitor traffic of different service flows

traffic behavior b1

 car cir 2000

 statistic enable

traffic behavior b2

 car cir 4000

 statistic enable

traffic behavior b3

 car cir 8000
Copy the code

Configuring traffic Policies

traffic policy p1

 classifier c1 behavior b1

 classifier c2 behavior b2

 classifier c3 behavior b3
Copy the code

Apply a traffic policy to the port

interface g0/0/4

 traffic-policy p1 inbound
Copy the code

Viewing configuration Results

Viewing traffic Policies

View the application of traffic policies

View traffic policy statistics

Traffic shaping

Traffic Shaping (TS) is a measure that proactively adjusts the output Traffic rate. Flow shaping the upstream irregular flow is peak-cutting and valley filling, so that the flow output is relatively stable, so as to solve the congestion problem of downstream equipment. Traffic shaping is usually implemented by using the buffer and token bucket. If the sending rate of packets is too high, the packets are cached in the buffer first and then evenly sent under the control of the token bucket.

The specific processing process is as follows:

  1. When the packets arrive, they are classified and put into different queues.
  2. If the queue to which the packet enters is not configured with queue shaping, the packet is directly sent. Otherwise, go to the next step.
  3. Place tokens into the token bucket at the queue shaping rate set by the user:

If there are enough tokens in the bucket to send a message, the message is sent directly, and the token is reduced as the message is sent.

If there are not enough tokens in the token bucket, the packet is put into the cache queue. If the cache queue is full when the packet is put into the cache queue, the packet is discarded.

When there are packets in the cache queue, they are compared with the number of tokens in the token bucket. If the number of tokens is sufficient to send packets, the packets are forwarded until all the packets in the cache queue are sent.

Application of traffic shaping

When the computing server performs large-scale computing, it sends a large amount of result data to the Web server, resulting in burst traffic in the inbound direction of SwitchA, which may cause congestion in the outbound direction of the interfaces connecting SwithcC and SwitchA. In this case, you can configure traffic shaping on the outbound direction of the interface to evenly send burst traffic to the Web server.

Example of configuring traffic shaping

The Switch is connected to the router through interface 10GE1/0/2. Three servers in the data center provide voice, video, and data services respectively. Packets of different services are identified with 802.1p priorities, and the 802.1p priorities of voice, video, and data packets are 5, 3, and 2. Jitter may occur when packets arrive from 10GE1/0/2. To reduce bandwidth jitter and ensure the bandwidth requirements of various services, the requirements are as follows:

The bandwidth of the interface is 1200 kbit/s.

The guaranteed voice bandwidth is 3000kbit/s and the peak voice bandwidth is 5000kbit/s.

The video bandwidth is 5000kbit/s and the peak bandwidth is 8000kbit/s.

The guaranteed bandwidth is 2000kbit/s and the peak bandwidth is 3000kbit/s.

Basic configuration

vlan batch 10 20 30

interface GigabitEthernet0/0/1

 port link-type access

 port default vlan 10



interface GigabitEthernet0/0/2

 port link-type access

 port default vlan 20



interface GigabitEthernet0/0/3

 port link-type access

 port default vlan 30
Copy the code

Configure rate limiting on outbound interfaces

qos lr outbound cir 12000
Copy the code

Configure traffic shaping in the port queue

 int g0/0/4

 qos queue 2 shaping cir 2000 pir 3000

 qos queue 3 shaping cir 5000 pir 8000

 qos queue 5 shaping cir 3000 pir 5000
Copy the code

Viewing configuration Results

Interface to the speed limit

Interface Rate limiting Line Rate (LR) Limits the total Rate of all packets sent or received on an interface. If you need to limit the rate of all traffic passing through an interface without differentiating packet types, the interface rate limiting function simplifies configuration.

Token buckets are also used for traffic control. If rate limiting is configured on an interface of the device, all packets sent through the interface are first processed by the token bucket of the rate limiting interface. If there are enough tokens in the token bucket, the message can be sent. Otherwise, packets are discarded or cached. In this way, the packet traffic through the interface can be controlled.

Application of interface rate limiting

On a DATA center network, there are multiple services such as voice, video, and data. When a large amount of traffic enters the network, the traffic may be congested due to insufficient bandwidth. Therefore, restrict the traffic entering the network. Configure interface rate limiting on the SwitchB inbound interface to limit traffic to the specified range before it enters the Network, and the excess traffic is discarded.

Congestion avoidance and congestion management

Congestion avoidance

Congestion avoidance is a traffic control mechanism that monitors the usage of network resources (such as queues or memory buffers), proactively discards packets when congestion occurs or tends to worsen, and adjusts network traffic to relieve network overload.

The device supports the following congestion avoidance functions:

The tail discarded

Traditional discarding policies use tail discarding to treat all packets equally without service level discrimination. When congestion occurs, data packets at the end of the queue are discarded until congestion is removed.

This discarding policy causes TCP global synchronization. TCP global synchronization refers to the phenomenon that when multiple queues discard multiple TCP connection packets at the same time, some TCP connections enter the state of congestion avoidance and slow start at the same time, reducing traffic and removing congestion. Then, at some point, these TCP connections will peak at the same time. As a result, network traffic increases and decreases, affecting link utilization.

By default, an interface adopts the tail discard policy.

WRED

Weighted Random Early Detection (WRED) Randomly discards packets based on discarded parameters. WRED can specify different discarding policies for packets of different services in consideration of the benefits of high-priority packets and the relatively low probability of discarding packets. In addition, packets are discarded randomly to reduce the transmission speed of multiple TCP connections at the same time, avoiding TCP global synchronization.

WRED technology sets upper and lower thresholds for the length of each queue and specifies:

When the queue length is smaller than the lower threshold, packets are not discarded.

When the queue length is larger than the upper threshold, all new packets are discarded.

When the queue length is between the lower limit and the upper limit, newly received packets are discarded randomly. The method is to assign a random number to each newly received packet and compare the random number with the discard probability of the current queue. If the random number is greater than the discard probability of the current queue, the packet is discarded. The longer the queue is, the higher the probability that packets are discarded.

Application scenario of congestion avoidance

Because the bandwidth of the WAN is smaller than that of the LAN, congestion may occur on edge devices between the WAN and LAN. In this case, you can configure congestion to prevent congestion and proactively discard packets with lower priorities (such as data packets) to reduce network congestion and ensure normal running of services with higher priorities

Congestion management

Congestion management refers to a traffic control mechanism that adjusts the scheduling order of packets to meet the high QoS requirements of delay-sensitive services when the network is intermittently congested and the delay sensitive services require higher quality QoS services than other services.

The device supports the following congestion management functions:

PQ scheduling

Priority Queue Scheduling is a Queuing technology by which queues are scheduled strictly based on priorities. Only after all packets in the queue with a higher priority are scheduled, the queue with a lower priority has a scheduling opportunity.

In PQ scheduling mode, delay-sensitive services are placed in high-priority queues and other services are placed in low-priority queues to ensure that delay-sensitive services are scheduled first.

The disadvantages of PQ scheduling are as follows: When congestion occurs, if there are packets in the queue with a higher priority for a long time, the packets in the queue with a lower priority are not scheduled.

The WRR scheduling

Weighted Round Robin (WRR) scheduling is called Weighted Round Robin scheduling. WRR schedules queues in turn to ensure that each queue gets a certain service time.

For example, if an interface has eight output queues, WRR sets a weighted value (W7, W6, W5, W4, W3, W2, W1, and W0) for each queue. The weighted value indicates the proportion of resources to be obtained. For a more specific example, a 100M interface can be configured with WRR algorithm weights of 50, 50, 30, 30, 10, 10, 10, 10 (corresponding to W7, W6, W5, W4, W3, W2, W1, and W0) to ensure that the lowest priority queue gets at least 5M bandwidth. This avoids the disadvantage that packets in low-priority queues may not be served for a long time when PQ scheduling is used.

WRR has another advantage: Although multiple queues are scheduled in turn, the service time slice is not fixed for each queue. That is, if a queue is empty, it immediately switches to the next queue for scheduling, so that bandwidth resources can be fully utilized.

WRR scheduling has two disadvantages:

WRR scheduling is based on the number of packets, but users are concerned about bandwidth. If the average packet length of each queue is the same or known, you can configure the WRR weight to obtain the desired bandwidth. However, when the average packet length of a queue changes, users cannot obtain the desired bandwidth by configuring WRR weights.

Delay sensitive services (such as voice services) cannot be scheduled in a timely manner.

The DRR scheduling

The principle of Deficit Round Robin (DRR) scheduling is basically the same as that of WRR.

The difference between DRR scheduling and WRR scheduling is that WRR scheduling schedules packets based on the number of packets, whereas DRR schedules packets based on the length of packets. If the packet length exceeds the scheduling capability of the queue, DRR scheduling allows negative weight to ensure that long packets can be scheduled. However, the queue will not be scheduled in the next round scheduling. The queue will not participate in DRR scheduling until the weight is positive.

PQ + WRR/PQ + DRR scheduling

Both PQ scheduling and WRR/DRR scheduling have their advantages and disadvantages. In THE case of PQ scheduling, packets in low-priority queues cannot obtain bandwidth for a long time. In the case of WRR/DRR scheduling, low-latency services cannot be prioritized. PQ+WRR/PQ+DRR scheduling combines the advantages of the two scheduling modes and overcomes the disadvantages of the two scheduling modes.

You can use THE PQ+WRR/PQ+DRR scheduling mode to schedule important protocol packets and delay-sensitive service packets in the PQ queue and allocate specified bandwidth to the queue. Other packets are put into WRR/DRR scheduling queues according to their priorities, and the queues are cyclically scheduled according to their weights.

WFQ scheduling

Fair Queuing (FQ) aims to share network resources fairly and optimize the delay and jitter of all traffic

PQ + WFQ scheduling

PQ scheduling and WFQ scheduling have their own advantages and disadvantages. In THE case of PQ scheduling alone, packets in low-priority queues may not get bandwidth for a long time, while in the case of WFQ scheduling alone, low-latency services may not get priority scheduling. The “PQ+WFQ” scheduling mode combines the advantages of the two scheduling modes and overcomes their disadvantages.

In the PQ+WFQ scheduling mode, you can place important protocol packets and service packets with low latency requirements into the PQ queue for scheduling and allocate specified bandwidth to the queue. Other packets are put into each queue that uses WFQ scheduling according to their priorities, and each queue is scheduled according to the weight.

Application scenarios of congestion management

You can configure different scheduling modes for different queues in the outbound direction of the device to implement differential services for different services.

Packet filtering

Implement packet filtering through MQC.

A large number of untrusted packets exist on the network. Untrusted packets refer to packets that pose security risks to users or that users do not want to receive. Packet filtering can be deployed to directly discard these packets to improve network security.

If a user considers a certain type of packet to be untrusted, the USER can use MQC to distinguish the packets from other packets and discard them. Similarly, if a user considers a certain type of packet to be trusted, the USER can use MQC to distinguish this type of packet from other packets and allow the packet to pass.

Compared with the blacklist, packet filtering through MQC can classify packets more precisely and is more flexible in network deployment.

Application scenarios of packet filtering

To ensure teaching quality and discipline, the multimedia classroom can only access the FTP server, but the teacher’s office can access both the FTP server and the Web server.

Packet Filtering Instance

implementationPC2Cannot access ****PC4

Configure an ACL

Acl Number 3001 rule 5 permit IP source 192.168.1.1 0 Destination 192.168.1.4 0Copy the code

Configuring traffic Classification

traffic classifier c1

if-match acl 3001
Copy the code

Configuring traffic Behavior

traffic behavior b1

 deny

 statistic enable
Copy the code

Configuring traffic Policies

traffic policy p1

 classifier c1 behavior b1
Copy the code

Apply a traffic policy to the port

interface GigabitEthernet0/0/24

 traffic-policy p1 outbound
Copy the code

results

This article is organized according to huawei official documents!