Monday, June 23, 2014

What is the difference between cos , ip precedence and dscp

* A simple explanation about the COS, TOS, DSCP, IP Precedence. It is from HERE
Thanks to the author.

  • cos is used at layer 2
  • ip precedence is the old way for type of service(ToS)
  • DSCP is the new way for type of service(ToS)
  • DSCP is backward compatible with ip precedence
Below is a the IPV4 datagram packet
As you notice ToS is 8 bits

ip precedence use the first 3 bits , DSP use the first 6 bits (in fact the 6th bit is never used)
Ip Precedence (Major class)It use a scale of 0 to 7 and will be typically used as below
  • 0:Best Effort (000)
  • 1:Medium priority(001)
  • 2:Hight priority(010)
  • 3:Call signals(011)
  • 4:Video conference(100)
  • 5:Voice(101)
  • 6:Reserved (110)
  • 7:Reserved(111)
again this is the old way to be used with ToS
Configuration Example:

Router(config)#class-map match-all IP-PRECEDENCE
Router(config-cmap)#match protocol rtp
Router(config-cmap)#exist
Router(config)#policy-map IP-PRECEDENCE-POLICY
Router(config-pmap)#class IP-PRECEDENCE
Router(config-pmap-c)#set ip precedence ?
<0-7>           Precedence value
critical        Set packets with critical precedence (5)
flash           Set packets with flash precedence (3)
flash-override  Set packets with flash override precedence (4)
immediate       Set packets with immediate precedence (2)
internet        Set packets with internetwork control precedence (6)
network         Set packets with network control precedence (7)
priority        Set packets with priority precedence (1)
routine         Set packets with routine precedence (0)


Router(config-pmap-c)#set ip precedence critical
Router(config-pmap-c)#exit
Router(config)#interface gigabitEthernet 0/1
Router(config-if)#service-policy input IP-PRECEDENCE-POLICY

DSCPThe advantages of DSCP is that you may have more levels to define than “ip precedence”. For each level in “ip precedence” , there are 3 sub levels.at the same time it is backward compatible.
default  Match packets with default dscp (000000) (no sub level for level 0 or best effort)
af11     Match packets with AF11 dscp (001010)
af12     Match packets with AF12 dscp (001100)
af13     Match packets with AF13 dscp (001110)
Notice in the above level for af11 = 001|010 , as the 6th bit is not used this will become in reality   001|01 which is equal to 1|1 in decimal and the final result is af11
an old router which does not support DSCP will look at the first 3 bits , so the major classification will be understood by the old router .
The second part or the second 3 bits is called Drop Preference ,the higher it is , the more chance it has to be dropped . To resume af11 is better than af13 because af13 has more chance to be dropped than af11
Below are the rest of levels
af21     Match packets with AF21 dscp (010010)
af22     Match packets with AF22 dscp (010100)
af23     Match packets with AF23 dscp (010110)
af31     Match packets with AF31 dscp (011010)
af32     Match packets with AF32 dscp (011100)
af33     Match packets with AF33 dscp (011110)
af41     Match packets with AF41 dscp (100010)
af42     Match packets with AF42 dscp (100100)
af43     Match packets with AF43 dscp (100110)
ef       Match packets with EF dscp (101110) (no sub levels for level 5 or critical level)
Configuring DSCP on a cisco router is the same as ip precedence the only difference will be in the following line
Router(config-pmap-c)#set ip dscp ef

No comments:

Post a Comment