QoS helps in classify network traffic, prioritize and polish the network traffic and avoid the congestion in network and ensure desirable traffic flow across network.
QoS has following benefits:
- Ensure enough Bandwidth for critical applications like voice, video etc.
- Ensure Low or no packet loss in network
- Helps in mitigating delay, jitter, latency in network
QoS Working model:
QoS has following working model or component which the help of which we can apply QoS in network to ensure desirable network traffic flow.
Classification: It is the method which is used to classify the traffic in to different class based on different characteristics of packet like IP address, VLAN, QoS field, Ethernet header etc.
Marking: Marking is the method through any network packet is marked based on QoS methods like CoS, DSCP value based on its identified class. It is done near to network edge device using MQC method.
Mutation: It is a method change the packet header QoS field in every incoming packet or outgoing packet. This can be done by using mutation mapping table for CoS, DSCP, IP Precedence etc.
Policing: Based on user-defined QoS criteria, this is used to limit the input or output transmission rate of any class of traffic and also by policing we can mar the packet based on QoS Marking features.
Queuing & Scheduling: This provides two methods:
- Congestion Management: Using Queuing Algorithms each packets is marked which is used to determine on which queue packet will be placed. Based on Queuing algorithms different queues are given different treatment.
- Congestion Avoidance: This technique is used to monitor network traffic to avoid network congestion. These technique are implemented on output interface.
Following is the sequence of QoS actions when packet enters on ingress interface and exit from egress interface.
QoS can be configured on network by following MQC steps:
Step1: use class-map command to classify the different network traffic
Step2: use Policy-map, you can configure traffic policy by associating the traffic class in to it.
Step3: use service-policy to attach the policy-map on inbound interface or outbound interface based on traffic moving direction.
NX-OS provides the following three command that are used to define traffic class and policies.
Class-map: used to classify the different class of traffic using match criteria.
Table-map: this table map is used to define mapping rules to set one type of packet field values to another set of packet field values.
Policy-map: This policy map is used to set certain rules based on class of traffic defined by class-map.
Further policy-map can have following sub-types:
- Network qos: this defines CoS values across switches and VDC
- qos: this is basically use for marking, mutation, ingress port trust state, policing etc.
- queuing: this type of policy-map is used for queuing and scheduling
When any packet enters on any interface which has QoS policy applied is matched with class of traffic by class-map command and if match is found the policy action is applied which is defined for that class of traffic. If there is no match found against all configured class-map then default class-default class is matched and its related policies are applied.
Below figure will explains you the above section description.
Let’s discuss one by one QoS working model steps defines above.
Classification and Marking
Before any QoS policies are applied , Network traffic must be classified and sorted in to different class by class-map command and once the traffic is identified and is sorted in to different class marking is used to tag individual packet so that other network devices uses that marking to define actions on every packet as they travel through network.
Traffic classification and marking of packet can be done at layer 2 and layer 3 layer. Let’s discuss how classification and marking is done on layer 2 and layer 3 level.
Classification and Marking at Data-Link Layer:
At data link layer the layer 2 packets contains 802.1Q field which defines 2-bytes field called TPID and TCI. The TCI is further composed of following section like PRI, CFI and VLANID. The PRI defines 3 bits and are used to define QoS at layer 2 level. The PRI is priority bits which can be used to mark packets to specific CoS value (0-7) which is used to set eight different levels of priority on each packet.
Following is the standard definition of PRI bits
- CoS 7 (111): Network
- CoS 6 (110): Internet
- CoS 5 (101): Critical
- CoS 4 (100): Flash-override
- CoS 3 (011): Flash
- CoS 2 (010): immediate
- CoS 1 (001): priority
- CoS 0 (000): routine.
While marking the traffic by CoS value , frame loses the CoS value when the move to non-802.1Q or non-802.1P link mostly on WAN links and due to which there was a need to mark the traffic at network layer which is called as Layer 3 IP DSCP marking.
Classification and Marking at Network Layer:
At Network layer ToS (1 byte) filed is used for QoS marking and there are two method for it and we say as IP Precedence marking and DSCP marking.
IP Precedence: In this method only first 3 bits of ToS were used for marking and to specify the CoS value of each packet. IP Precedence value ranges from 0 to 7 and allow you to partition traffic up to six class and (value 6 and 7 is reserved for internal network use).
Following is the IP=Precedence value mapping table:
Further with advancement of network and application, it was desired to provide more traffic class then another method was used to support more types of traffic class and we say it as Differentiated services.
DiffServ: This method supersedes and is backward compatible with IP Precedence. It used fort 6 bits of ToS field to provide classification of traffic from (0 to 63) of which 32 are commonly used. DiffServ is normally called as DSCP.
Any router looking for Precedence field will just find the first three bits of DSCP filed and find its equivalent value. Let see the below mapping table:
Now DSCP values (range of decimal values) are also defined compatible with IP Precedence. As we are aware that there DSCP uses all 6 bits of ToS value providing 0-63 class.
Let’s now discuss the Per-Hop behavior of DSCP model:
As we are aware that DSCP uses first 6 bits of ToS field, each packet can be classified in to Default PHB, Expedited Forwarding (EH) or Assured Forwarding (AF) category. Let’s discuss how these bits are set to define any packet in to these category or class and then further in to sub-category or sub-class
Default PHB: This is used for Best Effort traffic and out if six bits first 3 bits are set to 0 and next 3 bits can be anything between 0 and 1.
Expedited Forwarding: This EF class 2 to 7 bits of DSCP is used for low-delay service and provides the lowest possible delay to delay-sensitive applications. The EF class is used to provide guarantee bandwidth and also polish the bandwidth when congestion occurs. Those packet who wants to be classified with EF class should be marked with binary value “101110”.
Assured Forwarding ( AF ): When any packet needs guaranteed bandwidth service we use the AF marking on packets , in this first 5 bits can be any combination of 0 and 1 and last bits is always 0.
AF allows access to extra bandwidth if available and any packet requiring AF marking should be marked with DSCP value “aaadd0” where aaa is the number of class and dd is drop probability.
Now there are four standard AF class and each AF class is assigned an IP precedence and has three drop probabilities: Low , medium and High. The AF number can be calculated based on following formula.
AFXY : where X = IP Precedence value (1-4 are used for AF class) and Y = drop precedence value (1,2,or 3 ).
So let’s suppose in AFXY : if X is 1,2,3,4 and for each x Y can be allocated to three value (1, 2, and 3) table will looks like as follows:
So here we see that for each AF1, AF2 and AF3 and AF class three are three drop probability sub class and traffic based on class and sub class can be marked and classified.
Below is the table which shows the binary and decimal representation of DSCP and also maps the IP Precedence and PHB value for all DSCP values.