Layer 3 Marking for QoS

Posted by Bradley | QoS | Thursday 9 July 2009 22:30

IP packets are classified for QoS in the Type of Service (ToS) byte, the original method of marking was with IP Precedence (IPP), its defined in the early RFC791. The 3 high order bits were used to define the precedence and their meanings are summarized in the table below;

Value Binary Precedence
0 000 Routine
1 001 Priority
2 010 Immediate
3 011 Flash
4 100 Flash Override
5 101 CRITIC/ECP
6 110 Internetwork Control
7 111 Network Control

The next 3 bits after the precedence were flags in bit order for Delay, throughput, and reliability, where if they were set to 1 would request either low delay, low throughput or low reliability. The final 2 low order bits were reserved.

Then along came Differentiated Services (DiffServ) with RFC2475, which needed more than 3 bits to correctly classify the information so the upper 6 bits in the ToS byte were replaced with Differentiated Services Code Point (DSCP), and the lower 2 bits used for QoS Explicit Congestion Notification (ECN). The DSCP and associated actions are termed Per Hop Behavior (PHB).

There are 4 main types of PHB, ill go through each one in turn.

Default PHB – This is for traffic that does not meet the other criterion and is essentially a best effort method of forwarding. The DSCP value to request this is 000000.

Expedited Forwarding (EF) – Expedited forwarding if a fancy term for getting that packet across the network as quickly as possible, the EF queue is usually policed to ensure that the queue does not utilize to much bandwidth and starve other queues.

Assured Forwarding (AF) – Assured forwarding has 4 classes of of queuing priority and 3 drop priorities, AF classes are represented in the format AF(1-4)(1-3) eg AF41 represents a class with a high priority and a low drop probability.

This table is from Page 410, of CCIE Routing & Switching 3rd Edition from Cisco Press;

Queue Class Low Drop Probability Medium Drop Probability High Drop Probability
Name/Decimal/Binary Name/Decimal/Binary Name/Decimal/Binary
1 AF11 / 10 / 001010 AF12 / 12 / 001100 AF13 / 14 / 001110
2 AF21 / 11 / 010010 AF22 / 20 / 010100 AF23 / 22 / 010110
3 AF31 / 26 / 011010 AF32 / 28 / 011100 AF33 / 30 / 011110
4 AF41 / 34 / 100010 AF42 / 36 / 100100 AF43 / 38 / 100110

Class Selector PHBs – This is for backwards compatibility with IPP, each Class Selector is equivalent to the binary value of the 3 precedence bits eg CS0 is 000, and CS7 is 111

Classification & Marking for QoS

Posted by Bradley | QoS | Tuesday 29 July 2008 16:49

To improve performance of network devices packets should be marked as close to the source of the traffic, all network devices can then make decisions based upon those markings and do not need to reclassify or remark the traffic.

ToS Byte & IPP

RFC 791 defines the ToS (Type of Service) byte for “internet service quality selection”, thats QoS to you and me. The ToS byte initially used the first 3 bits to define the IP Precedence (IPP), the remaining bits where defined (except for the final bit) but rarely used.

Differentiated Services

Later on a standards were created for Differentiated Services (DiffServ), it went a little further and defined what each hop should do with the packet called Per Hop Behavior (PHB). The standard renamed the first 6 bits of the ToS byte to Differentiated Services Code Point (DSCP). The DSCP was used it for the selection of class in DiffServ, the first 3 bits are used for backwards compatibility with IPP. The final 2 bits were not defined but later used for Explicit Congestion Notification (apparently Vista is the first desktop OS which incorporates support for the ECN bits, but I don’t have a source for that info and its just hear say).

Please see the table below for the binary values of IPP/DSCP and the DSCP Class Selector values compared to the IPP names.

IPP Name IPP Binary DSCP Name
Routine 000 CS0 / “Default”
Priority 001 CS1
Immediate 010 CS2
Flash 011 CS3
Flash Override 100 CS4
Critical 101 CS5
Internetwork Control 110 CS6
Network Control 111 CS7

Assured Forwarding

Assured Forwarding (AF) is very common today, it defines the 6 DSCP bits to be used into 12 values. The 12 values for AF allows for 4 classes and 3 levels of drop probability for each class. AF DSCPs are shorted to the following format AFxy, x defines which queue and y defines the drop probability.

This handy table is from Page 410, of CCIE Routing & Switching 3rd Edition from Cisco Press;

Queue Class Low Drop Probability Medium Drop Probability High Drop Probability
Name/Decimal/Binary Name/Decimal/Binary Name/Decimal/Binary
1 AF11 / 10 / 001010 AF12 / 12 / 001100 AF13 / 14 / 001110
2 AF21 / 11 / 010010 AF22 / 20 / 010100 AF23 / 22 / 010110
3 AF31 / 26 / 011010 AF32 / 28 / 011100 AF33 / 30 / 011110
4 AF41 / 34 / 100010 AF42 / 36 / 100100 AF43 / 38 / 100110

Its really easy to turn the binary into the the AFxy format once you realise that the first 3 bits are for class and the final 3 bits in the DSCP field are are drop probability.

I have just gone through some of the methods of marking IP packets but not in that much detail, there are of course many other methods of marking traffic such as with the Discard Eligible (DE) bit in Frame Relay, Cell Loss Priority (CLP) in ATM, the MPLS Experiential bits, & CoS in the trunking headers.