Skip to content

Intermediate · IP services: DHCP, DNS, NAT and more · topic 40 of 57 · 30 min

QoS basics: keeping voice and video clear

Explanation

QoS (Quality of Service) decides which traffic goes first when a link is busy. Traffic is classified and marked (CoS in the 802.1Q tag, DSCP in the IP header; EF 46 for voice), then queued so that voice gets a strict priority queue (LLQ) and other classes get guaranteed shares. WRED drops some packets early to avoid congestion, and policing or shaping keeps traffic to a contracted rate.

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.

Think of it like this: QoS is like a toll plaza on a busy highway. Ambulances get a dedicated lane and never wait. Buses have reserved lanes. Cars share the rest. When the plaza is empty, everyone drives straight through and the rules do not matter. QoS only changes things when there is a queue.

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.
NameDSCPTypical use
EF (Expedited Forwarding)46Voice payload
AF4134Interactive video
AF31, AF21, AF1126, 18, 10Business data classes
CS324Often call signalling
CS648Network control (routing protocols)
CS18Scavenger: less than best effort
Default (DF)0Best 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.

output
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-EDGE
Cisco IOS (MQC): voice in a priority queue capped at 20%, video guaranteed 30%, everything else shares the rest.

Step 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.

Careful: Common mistakes: (1) thinking QoS creates bandwidth: it only chooses who waits when there is not enough; (2) trusting markings from user PCs; (3) putting too much traffic in the priority queue, which starves other classes; (4) marking on one device but not matching the same values on the next; (5) mixing up AF numbers: in AF13 the 3 is the drop precedence, so AF13 is dropped before AF11.

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

QoS basics

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)

Task 1 · Code · Python

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.

Task 2 · Code · Python

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".

Task 3 · Question

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

Question 1

1.What is the DSCP value for EF (voice)?

Question 2

2.Where is the CoS value carried?

Question 3

3.Which packet is dropped first by WRED in the same AF class?

Question 4

4.What does LLQ add to CBWFQ?

Question 5

5.Which statement about policing and shaping is TRUE?

Read more (free)

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.

From TCP, UDP and port numbers

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.

From VLANs: what they are and why we use them

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.

From Access control lists (ACLs)

Which QoS profile is the default best-effort profile on a WLC?Related

Answer: Silver

Silver is best effort, used for normal data.

From Configuring a WLAN on a WLC and troubleshooting Wi-Fi

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

  1. This is the last topic of “IP services: DHCP, DNS, NAT and more”. The module exam comes next.
  2. Module 8 exam: IP services · 15 questions · 25 min, without help. 5 topics of this module still to finish first.
  3. Then the next module, Network security. 57 topics left in the course before the final exam.

← Previous: Management services: NTP, SNMP, syslog and TFTP