Quality of Service (QoS) are protocols used to prioritize different types of network traffic to ensure clean delivery of critical applications. QoS allows for optimal performance of resource heavy traffic such as voice, video or gaming traffic over a network with limited capacity and bandwidth. QoS improves network performance by lowering latency, limiting packet loss and reducing network jitter along with many other benefits.
There are 3 main categories of QoS:
Best effort - Does not provide any traffic prioritization
Differentiated Services - Distinguishes between different types of traffic allowing for prioritization
Integrated Services - Uses reservation protocols to reserve resources for particular types of traffic
MARKING
QoS marking is a way to tag IP packets based on their type of traffic. This allows devices to differentiate packets based on the application source. Packets are categorized into different classes which tell the network devices how to treat that type of traffic. QoS uses the Type of Service (ToS)field to mark packets. ToS is an 8 bit field in a packet header that designates the QoS services.

The first 3 bits in the ToS field are the IP precedence bits. IP precedence signifies the priority of a packet. The higher the IP precedence, the more priority it will get in congested network traffic. The Type of Service bits are used to apply different levels of delay to a packet as a way to control traffic flow.
The ToS model was the original method used for QoS marking until it was updated in 1998 to the current Distributed Services model:

The first 6 bits have now been reclassified into what is called the Differentiated Services Codepoint (DSCP). DSCP is similar to the previous IP precedence and ToS fields and are used as a way to set different priorities for packets and determine how that traffic is handled by the network devices. The actions taken based on the DSCP values are known as Per-hop Behaviors. There are 21 different DSCP values outline here:

Expedited Forwarding(EF) is the maximum DSCP value and packets marked with this value are given the highest priority.
Best Effort (BE) is the lowest DSCP value (value 000000) and is given the lowest priority.
The remaining DSCP values are divided into Class Selectors (CS)or Assured Forwarding (AF).
With class selectors, the last 3 bits of the DSCP are set to 0 in binary. The first 3 bits represent values 1-7. These bits matchup with the IP precedence values of the earlier model, allowing for backwards compatibility.
The Assured Forwarding classes use the last 3 bits to provide the additional indicator of drop probability. Drop precedence signifies the likelihood of a packet being dropped during periods of high network congestion.
Assured Forwarding is labeled with the designation AF(xy) where x is the class value and y is the drop probability. A higher class value is given higher priority and a higher drop precedence means it is more likely to be dropped.
QUEING
One mechanism QoS uses to manage packet delivery during network congestion is through queuing. With queuing, network devices will store overflow packets during congestion and delay their transmission during times of high congestion. This frees up bandwidth for high priority traffic to flow efficiently while still allowing transmission of less critical traffic when more bandwidth becomes available.
There are several types of queuing used in QoS:
Weighted Round-robin - Packets are sent out from each queue in order, with more data being taken from higher priority queues at a time.
Class-based Weighted Fair Queuing (CB-WFQ) - Is a common type of queuing where a certain percentage of the interface bandwidth is allocate to different queues.
Low Latency Queueing (LLQ) - An extension of CBWFQ that adds priority to the queue scheduler. LLQ can designate one or more queues to be priority queues and favor their traffic to be sent out first. LLQ is particularly useful for voice and video traffic to reduce delay and jitter.
SHAPING AND POLICING
In QoS there are two main ways of managing excess traffic flow on a network, shaping and policing.
Shaping will buffer and delay excess traffic if it goes beyond the set rate. Shaping is typically used on slower speed interfaces

Policing on the other hand will simply drop excess violating traffic when it goes beyond the desired rate. Policing is typically used on higher speed interfaces.

The limit for network traffic is typically defined by the Committed Information Rate (CIR). The CIR is line speed guaranteed over a link, typically set by an ISP.
With traffic shaping, a router will calculate how much traffic, called Committed Burst (Bc), it can send over a given time interval (Tc).
Created with © systeme.io