Intermediate · IP services: DHCP, DNS, NAT and more · topic 40 of 57 · 30 min
QoS basics: keeping voice and video clear
Explanation
Why QoS?
Most of the time links are not full and every packet goes straight through. But at busy moments, such as a big backup, a software update on 100 laptops, or month-end reports, packets wait in a queue at the router. Email and file downloads do not mind waiting a little. A voice call or video meeting does: the words arrive late, choppy or not at all.
Four things describe how a network treats traffic. Bandwidth is how much data per second a link can carry. Delay (latency) is how long a packet takes to arrive. Jitter is the variation in delay from packet to packet. Loss is the share of packets that never arrive. For good voice quality, Cisco's common targets are a one-way delay of 150 ms or less, jitter of 30 ms or less, and loss of 1% or less. A voice call needs little bandwidth (roughly 30 to 90 kbps per call depending on the codec), but it needs it on time.
Step 1: classification and marking
Classification means recognising traffic: this packet is a voice call, that one is a backup. You can classify by ACL, by application recognition (Cisco NBAR), or by trusting a marking already on the packet. Marking means writing a value into the packet header so that every later device can classify it with one quick look.
- CoS (Class of Service): 3 bits in the 802.1Q VLAN tag, values 0 to 7. It exists only on trunk links (and the voice VLAN), so it is lost when a router removes the Ethernet header. Voice is usually CoS 5.
- DSCP (Differentiated Services Code Point): 6 bits in the IP header's ToS byte, values 0 to 63. It stays with the packet end to end across routers. The older IP Precedence used only the first 3 bits.
| Name | DSCP | Typical use |
|---|---|---|
| EF (Expedited Forwarding) | 46 | Voice payload |
| AF41 | 34 | Interactive video |
| AF31, AF21, AF11 | 26, 18, 10 | Business data classes |
| CS3 | 24 | Often call signalling |
| CS6 | 48 | Network control (routing protocols) |
| CS1 | 8 | Scavenger: less than best effort |
| Default (DF) | 0 | Best effort: everything else |
AF (Assured Forwarding) names have two digits: AFxy. x is the class (1 to 4; higher classes usually get better treatment) and y is the drop precedence (1 to 3; higher is dropped first inside its class). The DSCP value is 8x + 2y, so AF41 = 32 + 2 = 34 and AF13 = 8 + 6 = 14. CS (class selector) values are multiples of 8: CSn = 8n, matching the old IP Precedence values.
The trust boundary
If every PC could mark its own traffic EF, a student could make a game download "voice". The trust boundary is the point where the network starts believing markings. A common design trusts the Cisco IP phone on the access switch port: the phone marks its voice EF and CoS 5, while traffic from the PC plugged into the phone is re-marked to 0. Everything beyond the access switch then trusts the markings.
Step 2: queuing
Queuing decides the order in which waiting packets leave an interface when it is congested. FIFO (first in, first out) has one queue and no favourites. CBWFQ (class-based weighted fair queuing) gives each class its own queue and a guaranteed minimum share of bandwidth. LLQ (low latency queuing) adds one strict priority queue to CBWFQ: voice packets in it always go first, but the priority queue is limited to a set amount so it cannot starve the rest.
class-map match-any VOICE
match dscp ef
class-map match-any VIDEO
match dscp af41
policy-map WAN-EDGE
class VOICE
priority percent 20
class VIDEO
bandwidth percent 30
class class-default
fair-queue
interface GigabitEthernet0/1
service-policy output WAN-EDGEStep 3: congestion avoidance
When a queue is completely full, new packets are simply dropped: tail drop. Many TCP connections then slow down together, then speed up together, so the link swings between overloaded and half empty (TCP global synchronisation). RED (random early detection) starts dropping a few random packets before the queue is full, so TCP flows slow down at different times. WRED (weighted RED) drops lower-priority markings first, for example AF13 before AF11.
Step 4: policing and shaping
Both limit traffic to a rate. Policing drops (or re-marks) anything over the rate at once, with no extra delay; ISPs police what customers send into their network. Shaping holds the extra packets in a buffer and sends them a little later, smoothing the traffic to the rate; customers shape their outgoing traffic to the rate they bought, for example 200 Mbps on a 1 Gbps port, so the ISP's policer does not drop it. Shaping adds some delay; policing adds loss.
Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
QoS basics: keeping voice and video clear · 1/8
In this lesson you will see how QoS keeps voice and video clear when a link is busy.
Prefer a video by a teacher? Find free videos on “ccna qos explained dscp cos llq policing shaping” on YouTube ↗
In real life: Clear calls at a customer support centre
An insurance company in Chennai runs its call centre over IP phones, and the 100 Mbps link to head office also carries file transfers and Windows updates. Agents complained of robotic voices every afternoon. The team trusted the phones at the access switches (voice marked EF), and on the WAN router put EF traffic in an LLQ priority queue capped at 30%, gave AF41 video a bandwidth guarantee, and left the rest in class-default. Jitter fell well under 30 ms and the complaints stopped, without buying a faster link.
Practice (0/3 done)
Write af_dscp(x, y) that returns the DSCP value of the Assured Forwarding class AFxy, using DSCP = 8x + 2y. Example: af_dscp(4, 1) returns 34.
Write dscp_name(value) that turns a DSCP number into its name: 0 is "default", 46 is "EF", any value equal to 8x + 2y with x from 1 to 4 and y from 1 to 3 is "AFxy" (for example "AF41"), and any other multiple of 8 from 8 to 56 is "CSn" where n = value // 8. Anything else is "unknown".
An ISP sells 200 Mbps on a 1 Gbps port and drops anything above 200 Mbps. What should the customer configure on the outgoing interface to avoid those drops?
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- NAT and PATIP services: DHCP, DNS, NAT and more · same module
- DNS: names to addressesIP services: DHCP, DNS, NAT and more · same module
- Access control lists (ACLs)Network security
- Configuring a WLAN on a WLC and troubleshooting Wi-FiWireless networking
- set, stack, queue, deque and priority_queueC++ Programming (modern C++ and DSA) · The Standard Template Library (STL)
- TCP/IP and the network layersCyber Security: from zero to SOC analyst · Networking for security
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
What is the DSCP value for EF (voice)?
Answer: 46
EF is 46. 34 is AF41, 26 is AF31, 48 is CS6.
Where is the CoS value carried?
Answer: In the 802.1Q VLAN tag
CoS is the 3-bit priority field of the 802.1Q tag, so it exists only on tagged frames.
Which packet is dropped first by WRED in the same AF class?
Answer: AF13
The second digit is drop precedence; 3 is the highest, so AF13 goes first.
What does LLQ add to CBWFQ?
Answer: A strict priority queue for traffic such as voice
LLQ = CBWFQ plus one strict priority queue, which is limited so it cannot starve the others.
Which statement about policing and shaping is TRUE?
Answer: Shaping delays excess traffic; policing drops or re-marks it
Shaping smooths by delaying; policing enforces by dropping or re-marking.
Which protocol is best for a live cricket audio stream where late packets are useless?Related
Answer: UDP
UDP does not wait to resend lost packets, which suits live audio and video.
An IP phone and a PC share one switch port. Which command puts the phone traffic in VLAN 50?Related
Answer: switchport voice vlan 50
switchport voice vlan 50 tells the phone to tag voice frames with VLAN 50; the PC stays in the access VLAN.
Which command shows how many packets matched each ACL rule?Related
Answer: show access-lists
show access-lists prints each rule with its matches counter.
Which QoS profile is the default best-effort profile on a WLC?Related
Answer: Silver
Silver is best effort, used for normal data.
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- This is the last topic of “IP services: DHCP, DNS, NAT and more”. The module exam comes next.
- Module 8 exam: IP services · 15 questions · 25 min, without help. 5 topics of this module still to finish first.
- Then the next module, Network security. 57 topics left in the course before the final exam.