Layer 3 QoS – ToS

We have to keep in mind that QoS, helps the network passing “important” traffic once a congestion happen; it doesn’t prevent the network from being loaded it just try to survive the situation with minimum interruption for the traffic that matters the most.

To apply QoS for Layer 3, we need to mark the traffic according to its importance then decide how to deal with it when congestion happen!

ToS Marking:

Layer 3 IP packets can have QoS;  called ToS marking by using:

  1.  IP precedence value which uses 3 bits to duplicate the Layer 2 CoS value and position this value at Layer 3, hence the range is from 0-7.
  2. Differentiated Services Code Point (DSCP): uses 6 of the 8 bits (allowing for 64 QoS values).

ToS is 1 byte of the layer 3 IP packet, which is divided and used as the following:

[0] [1] [2] [3] [4] [5] [6] [7]

For IP precedence, the bits 0, 1 & 2 are used to map the CoS 3 bits in Layer 2 QoS.

For DSCP, these bits have different meaning:

[0] [1] [2] = Class

These bits can be in the combination of:

  • 0 0 0   = Best Effort, no QoS   (BE)
  • 0 0 1   = Assured Forwarding 1  (AF1)
  • 0 1 0   = Assured Forwarding 2 (AF2)
  • 0 1 1    = Assured Forwarding 3 (AF 3)
  • 1 0 0   = Assured Forwarding 4 (AF 4)
  • 1 0 1   = Expedited forwarding (EF)  (DSCP 46)
  • Any   = Class Selector (CS) — only these 3 bits are used, rest are zeros .. used for backward compatibility with IP precedence/ CoS

[3] [4]: 

  • For class AF, these bits are Drop Probability  (DP), a higher DP means a higher probability for the packet to be dropped if congestion occurs, could be 1 (Low), 2 (Medium) & 3 (high) where high is the worse!
  • For the class EF, these two bits are always 1
  • For the class CS, these two bits are always 0

[5]: Always Zero!

[6] [7] : Used to tell the network/ link congestion to the destination point

Congestion management:

To prioritizes packets, when congestion happen, we need to use one of these queues.

  1. Priority queuing (PQ): strict service of a queue for one queue and ignore the others.
  2. Custom queuing (CQ): Just a load balance between the queues.
  3. Weighted fair queuing (WFQ):Gives priority for smaller packets or packets with higher ToS, interface level command is fair-queue
  4. class-based weighted fair queuing (CBWFQ): Customized bandwidth for each class – CBWFQ : Can be enabled as an output feature only
  5. Low-latency queuing (LLQ): Serve one queue in priority until certain BW, usually used for VoIP; use priority command to set LLQ policy.

Configurations Example 1: 

They are done using MQS (Modular QoS Console command set), I am using the simple network below where the cluster of PCs is to generate traffic and one PC for ping test


First step is to create class-map to define how to classify the traffic (I want to use icmp and ftp)

Router(config)#class-map match-any n-class

Router(config-cmap)#match protocol icmp

Router(config)#class-map match-all ftp-c

Router(config-cmap)#match protocol ftp


Second step is to create policy-map to define the priority for the traffic

Router(config)#policy-map n-policy

Router(config-pmap)#class n-class

Router(config-pmap-c)#set ip dscp ef

Router(config-pmap-c)#bandwidth percent 75


Router(config-pmap)#class ftp-c

Router(config-pmap-c)#set ip dscp af13


Third step, set service policy to assign this QoS to interface

Router(config)#int serial 0/3/0

Router(config-if)#service-policy output n-policy

I applied the same on both serial links (output to prioritize icmp and lower ftp)


Created the same on the other router and linked the service policy to the serial

I applied small ping test for before and after


Configurations Example 2:

For the same network, I added QoS exclusively for the PC I used for ping test

Router(config)#access-list 107 permit icmp host any

Router(config)#class-map match-all icmp-class
Router(config-cmap)#match access-group 107

Router(config)#policy-map icmp-policy
Router(config-pmap)#class icmp-class
Router(config-pmap-c)#set ip dscp ef
Router(config-pmap-c)#bandwidth percent 70

Router(config)#int serial 0/3/0
Router(config-if)#service-policy output icmp-policy



This entry was posted in Cisco- R&S and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s