Networks Horizon

share

Thursday 26 April 2012


Quality of Service (QoS)-Part9

IP Precedence and DSCP

Why Marking necessary?

Though Cisco routers have inbuilt capability of classifying and re-classifying on every hop on the way but the problem is we have to look inside the packet on every hop, which is processor intensive and can become a big problem in a large network such as ISP.


So It is always good to mark your traffic at trust boundary. Trust boundary is the first place that you decide to mark your traffic. That marking will be trusted throughout the network. First device in the trust boundary will classify and mark the traffic and rest of the devices in the path can take decision based on particular marking and that is without opening whole box of packet. In a large ISP network, this is a scalable solution.


According to Cisco, We should mark the traffic as closed to the source as we possibly can. So trust boundary should be closer to the source. That device might be the source device, any switch or the router.


But in practical life, based on requirement, the best idea would be to apply QoS before the traffic enters to the Wide Area Network because this is the point which is most likely to be congested. Another way, it would be better idea to apply QoS on LAN devices , switches, PCs or QoS enable IP phones only in case, if LAN network is prone to be congested frequently. Another thing that might prevent applying QoS in LAN is that most of the devices in LAN are not QoS capable.
Layer 2 and Layer 3 Marking
Layer 2 Marking
Below layer 2 markings are stripped at router before applying QoS in explosed IP packet.
Class of Service (CoS)
Frame-relay DE bit
ATM CLP bit
MPLS Exp bits


Layer 3 Marking
Below markings are encapsulated in layer 2 frames/Cells/labels and do not change while passing through the routers. So it more reliable. 
  • IP Precedence
  • DSCP (Differenciate Services Code Point)

IP Precedence

It is placed in layer 3 header in Type of Service (ToS) filed. It is 8 bits field. But IP Precedence only use first 3 bits for this field. Therefore , IP Precedence marks with values 0-7.  So, we can say converting all the available 8 bits from binary to decimal, we can get 0-255 values but IP Precedence only uses 0-7 values. Because we can have maximum 7 values with 3 bits.

Binary review:

first bit from right ON means=1
second bit from right ON means=2
third bit from right ON means=4
fourth bit from right ON means=8
fifth bit from the right ON means=16
Sixth bit form the right ON means=32
Seventh bit from the right ON means=64
Eighth bit from the right ON means=128
So:
0=000
1=001=1
2-010=2
3=011=0+1
4=100=4
5=101=4+1
6=110=4+2
7=111=4+2+1
Thus,
Available IP precedence classes :


7- Reserved  (BPDU,Hello)===111
6- Reserved  (routing protocol/Synchronisation protocol)===110
5- Voice Bearer======================================== 101
4- Video-conferencing================================== 100
3- Call-signalling        (Provides statstics for the audio calls)= 011
2- High Priority Data    (like Citix, SAP)=================== 010
1- Medium-priority Data ===============================  001  
0- Best-Efforts Data  (Web surfing, peer-to-peer)=========   000


DSCP (Differentiated Services Code Point)


DSCP is new method of marking. DSCP uses all available 8 bits of ToS filed but to maintain 
compatibilty with old IP Precedence standards, designers introduce new method so that IP 
precedence only router can understand the importance of of the packet coming from DSCP configured router. IN DSCP, they took these 8 bits and divided into 3 groups. First group will contain first 3 bits, Second group contains another 3 bits and third group contains rest of 2 bits out of 8 bits


First group is called Major Class
Second group is called Minfor class or Drop Precedence class
Third group is called ECN (Explicit Congestion Notification) bits


First two groups are mainly responsible for QoS marking. It means first 6 bits can be used in 
DSCP. If we convert it to decimal, we can have 0-63 values in DSCP.
111111=63  


Instead of using all 64 values (0-63), Cisco defined two classes-major and minor to make it backward compatible with IP Precedence.
Major Class
Major class of traffic gives first 3 bits means values between 0-7.  This way DSCP becomes 
compatible with IP Precedence and providing same set of marking that IP precedence was defining.
11=3 (third bit is unused)


When Cisco defined DSCP, they defines some of the new classes  Line IP Precedence, higher numbered classes are treated better than lower numbered class. Means DSCP AF4 is better than DSCP AF3.
For example:


Default Class=========DSCP value 0========IP Prec 0===000
Assured Forwarding (AF)-
AF1========DSCP 1 ==========IP Prec 1 =====001
AF2========DSCP 2 ==========IP Prec 2 =====010
AF3========DSCP 3 ==========IP Prec 3 =====011
AF4========DSCP 4 ==========IP Prec 4 =====100
Expedite Forwarding(EF)=======DSCP 5 =====IP Prec 5==101


DSCP 6 and DSCP 7 are reserved and can never be used so not shown in DSCP configuration as well.

Minor Class (Drop Precedence)

It is three bit field expresses Drop Preference of the Major classes. Last bit of this Minor class is always 0. So IP Precedence only needed left 2 bits. With two bits we can only have maximum 3 values.


But unlike Major class, In Minor classes lower is better (Lower is better).  This is why it is also called drop precedence. In Minor class, three numbers are allowed (1,2,3) for each major AF class through (1-4). For example:


AF1 --------DSCP 4 ------IP Prec 4
  AF11
  AF12
  AF13
AF2 --------DSCP 4 ------IP Prec 4
  AF21
  AF22
  AF23
AF3 --------DSCP 4 ------IP Prec 4
  AF31
  AF32
  AF33
AF4 --------DSCP 4 ------IP Prec 4
  AF41
  AF42
  AF43


Some calculations


AF11 means :


Major=1=3bits================001
Minor=1=2bits+1 bit (unused)==01 +0==010


IN decimal=major +minor=001010=10


AF31 means :


Major=3=3bits==011
Minor=1=2bits+1 bit (unused)==01+0=010


In decimal=major +minor=011010=16+8+2=26


AF43 means :


Major=4=3bits=011
Minor=3=2bits+1 bit (unused)=10+0=100


In decimal=011100=16+8+4=28


So we can have 12 DSCP AF classes with the use of Major and Minor classes. One default class and one EF (Expedite Forwarding) class addition of these 12 DSCP AF classes concludes 14 DSCP AF classes against 7 classes of IP Precedence. In decimal, we can have DSCP valued between 0-63.
Class Selector
Class Selector is used when you want IP Precedence kind of flexibility in DSCP enable router. This is another term we can use in DSCP. This is the functional equivalent to IP precedence, they just call it class selector in DSCP speak.  


Note that drop preference is n’t used in any of the available 7 CS classes like we do in IP Precedence.




No comments:

Post a Comment