Services · Topic 5 of 5
QoS Services: Marking, WRED, Policing and Shaping
Implement QoS services with classification and marking, WRED congestion avoidance, traffic policing and shaping, using policy maps on IOS XR and XE.
- 5 min
- A policy map has classes, actions and a
service-policyattachment. - Classification matches on DSCP, TC, CoS or an access list.
- EF is DSCP 46, and it is used for voice.
What it is
QoS services are the tools that sort traffic into classes, mark it, and control how each class uses a link.
Provider links are shared, and bursts of traffic can fill a queue. QoS gives voice and other sensitive traffic predictable treatment, and keeps bulk traffic from taking everything. The tools are applied with modular policy maps.
How it works
A policy map has three steps: classify the traffic, apply an action to each class, and attach the policy to an interface.
Classification and marking
A class map matches traffic by a field. Common fields are the DSCP, the MPLS TC bits, the Ethernet CoS, and an access list.
Marking then sets a value that other devices will trust. These DSCP values are common:
| Class | DSCP name | Value |
|---|---|---|
| Voice | EF | 46 |
| Assured forwarding, class 3, low drop | AF31 | 26 |
| Call signalling | CS3 | 24 |
| Default | Best effort | 0 |
In an MPLS network, the TC bits on the label are marked at the ingress PE. The core then queues by TC, as described in the QoS architecture page.
RP/0/RP0/CPU0:PE1(config)# class-map match-any VOICE
RP/0/RP0/CPU0:PE1(config-cmap)# match dscp ef
RP/0/RP0/CPU0:PE1(config-cmap)# end-class-map
RP/0/RP0/CPU0:PE1(config)# policy-map CUST_IN
RP/0/RP0/CPU0:PE1(config-pmap)# class VOICE
RP/0/RP0/CPU0:PE1(config-pmap-c)# set mpls experimental imposition 5
RP/0/RP0/CPU0:PE1(config-pmap-c)# police rate 5 mbps
RP/0/RP0/CPU0:PE1(config-pmap-c-police)# conform-action transmit
RP/0/RP0/CPU0:PE1(config-pmap-c-police)# exceed-action drop
RP/0/RP0/CPU0:PE1(config-pmap-c)# exit
RP/0/RP0/CPU0:PE1(config-pmap)# end-policy-map
RP/0/RP0/CPU0:PE1(config)# interface GigabitEthernet0/0/0/1
RP/0/RP0/CPU0:PE1(config-if)# service-policy input CUST_IN
Policing and shaping
Policing and shaping both limit a rate, but they treat the excess traffic differently.
| Feature | Excess traffic | Delay added | Direction |
|---|---|---|---|
| Policing | Dropped, or re-marked | None | Input or output |
| Shaping | Held in a queue and sent later | Yes | Normally output |
Both use a token bucket. Tokens arrive at the committed rate, and a packet is sent only if enough tokens are available. A burst size sets how many tokens the bucket holds, so short bursts can pass.
A policer can have two colours (conform and exceed) or three colours (conform, exceed and violate). Three colours need an extra rate or burst, and they let the policer mark packets before it drops them.
Shaping is the better choice when the next device would otherwise drop the excess, such as a customer sending at line rate into a lower rate service. Policing is used at the provider edge to enforce the rate in the service agreement.
Router(config)# policy-map SHAPE_OUT
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average 50000000
Router(config)# interface GigabitEthernet0/0/1
Router(config-if)# service-policy output SHAPE_OUT
Queueing and congestion avoidance
When a class queue is full, the router drops packets. This is tail drop, and it hits many TCP flows at once, which then slow down together and speed up together. This is called global synchronisation.
WRED (weighted random early detection) avoids this. As the average queue grows, it drops a few packets early and at random, with more drops for lower priority traffic. TCP senders slow down at different times, and the link stays busy without overflowing.
Router(config)# policy-map WAN_OUT
Router(config-pmap)# class VOICE
Router(config-pmap-c)# priority percent 20
Router(config-pmap-c)# exit
Router(config-pmap)# class DATA
Router(config-pmap-c)# bandwidth remaining percent 50
Router(config-pmap-c)# random-detect dscp-based
That is IOS XE. The priority class is a strict priority queue for voice, and it is limited so that it cannot starve the other classes.
WRED applies to the data class. WRED is not useful for voice, because voice does not slow down when packets drop.
Verification
RP/0/RP0/CPU0:PE1# show policy-map interface GigabitEthernet0/0/0/1
Router# show policy-map interface GigabitEthernet0/0/1
The output shows each class, the packets matched, and the packets dropped or transmitted.
What to remember for the exam
Eight facts cover most questions on this topic.
- A policy map has classes, actions and a
service-policyattachment. - Classification matches on DSCP, TC, CoS or an access list.
- EF is DSCP 46, and it is used for voice.
- Policing drops or re-marks the excess and adds no delay.
- Shaping buffers the excess and normally works on output.
- Both use a token bucket with a rate and a burst.
- WRED drops early and at random to avoid tail drop and global synchronisation.
- A priority queue is for voice, and it should be limited.
To tell policing from shaping, ask if the excess is delayed. Shaping delays it, and policing does not.
Common mistakes
These four mistakes appear often.
Using a policer when delay is acceptable. Shaping would avoid the drops that the policer causes.
Applying shaping on input. Shaping normally works on the output direction.
Applying WRED to voice. Voice does not slow down in response to drops.
Leaving the priority queue unlimited. It can starve every other class.
A policy that marks traffic is only useful if the next device trusts the marking. Check the trust boundary first.
Check yourself
Work through these three questions.
What is the main difference between policing and shaping?
Policing drops or re-marks the excess with no delay, while shaping holds it in a queue and sends it later.
What problem does WRED avoid?
It avoids tail drop and global synchronisation by dropping a few packets early and at random.
Which DSCP value is used for voice?
EF, which is 46.
Topic 5 of 5 in Services
Test yourself on Services
The full Cisco CCNP 350-501 SPCOR question bank has 738 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.