Convert PHB AF to DSCP Decimal and Vise Versa: It’s So Easy!

If you are searching any transformation formula from AF to DSCP decimal value and the vise versa then stop here! I have the solution for you! The rules are simple:

  • From PHB AF to DSCP Decimal

Decimal from AFxy=(8*x)+(2*y)

So, let’s have some example, let’s calculate decimal value from AF13, AF31 and AF43.

AF13 = (8*1)+(2*3) = DSCP 14

AF31 = (8*3)+(2*1) = DSCP 26

AF43 = (8*4)+(2*3) = DSCP 38

  • From DSCP Decimal to PHB AF

And the formula is tricky to calculate the vise versa, i mean, from DSCP value to PHB AF. The formula is:

AFxy where, x = Floor Value [(DSCP Value)/8], y = [(Remainder)/2]

So, let’s revert back those DSCP values to AF value.

DSCP 14 = AFxy where, x = Floor Value of (14/8) = 1, y = (Remainder)/2 = 6/2 = 3, so AFxy = AF13

DSCP 26 = AFxy where, x = Floor Value of (26/8) = 3, y = (Remainder)/2 = 2/2 = 1, so AFxy = AF31

DSCP 38 = AFxy where, x = Floor value of (38/8) = 4, y = (Remainder)/2 = 6/2 = 3, so AFxy = AF43

So you will never forget it, right? 😀

Default/Recommended QoS Classification and Marking for Voice Packets

These are taken from the QoS SRND guide.

class-map match-all Voice
match ip dscp ef                          ! IP Phones mark Voice to EF (46)
class-map match-any Call Signaling
match ip dscp cs3                       ! Future Call-Signaling marking
match ip dscp af31                     ! IP Phones mark Call-Signaling (SCCP/MGCP)
policy-map WAN-EDGE
class Voice
priority percent 33                    ! Maximum recommended LLQ value
compress header ip rtp            ! Optional: Enables Class-Based cRTP
class Call Signaling
bandwidth percent 5                 ! BW guarantee for Call-Signaling
class class-default
fair-queue                                      ! All other data gets fair-queuing
Ok, now tell me why Auto QoS reserves 70% priority bandwidth for voice RTP class instead of 33% recommended? I’m still finding the answer…..

One Basic Difference Between Catalyst 3750 and 4500 Series switches: Police Rate

4500 series switch can’t police incoming traffic less than 32kbps but can police upto 32Gbps!

4510SW(config-pmap-c)#police ?
<32000-32000000000>       Rate in bits per second (postfix k, m, g optional; decimal point allowed)
aggregate                     Aggregate policer for the current class

On the other hand 3750 series switches can police as low as 8kbps but the upper limit restricts to 1Gbps only.

3750SW(config-pmap-c)#police ?
<8000-1000000000>           Bits per second
aggregate                     Choose aggregate policer for current class

I just discovered it today when I was trying to configure 16kbps police rate on 4510 and failed. 😛