We have different options for marking the traffic.
Class of Service (CoS) – this is L2 marking. It uses the priority bits in the vlan tag 802.1Q. 3 bits make for us 8 classes available valued from 0 to 7. However cisco says 6 and 7 is reserved so 6 values left for us. When using cisco phones they mark the traffic automatically with the value of 5.
802.1p – There is also different way how to mark the traffic on L2. It is called 802.1p. With this you can mark the traffic without need to have a trunk link. However it is very similar to vlan tagging because it adds the 16 bytes overhead to frame and uses the 3 bits from the priority, however the VLAN ID field contains all zeroes.
However what happen to the frame when it reach the router? The marking information is LOST. Its same like with the MAC address. Marking will be rewriten to all zeros. So when our L2 traffic is reaching the L3 boundary we need to convert this L2 CoS marking to L3 marking.
Type of Service (ToS) Byte – there is a byte inside a IPv4 packet called a ToS byte. Similar byte is inside IPv6 packet called Traffic class byte. Here we can mark the packet. In past days we were using just the first 3 bits having the same number as in CoS. It is called IP Precedence. And again cisco wont allow us to use the 6 and 7 bit. That doesnt bring us much scalability does it? Because of this the IETF standard came to QoS and specify the DSCP marking. The differentiated services code point marking. And that uses 6 bits. Now we have 64 values to our disposal. However now another problem arises. When we have so many values how we synchronize it between different autonomous systems? For example I will be using value 23 as a best traffic and my neighbor will use it as the worst traffic ever. There is no relative level of priority between ourselfs. Luckily IETF solved also this problem and preselected 21 different DSCP values and gave names to them. They are called „Per Hop Behaviors“ or PHB.
DSCP values
There are 4 categories of these PHBs:
- Default – 0 (binary 000 000)
- EF (Expedited Forwarding) – 46 (binarry 101 110)
- Class selector – CS1 to CS7 where the number represent first three bits of DSCP.
- Assured Forwarding – there are 12 of these values.
You have to notice that IETF didnt pick the number just from their head. They were thinking also about compatibility between IP precedence and DSCP. If someone is using IP Precedence it will look just to the first 3 bites. And what it will see? For example in EF 101 which is value of 5 and that value is allowed (6,7 is not). In fact is it the highest value in IP Precedence. So IETF chooses this value with regards to the IP Precedence and CoS limits and regulations.
If we want to have full compatibility between IP Precedence and DSCP because in our network some routers speak via IP Precedence and some via DSCP we can use Class Selectors. There are 7 of these. CS1 to CS7. CS1 is in binary 001 000. CS2 in binary is 010 000. So they are indistinguishable from the regular IP Precedence!
Assured forwading use 4 classes CS1-CS4 and the class number means the same as in Class selector. So the class can influence the priority. However Assured forwading goes one step further and brings another thing. Look at the table and you see that each class is also categorized by Drop probability. With this you can influence what will be dropped most probably when your queue is full! Also the name for AF can be easily read. The first number is the Queue class second number is probability. So AF22 means second class with medium probability, AF13 means first class with high probability, etc 😉
Now question arrises. What will be dropped more probably? The traffic marked with better class, but medium probability or traffic with worse class but high probability? Example is AF22 or AF13? AF13 will be dropped more probably. The traffic class has NO EFFECT on drop probability.
How you can write the AF names in binary? The IETF said that the last bit is always 0. First free bits are class and last two bits are the probability. So for example the AF43 in binary is 100110. Easy! 😉 Then we can convert this binary to decimal which is in this case 38 😉