MQC — Modular QoS CLI Basics
Network links do not have infinite capacity. When more traffic arrives at an interface than it can transmit simultaneously, packets must wait in a queue — and without any management of that queue, every packet waits equally regardless of whether it carries a latency-sensitive voice call or a background software update. Quality of Service (QoS) is the set of mechanisms that let a router or switch treat different types of traffic differently: giving voice calls guaranteed bandwidth and priority delivery, marking business-critical application traffic so it receives preferential treatment across the WAN, and policing or shaping bulk data so it cannot crowd out other services. For a conceptual overview see QoS Overview.
Cisco's Modular QoS CLI (MQC) is the unified
framework for configuring all QoS functions on IOS and IOS-XE.
Before MQC, Cisco had dozens of separate, incompatible QoS
commands — each feature had its own CLI syntax, its own apply
mechanism, and its own quirks. MQC replaced all of that with a
clean three-step model that is the same regardless of which QoS
action you are configuring: classify traffic with
class-map, define actions with
policy-map, and apply to an interface with
service-policy. Understanding this framework is
foundational — every QoS feature on Cisco IOS, from DSCP marking
to LLQ priority queuing to traffic policing, is configured through
these three constructs.
This lab also covers the QoS toolset used inside policy-maps:
set (marking), bandwidth (minimum
guarantee), priority (LLQ — strict priority
for voice), police (rate limiting with
conform/exceed/violate actions), and queue-limit
(tail-drop tuning). The complete verification workflow using
show policy-map interface and interpreting its
counters is covered in detail. For MQC applied to protecting
the router control plane, see
Control Plane Policing
(CoPP) — which uses the identical three-step MQC framework.
For classification using extended ACLs referenced in
class-maps, see
Extended ACL
Configuration. For voice VLAN configuration on access
switches that feeds traffic into MQC QoS policies, see
Voice VLAN
Configuration.
1. QoS Fundamentals — Why QoS and When It Applies
When QoS Takes Effect
QoS mechanisms only activate when a link is congested — when more traffic is arriving than the interface can transmit. On an uncongested interface, all traffic is forwarded immediately and QoS queuing has no observable effect. This is important to understand: testing a QoS policy on a lightly loaded lab link may show no differentiation because there is no competition for bandwidth. QoS is specifically about managing the competition for a bottleneck resource.
QoS Actions — The Four Tools
| QoS Tool | What It Does | MQC Command | When to Use |
|---|---|---|---|
| Classification | Identify which traffic class a packet belongs to — by DSCP, ACL, NBAR protocol, CoS, or ingress interface. The foundation all other QoS tools depend on | class-map |
Always — every QoS policy starts with classification |
| Marking | Set or rewrite the packet's QoS marking — DSCP value in the IP header, CoS in the 802.1Q tag, MPLS EXP bits. Marking at the trust boundary propagates QoS intent hop-to-hop across the network | set dscp, set cos |
At the network edge (ingress to the WAN or campus core) to remark untrusted or mis-marked traffic |
| Queuing / Scheduling | Determine the order in which queued packets are transmitted during congestion. Priority queuing (LLQ) serves the voice queue first before all others. CBWFQ assigns minimum bandwidth guarantees per class. Remaining bandwidth is shared proportionally | priority, bandwidth, fair-queue |
On egress interfaces where congestion occurs — typically WAN uplinks and slower access ports. See QoS Queuing |
| Policing / Shaping | Rate-limit traffic to a specified bandwidth. Policing drops or re-marks excess packets immediately (no delay). Shaping buffers excess packets and smooths the output rate (adds delay but no drops). Policing is used for enforcement; shaping is used before a policed link to avoid drops | police, shape |
Policing: at ingress to enforce traffic contracts or at egress to rate-limit a class. Shaping: on egress to match a service provider's committed rate. See QoS Policing & Shaping |
DSCP — Differentiated Services Code Point
DSCP is a 6-bit field in the IP header's Type
of Service (ToS) byte that carries per-hop QoS intent. Every
IP router along the path can read the DSCP value and apply its
local QoS policy accordingly. DSCP values are expressed either
as decimal numbers (0–63) or as mnemonics. The key values to
know are shown in the table below — these are the values you
will use in class-map match dscp and
set dscp commands throughout this lab.
| DSCP Mnemonic | Decimal Value | Binary | Traffic Type | Queuing Treatment |
|---|---|---|---|---|
| EF (Expedited Forwarding) | 46 | 101110 | VoIP RTP — voice bearer streams | LLQ strict priority — never waits in queue |
| CS3 (Class Selector 3) | 24 | 011000 | VoIP signalling (SIP, H.323, SCCP) | High-priority queue — guaranteed bandwidth |
| AF41 (Assured Forwarding 4,1) | 34 | 100010 | Interactive video — videoconferencing | High-bandwidth guarantee, low drop probability |
| AF31 (Assured Forwarding 3,1) | 26 | 011010 | Business-critical applications (ERP, CRM) | Medium bandwidth guarantee |
| AF21 (Assured Forwarding 2,1) | 18 | 010010 | Transactional data (database queries) | Lower bandwidth guarantee |
| AF11 (Assured Forwarding 1,1) | 10 | 001010 | Bulk data (file transfers, backups) | Best-effort with minimum guarantee |
| CS1 (Class Selector 1) | 8 | 001000 | Scavenger / low-priority (peer-to-peer) | Below best-effort — used only when link is idle |
| BE / DF (Best Effort / Default) | 0 | 000000 | General internet traffic, unclassified | Default queue — no guarantees |
The Trust Boundary
The trust boundary is the point in the network
where DSCP markings are trusted and propagated as-is versus where
they are re-marked or ignored. Traffic from end-user PCs is
generally not trusted — a user could manually set DSCP
EF on their file-download traffic to get priority treatment.
The trust boundary is typically placed at the first network
device the IT team controls: the access switch (for campus) or
the WAN router (for branch). At the trust boundary, a
marking policy (MQC with set dscp) is
applied to remark traffic based on its actual type — regardless
of whatever DSCP value the end device set.
2. The MQC Three-Step Framework
┌─────────────────────────────────────────────────────────────────┐
│ MQC THREE-STEP MODEL │
│ │
│ Step 1: class-map │
│ ───────────────── │
│ Define WHAT traffic belongs to this class. │
│ Match criteria: DSCP, ACL, NBAR protocol, CoS, input-intf... │
│ │
│ class-map match-all VOICE │
│ match dscp ef │
│ │
│ Step 2: policy-map │
│ ───────────────── │
│ Define WHAT TO DO with each classified traffic class. │
│ Actions: set, bandwidth, priority, police, shape, drop... │
│ │
│ policy-map WAN-OUT │
│ class VOICE │
│ priority 512 ← LLQ: 512 kbps strict priority │
│ class class-default │
│ fair-queue ← WFQ for all remaining traffic │
│ │
│ Step 3: service-policy │
│ ────────────────────── │
│ Apply the policy-map to an interface in a direction. │
│ │
│ interface gi0/1 │
│ service-policy output WAN-OUT │
│ │
│ Direction: │
│ • output = applied to OUTGOING traffic (most common for QoS) │
│ • input = applied to INCOMING traffic (policing, marking) │
└─────────────────────────────────────────────────────────────────┘
Key Rules:
• A class-map is just a filter — it does nothing by itself
• A policy-map is just a list of actions — it does nothing
until attached to an interface with service-policy
• One policy-map per interface per direction (input or output)
• A policy-map can contain up to 256 class entries
• class-default always exists — catches all traffic NOT
matched by any named class in the policy-map
• class-map names and policy-map names are case-sensitive
class-map — Match Types
| Match Criterion | Syntax | Matches On | Common Use Case |
|---|---|---|---|
| DSCP value | match dscp ef or match dscp 46 |
The 6-bit DSCP field in the IP ToS byte. Multiple values can be listed: match dscp ef cs3 af41 |
Classifying already-marked traffic (downstream of the trust boundary) |
| IP Precedence | match ip precedence 5 |
The top 3 bits of the IP ToS byte (legacy QoS marking). Precedence 5 = voice, 3 = signalling | Older networks using IP Precedence instead of DSCP |
| Access Control List | match access-group name VOICE-ACL |
Traffic matching a named or numbered ACL — source/destination IP, port, protocol | Classifying specific hosts or applications by IP/port when DSCP marking has not yet been applied |
| NBAR Protocol | match protocol http, match protocol rtp |
Application protocol identified by NBAR2 (Network-Based Application Recognition) deep packet inspection | Classifying applications by protocol signature regardless of port number (e.g., Skype, YouTube, Webex) |
| CoS (802.1Q) | match cos 5 |
The 3-bit Class of Service field in the 802.1Q VLAN tag. Only present on tagged frames | Campus QoS on trunk ports where Layer 2 CoS carries QoS markings between switches |
| Input interface | match input-interface gi0/1 |
The interface the packet arrived on (ingress interface at time of classification) | Classifying traffic based on which LAN segment or VLAN it came from |
match-all vs match-any
| Keyword | Logic | Example |
|---|---|---|
match-all (default) |
ALL match statements must be true — logical AND. A packet must satisfy every condition to belong to this class | class-map match-all VOICE-FROM-PHONE matching both match dscp ef AND match access-group name IP-PHONES — only voice from known phone subnets |
match-any |
ANY match statement being true is sufficient — logical OR. A packet needs to satisfy only one condition | class-map match-any REAL-TIME matching match dscp ef OR match dscp af41 — catches both voice and video in one class |
3. Lab Topology
LAN (10.1.0.0/24) NetsTuts_R1 WAN (10.0.12.0/30)
┌──────────┐
IP Phone (10.1.0.10) ────►│ │ Gi0/1 ──────────────────► NetsTuts_R2
PC-Data (10.1.0.20) ────►│ │ 10.0.12.1/30 WAN Router
PC-Bulk (10.1.0.30) ────►│ │ 1.544 Mbps T1 link
│ Gi0/0 │
│ 10.1.0.1 │
└──────────┘
WAN interface speed: 1.544 Mbps (T1) — the bottleneck
LAN interface speed: 1 Gbps (no congestion on LAN side)
Traffic classes we will configure:
┌────────────────────┬─────────┬──────────────────────────────────┐
│ Class │ DSCP │ Action │
├────────────────────┼─────────┼──────────────────────────────────┤
│ VOICE │ EF (46) │ LLQ priority 256 kbps │
│ VOICE-SIGNAL │ CS3(24) │ Bandwidth 64 kbps guaranteed │
│ VIDEO │ AF41(34)│ Bandwidth 512 kbps guaranteed │
│ CRITICAL-DATA │ AF31(26)│ Bandwidth 256 kbps guaranteed │
│ BULK-DATA │ AF11(10)│ Bandwidth 128 kbps guaranteed │
│ SCAVENGER │ CS1 (8) │ Police to 128 kbps — drop excess │
│ class-default │ 0 │ Fair-queue — remaining bandwidth │
└────────────────────┴─────────┴──────────────────────────────────┘
Marking policy (INGRESS on Gi0/0 — trust boundary):
┌─────────────────────────┬────────────────────────────────────────┐
│ Source Traffic │ Mark As │
├─────────────────────────┼────────────────────────────────────────┤
│ IP Phone (10.1.0.10) │ DSCP EF (46) — trust phone markings │
│ Data PC (10.1.0.20) │ DSCP AF31 (26) — business data │
│ Bulk PC (10.1.0.30) │ DSCP AF11 (10) — bulk data │
│ All other traffic │ DSCP 0 (best effort) │
└─────────────────────────┴────────────────────────────────────────┘
4. Step 1 — Define Traffic Classes with class-map
All class-maps are created in global configuration mode.
The names you assign here will be referenced in the policy-map
in the next step. Use descriptive names — they appear verbatim
in show policy-map interface output and in
syslog messages.
Classification Class-Maps (for Queuing Policy)
NetsTuts_R1#conf t ! ── Voice bearer traffic ───────────────────────────────── ! ── match-all is the default but shown explicitly ───────── NetsTuts_R1(config)#class-map match-all VOICE NetsTuts_R1(config-cmap)# description VoIP RTP streams - DSCP EF NetsTuts_R1(config-cmap)# match dscp ef NetsTuts_R1(config-cmap)#exit ! ── VoIP signalling (SIP, SCCP, H.323 call setup) ──────── NetsTuts_R1(config)#class-map match-all VOICE-SIGNAL NetsTuts_R1(config-cmap)# description VoIP signalling - DSCP CS3 NetsTuts_R1(config-cmap)# match dscp cs3 NetsTuts_R1(config-cmap)#exit ! ── Interactive video (videoconferencing) ──────────────── NetsTuts_R1(config)#class-map match-all VIDEO NetsTuts_R1(config-cmap)# description Interactive video - DSCP AF41 NetsTuts_R1(config-cmap)# match dscp af41 NetsTuts_R1(config-cmap)#exit ! ── Business-critical application data ─────────────────── NetsTuts_R1(config)#class-map match-all CRITICAL-DATA NetsTuts_R1(config-cmap)# description Business apps ERP/CRM - DSCP AF31 NetsTuts_R1(config-cmap)# match dscp af31 NetsTuts_R1(config-cmap)#exit ! ── Bulk / background data transfers ───────────────────── NetsTuts_R1(config)#class-map match-all BULK-DATA NetsTuts_R1(config-cmap)# description File transfers backups - DSCP AF11 NetsTuts_R1(config-cmap)# match dscp af11 NetsTuts_R1(config-cmap)#exit ! ── Scavenger — below best-effort (P2P, personal streaming) NetsTuts_R1(config)#class-map match-all SCAVENGER NetsTuts_R1(config-cmap)# description Below best-effort - DSCP CS1 NetsTuts_R1(config-cmap)# match dscp cs1 NetsTuts_R1(config-cmap)#exit
description command is optional but strongly
recommended for documentation. Notice that
class-default does not need to be created — it is
a built-in class that automatically catches all traffic not
matched by any explicitly named class in the policy-map. You
never define a class-map named class-default; you
only reference it in the policy-map. For ACL-based
classification matching specific source IPs (rather than DSCP),
see Extended ACL
Configuration.
Marking Class-Maps (for Ingress Trust-Boundary Policy)
! ── ACLs to identify traffic sources for ingress marking ── NetsTuts_R1(config)#ip access-list extended ACL-IP-PHONE NetsTuts_R1(config-ext-nacl)# permit ip host 10.1.0.10 any NetsTuts_R1(config-ext-nacl)#exit NetsTuts_R1(config)#ip access-list extended ACL-DATA-PC NetsTuts_R1(config-ext-nacl)# permit ip host 10.1.0.20 any NetsTuts_R1(config-ext-nacl)#exit NetsTuts_R1(config)#ip access-list extended ACL-BULK-PC NetsTuts_R1(config-ext-nacl)# permit ip host 10.1.0.30 any NetsTuts_R1(config-ext-nacl)#exit ! ── Class-maps for ingress marking policy ──────────────── NetsTuts_R1(config)#class-map match-all MARK-VOICE NetsTuts_R1(config-cmap)# description Ingress: IP Phone traffic to mark EF NetsTuts_R1(config-cmap)# match access-group name ACL-IP-PHONE NetsTuts_R1(config-cmap)#exit NetsTuts_R1(config)#class-map match-all MARK-DATA NetsTuts_R1(config-cmap)# description Ingress: Data PC to mark AF31 NetsTuts_R1(config-cmap)# match access-group name ACL-DATA-PC NetsTuts_R1(config-cmap)#exit NetsTuts_R1(config)#class-map match-all MARK-BULK NetsTuts_R1(config-cmap)# description Ingress: Bulk PC to mark AF11 NetsTuts_R1(config-cmap)# match access-group name ACL-BULK-PC NetsTuts_R1(config-cmap)#exit
Verify Class-Maps
NetsTuts_R1#show class-map Class Map match-all VOICE (id 1) Match dscp ef (46) Class Map match-all VOICE-SIGNAL (id 2) Match dscp cs3 (24) Class Map match-all VIDEO (id 3) Match dscp af41 (34) Class Map match-all CRITICAL-DATA (id 4) Match dscp af31 (26) Class Map match-all BULK-DATA (id 5) Match dscp af11 (10) Class Map match-all SCAVENGER (id 6) Match dscp cs1 (8) Class Map match-all MARK-VOICE (id 7) Match access-group name ACL-IP-PHONE Class Map match-all MARK-DATA (id 8) Match access-group name ACL-DATA-PC Class Map match-all MARK-BULK (id 9) Match access-group name ACL-BULK-PC
5. Step 2 — Define Actions with policy-map
Policy-maps reference class-maps and assign an action to each
matched class. The order of classes in the policy-map matters
for classification — IOS evaluates class entries top to bottom
and assigns a packet to the first matching class. Classes are
evaluated sequentially; class-default always
appears last and catches everything remaining.
Policy-Map 1 — Ingress Marking Policy (LAN Trust Boundary)
! ── Ingress marking policy: remark DSCP at trust boundary ─ ! ── Applied INPUT on Gi0/0 (LAN-facing interface) ───────── NetsTuts_R1(config)#policy-map MARK-INGRESS NetsTuts_R1(config-pmap)# NetsTuts_R1(config-pmap)# class MARK-VOICE NetsTuts_R1(config-pmap-c)# set dscp ef ← mark voice EF (46) NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# NetsTuts_R1(config-pmap)# class MARK-DATA NetsTuts_R1(config-pmap-c)# set dscp af31 ← mark business data AF31 (26) NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# NetsTuts_R1(config-pmap)# class MARK-BULK NetsTuts_R1(config-pmap-c)# set dscp af11 ← mark bulk data AF11 (10) NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# NetsTuts_R1(config-pmap)# class class-default NetsTuts_R1(config-pmap-c)# set dscp default ← remark everything else BE (0) NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)#exit
set dscp default on class-default
in the marking policy is a security best practice — it
erases any DSCP values that an untrusted end device may
have set on its own traffic. Without this, a user could mark
their web-browsing traffic as DSCP EF and potentially receive
LLQ priority treatment on the WAN. By explicitly setting
class-default to DSCP 0, the router asserts control: only
traffic from known, trusted sources (IP phones and designated
PCs) carries elevated DSCP markings beyond the trust boundary.
Policy-Map 2 — WAN Egress Queuing Policy (LLQ + CBWFQ)
! ── WAN egress queuing policy ───────────────────────────── ! ── Applied OUTPUT on Gi0/1 (WAN-facing interface, 1.544 Mbps) ! ── Bandwidth budget for named classes: ! ── VOICE: 256 kbps (priority) ! ── VOICE-SIGNAL: 64 kbps (bandwidth guarantee) ! ── VIDEO: 512 kbps (bandwidth guarantee) ! ── CRITICAL-DATA: 256 kbps (bandwidth guarantee) ! ── BULK-DATA: 128 kbps (bandwidth guarantee) ! ── Total named: 1216 kbps (leaving ~328 kbps for class-default) ! ── WAN total: 1544 kbps ! ───────────────────────────────────────────────────────── NetsTuts_R1(config)#policy-map WAN-EGRESS NetsTuts_R1(config-pmap)# ! ── Class 1: Voice — LLQ strict priority ───────────────── ! ── priority guarantees 256 kbps and serves this queue FIRST ! ── before all other classes are served. Must not exceed ! ── the stated kbps or it is policed (default LLQ behaviour) NetsTuts_R1(config-pmap)# class VOICE NetsTuts_R1(config-pmap-c)# priority 256 NetsTuts_R1(config-pmap-c)# exit ! ── Class 2: Voice Signalling — CBWFQ bandwidth guarantee ─ NetsTuts_R1(config-pmap)# class VOICE-SIGNAL NetsTuts_R1(config-pmap-c)# bandwidth 64 NetsTuts_R1(config-pmap-c)# exit ! ── Class 3: Video — CBWFQ bandwidth guarantee ─────────── NetsTuts_R1(config-pmap)# class VIDEO NetsTuts_R1(config-pmap-c)# bandwidth 512 NetsTuts_R1(config-pmap-c)# exit ! ── Class 4: Critical Data — CBWFQ bandwidth guarantee ─── NetsTuts_R1(config-pmap)# class CRITICAL-DATA NetsTuts_R1(config-pmap-c)# bandwidth 256 NetsTuts_R1(config-pmap-c)# exit ! ── Class 5: Bulk Data — CBWFQ minimum guarantee ───────── NetsTuts_R1(config-pmap)# class BULK-DATA NetsTuts_R1(config-pmap-c)# bandwidth 128 NetsTuts_R1(config-pmap-c)# exit ! ── Class 6: Scavenger — policed to 128 kbps max ───────── ! ── Excess packets are DROPPED immediately (not queued) ──── NetsTuts_R1(config-pmap)# class SCAVENGER NetsTuts_R1(config-pmap-c)# police rate 128000 bps NetsTuts_R1(config-pmap-c)# conform-action transmit NetsTuts_R1(config-pmap-c)# exceed-action drop NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap-c)# exit ! ── Class default — fair-queue for remaining traffic ────── ! ── Remaining bandwidth (~328 kbps) shared fairly ───────── NetsTuts_R1(config-pmap)# class class-default NetsTuts_R1(config-pmap-c)# fair-queue NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)#exit
priority command — it
creates a strict-priority queue that is always served before
any other class. The priority 256 means the voice
queue gets up to 256 kbps of strict priority bandwidth; if
voice traffic exceeds 256 kbps, the excess is policed
(dropped) by default to prevent the strict priority queue from
starving other classes. CBWFQ (Class-Based Weighted
Fair Queuing) is configured with the
bandwidth command — it guarantees each class its
specified kbps during congestion. If the link is not congested,
a class can use more than its guaranteed bandwidth. If all
classes are competing simultaneously, each gets at least its
guaranteed allocation. The bandwidth values for all named
classes (including the priority class) must not exceed the
interface bandwidth — IOS will reject the policy-map if the
total exceeds 75% of the interface rate (the remaining 25% is
reserved for routing protocols and overhead by default). This
limit can be adjusted with max-reserved-bandwidth
on the interface.
Policy-Map 3 — Policing Policy (Rate-Limit an Ingress Class)
! ── Optional: ingress policing policy on WAN interface ──── ! ── Rate-limits inbound traffic classes from the WAN ─────── ! ── This is separate from the egress queuing policy ──────── NetsTuts_R1(config)#policy-map WAN-INGRESS-POLICE NetsTuts_R1(config-pmap)# ! ── Police all inbound traffic to 1 Mbps ───────────────── ! ── Conform (within rate): transmit with current DSCP ───── ! ── Exceed (burst over rate): remark to lower DSCP ──────── ! ── Violate (sustained over rate): drop ────────────────── NetsTuts_R1(config-pmap)# class class-default NetsTuts_R1(config-pmap-c)# police rate 1000000 bps burst 31250 byte NetsTuts_R1(config-pmap-c)# conform-action transmit NetsTuts_R1(config-pmap-c)# exceed-action set-dscp-transmit af12 NetsTuts_R1(config-pmap-c)# violate-action drop NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)#exit
police command uses a token-bucket algorithm
with three outcomes: conform (packet arrives
within the committed rate — tokens available), exceed
(packet exceeds the committed rate but within the burst
allowance), and violate (packet exceeds even
the burst). Each outcome has a configurable action:
transmit (forward as-is), drop
(discard), or set-dscp-transmit [value] (remark
and forward). The exceed-action of
set-dscp-transmit af12 implements a
dual-rate colour-aware policing pattern — packets that
burst slightly above the committed rate are re-marked to a
lower drop-preference DSCP value rather than dropped, giving
downstream routers the option to drop them first under
congestion. The burst size (burst 31250 byte)
should typically be set to the rate in bps divided by 8
(converting to bytes per second) multiplied by a target burst
duration — for 1 Mbps at 250ms burst: 1,000,000/8 × 0.25 =
31,250 bytes.
6. Step 3 — Apply to Interface with service-policy
The service-policy command is the only step that
activates a QoS policy. Until this command is applied, the
class-maps and policy-maps exist only as configuration
objects — no traffic is affected. Apply the marking policy
input on the LAN-facing interface, and the queuing
policy output on the WAN-facing interface.
Apply Policies to Interfaces
! ── LAN interface (Gi0/0) — ingress marking at trust boundary NetsTuts_R1(config)#interface gi0/0 NetsTuts_R1(config-if)# description LAN - Trust Boundary NetsTuts_R1(config-if)# ip address 10.1.0.1 255.255.255.0 NetsTuts_R1(config-if)# service-policy input MARK-INGRESS NetsTuts_R1(config-if)# no shutdown NetsTuts_R1(config-if)#exit ! ── WAN interface (Gi0/1) — egress queuing on the bottleneck NetsTuts_R1(config)#interface gi0/1 NetsTuts_R1(config-if)# description WAN - 1.544 Mbps T1 NetsTuts_R1(config-if)# ip address 10.0.12.1 255.255.255.252 NetsTuts_R1(config-if)# bandwidth 1544 ← inform IOS of actual speed NetsTuts_R1(config-if)# service-policy output WAN-EGRESS NetsTuts_R1(config-if)# no shutdown NetsTuts_R1(config-if)#exit ! ── Optional: ingress policing on WAN interface ─────────── ! ── (uncomment to enable) ───────────────────────────────── ! NetsTuts_R1(config-if)# service-policy input WAN-INGRESS-POLICE NetsTuts_R1(config)#end
bandwidth [kbps] interface command is critical
for MQC — it tells IOS the actual link speed for calculating
bandwidth percentages and validating that total guaranteed
bandwidths in the policy-map do not exceed the link capacity.
Without it, IOS uses the interface's hardware-reported speed
(1 Gbps for a GigabitEthernet port) — and a
bandwidth 256 command in the policy-map would be
treated as 256 kbps out of 1,000,000 kbps (0.026%), which is
meaningless. On a physical serial interface running at T1
speed (1.544 Mbps), bandwidth 1544 ensures
IOS correctly validates and scales the QoS policy. This is
one of the most common MQC misconfiguration issues on
Ethernet interfaces used for WAN connections.
One important rule: only one service-policy per direction per interface. Attempting to apply a second service-policy output to the same interface replaces the first. If you need to apply both a marking and a queuing action on egress, combine them into a single policy-map with a hierarchical policy (parent policy-map containing a child policy-map) — covered in advanced MQC labs.
Verify Service-Policy Application with show running-config
NetsTuts_R1#show running-config | section interface gi0 interface GigabitEthernet0/0 description LAN - Trust Boundary ip address 10.1.0.1 255.255.255.0 service-policy input MARK-INGRESS interface GigabitEthernet0/1 description WAN - 1.544 Mbps T1 ip address 10.0.12.1 255.255.255.252 bandwidth 1544 service-policy output WAN-EGRESS
7. Step 4 — Verify with show policy-map interface
show policy-map interface is the primary QoS
verification command. It shows every class in the attached
policy, the match criteria, the configured actions, and — most
importantly — the packet and byte counters that confirm traffic
is being classified and acted upon correctly.
show policy-map interface gi0/1 output — Egress Queuing Policy
NetsTuts_R1#show policy-map interface gi0/1 output
GigabitEthernet0/1
Service-policy output: WAN-EGRESS
Class-map: VOICE (match-all)
5823 packets, 931680 bytes ← total matched
5 minute offered rate 200000 bps ← current rate
Match: dscp ef (46)
Priority: 256 kbps, burst bytes 6400, b/w exceed drops: 0
Output queue: Conversation 264, High Priority queue,
16384/1464 (size/max packets), Drops: 0
(pkts output/bytes output) 5823/931680
Class-map: VOICE-SIGNAL (match-all)
142 packets, 15620 bytes
5 minute offered rate 5000 bps
Match: dscp cs3 (24)
Queueing
Output queue: Conversation 265, High Priority queue,
0/1000 (size/max packets), Drops: 0
bandwidth: 64 kbps, (current rate: 5 kbps)
Class-map: VIDEO (match-all)
18450 packets, 18450000 bytes
5 minute offered rate 480000 bps ← close to 512 kbps guarantee
Match: dscp af41 (34)
Queueing
Output queue: Conversation 266, WFQ queue,
12/1000 (size/max packets), Drops: 0
bandwidth: 512 kbps, (current rate: 480 kbps)
Class-map: CRITICAL-DATA (match-all)
3271 packets, 4742950 bytes
5 minute offered rate 150000 bps
Match: dscp af31 (26)
Queueing
Output queue: Conversation 267, WFQ queue,
0/1000 (size/max packets), Drops: 0
bandwidth: 256 kbps, (current rate: 150 kbps)
Class-map: BULK-DATA (match-all)
890 packets, 1424000 bytes
5 minute offered rate 60000 bps
Match: dscp af11 (10)
Queueing
Output queue: Conversation 268, WFQ queue,
5/1000 (size/max packets), Drops: 0
bandwidth: 128 kbps, (current rate: 60 kbps)
Class-map: SCAVENGER (match-all)
2104 packets, 3156000 bytes
5 minute offered rate 180000 bps ← exceeds 128 kbps limit
Match: dscp cs1 (8)
police:
rate 128000 bps, burst 4000 byte
conformed 729 packets, 1093500 bytes; actions:
transmit
exceeded 1375 packets, 2062500 bytes; actions:
drop
conformed 90000 bps, exceeded 90000 bps
Class-map: class-default (match-any)
4510 packets, 3382500 bytes
5 minute offered rate 120000 bps
Match: any
Queueing
Flow based Fair-queue: Classification hierarchy max flows 256
Output queue: 0/1000 (size/max packets), Drops: 0
show policy-map interface output is the
core QoS verification skill. For each class, the key fields
are: packets/bytes (total traffic matched
since the policy was applied — confirm traffic is hitting the
expected class), 5 minute offered rate
(current traffic rate — compare against configured bandwidth or
priority), Drops (queue drops or police drops
— zero drops in normal operation, non-zero in congestion or
policing), and current rate (actual bandwidth
being used vs guaranteed bandwidth). For the SCAVENGER class,
the police output shows 1375 packets exceeded and were dropped
— the scavenger traffic arrived at 180 kbps but was policed
to 128 kbps, with the excess 50 kbps worth of packets dropped.
This is the expected behaviour confirming the police action is
working. See show interfaces
for baseline interface statistics that complement QoS output.
show policy-map interface gi0/0 input — Ingress Marking Policy
NetsTuts_R1#show policy-map interface gi0/0 input
GigabitEthernet0/0
Service-policy input: MARK-INGRESS
Class-map: MARK-VOICE (match-all)
5823 packets, 931680 bytes
5 minute offered rate 200000 bps
Match: access-group name ACL-IP-PHONE
QoS Set
dscp ef ← marked these packets EF
Packets marked 5823
Class-map: MARK-DATA (match-all)
3271 packets, 4742950 bytes
5 minute offered rate 150000 bps
Match: access-group name ACL-DATA-PC
QoS Set
dscp af31
Packets marked 3271
Class-map: MARK-BULK (match-all)
890 packets, 1424000 bytes
5 minute offered rate 60000 bps
Match: access-group name ACL-BULK-PC
QoS Set
dscp af11
Packets marked 890
Class-map: class-default (match-any)
312 packets, 124800 bytes
5 minute offered rate 5000 bps
Match: any
QoS Set
dscp default ← overwrite any rogue markings
Packets marked 312
Additional Verification Commands
! ── Show all policy-maps configured (summary) ─────────────
NetsTuts_R1#show policy-map
Policy Map MARK-INGRESS
Class MARK-VOICE
set dscp ef
Class MARK-DATA
set dscp af31
Class MARK-BULK
set dscp af11
Class class-default
set dscp default
Policy Map WAN-EGRESS
Class VOICE
priority 256 (kbps)
Class VOICE-SIGNAL
bandwidth 64 (kbps)
...
! ── Show policy-map on a specific interface, both directions
NetsTuts_R1#show policy-map interface gi0/1
! ── Show queue statistics only (no class detail) ──────────
NetsTuts_R1#show queue gi0/1
! ── Reset policy counters (clears packet/byte counts) ─────
NetsTuts_R1#clear counters gi0/1
! ── Show all class-maps defined ───────────────────────────
NetsTuts_R1#show class-map
! ── Confirm a specific packet's DSCP after marking ────────
! ── (debug — only in lab, CPU intensive) ──────────────────
NetsTuts_R1#debug ip packet detail
! ── (stop with:) ──────────────────────────────────────────
NetsTuts_R1#undebug all
8. Common MQC Patterns — Ready-to-Use Configurations
Pattern 1 — Bandwidth Percent (Relative to Interface Speed)
! ── Using bandwidth percent instead of absolute kbps ────── ! ── Useful when deploying the same policy across links ───── ! ── of different speeds (no need to change the policy-map) ─ NetsTuts_R1(config)#policy-map WAN-EGRESS-PERCENT NetsTuts_R1(config-pmap)# class VOICE NetsTuts_R1(config-pmap-c)# priority percent 10 ← 10% of link speed NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# class VIDEO NetsTuts_R1(config-pmap-c)# bandwidth percent 30 ← 30% guaranteed NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# class CRITICAL-DATA NetsTuts_R1(config-pmap-c)# bandwidth percent 20 ← 20% guaranteed NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# class class-default NetsTuts_R1(config-pmap-c)# bandwidth percent 25 ← 25% minimum NetsTuts_R1(config-pmap-c)# exit ! ── Remaining 15% available for burst/overflow ──────────── NetsTuts_R1(config-pmap)#exit ! ── The same policy-map can now be applied to a 10 Mbps ─── ! ── or 100 Mbps interface and the percentages scale ──────── ! ── automatically with the configured bandwidth statement ──
bandwidth percent, one policy-map works everywhere
— IOS calculates the actual kbps from the interface's
bandwidth statement. The total of all bandwidth
percent values including priority percent must not exceed 100%
(or more precisely, 75% for named classes by default, with
the remaining 25% reserved for routing protocol overhead and
class-default minimum).
Pattern 2 — Policing with Three-Colour Marking
! ── Three-colour policing: conform/exceed/violate ───────── ! ── Used at ISP handoff to enforce contracted CIR/PIR ───── ! ── CIR = Committed Information Rate (always delivered) ─── ! ── PIR = Peak Information Rate (delivered if capacity) ─── ! ── Excess beyond PIR: dropped ──────────────────────────── NetsTuts_R1(config)#policy-map ISP-HANDOFF-POLICE NetsTuts_R1(config-pmap)# class class-default NetsTuts_R1(config-pmap-c)# NetsTuts_R1(config-pmap-c)# police rate 1000000 bps peak-rate 2000000 bps NetsTuts_R1(config-pmap-c)# burst 31250 peak-burst 62500 NetsTuts_R1(config-pmap-c)# conform-action transmit ← within CIR NetsTuts_R1(config-pmap-c)# exceed-action set-dscp-transmit af12 ← CIRPattern 3 — NBAR Application-Based Classification
! ── Classify by application protocol using NBAR2 DPI ────── ! ── (requires ip nbar protocol-discovery on the interface) ─ NetsTuts_R1(config)#class-map match-any STREAMING-VIDEO NetsTuts_R1(config-cmap)# description Streaming video apps - NBAR NetsTuts_R1(config-cmap)# match protocol youtube NetsTuts_R1(config-cmap)# match protocol netflix NetsTuts_R1(config-cmap)# match protocol attribute category streaming-video NetsTuts_R1(config-cmap)#exit NetsTuts_R1(config)#class-map match-any VOIP-APPS NetsTuts_R1(config-cmap)# description VoIP applications - NBAR NetsTuts_R1(config-cmap)# match protocol cisco-phone NetsTuts_R1(config-cmap)# match protocol rtp NetsTuts_R1(config-cmap)# match protocol sip NetsTuts_R1(config-cmap)#exit NetsTuts_R1(config)#class-map match-any BUSINESS-SAAS NetsTuts_R1(config-cmap)# description Business SaaS - NBAR NetsTuts_R1(config-cmap)# match protocol attribute category office-suite NetsTuts_R1(config-cmap)# match protocol salesforce NetsTuts_R1(config-cmap)# match protocol ms-office-365 NetsTuts_R1(config-cmap)#exit ! ── Enable NBAR protocol discovery on the interface ─────── NetsTuts_R1(config)#interface gi0/0 NetsTuts_R1(config-if)# ip nbar protocol-discovery NetsTuts_R1(config-if)#exit ! ── Verify NBAR is recognising protocols ────────────────── NetsTuts_R1#show ip nbar protocol-discovery interface gi0/0 stats byte-count top-n 10 GigabitEthernet0/0 30 Second Rate Cumulative Count Input Output Input Output Protocol bps bps Bytes Bytes ------------------------------------------------------------------- youtube 0 245000 0 14750000 sip 24000 12000 1440000 720000 rtp 180000 165000 10800000 9900000 http 15000 8000 900000 480000NBAR2 (Network-Based Application Recognition) performs deep packet inspection to identify applications by their protocol signatures — not just port numbers. This is critical for modern applications that use dynamic ports or HTTPS: NBAR can identify YouTube traffic on port 443 that a standard ACL would classify as generic HTTPS. Thematch protocol attribute categorysyntax uses NBAR's application categories to match a group of related protocols with a single statement —category streaming-videomatches all known streaming video services without listing each one individually. NBAR does add some CPU overhead, so its use should be limited to interfaces where fine-grained application classification is genuinely required and the router has sufficient processing capacity.Pattern 4 — Queue-Limit and DSCP-Based WRED
! ── queue-limit: control max queue depth (prevents bufferbloat) ! ── random-detect: WRED — probabilistic early drop before queue fills NetsTuts_R1(config)#policy-map WAN-EGRESS-WRED NetsTuts_R1(config-pmap)# NetsTuts_R1(config-pmap)# class VOICE NetsTuts_R1(config-pmap-c)# priority 256 NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# class CRITICAL-DATA NetsTuts_R1(config-pmap-c)# bandwidth 256 NetsTuts_R1(config-pmap-c)# queue-limit 64 packets ← max 64 pkts in queue NetsTuts_R1(config-pmap-c)# random-detect dscp-based ← WRED by DSCP value NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# class BULK-DATA NetsTuts_R1(config-pmap-c)# bandwidth 128 NetsTuts_R1(config-pmap-c)# queue-limit 32 packets ← smaller queue = faster response NetsTuts_R1(config-pmap-c)# random-detect dscp-based NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)# class class-default NetsTuts_R1(config-pmap-c)# fair-queue NetsTuts_R1(config-pmap-c)# queue-limit 128 packets NetsTuts_R1(config-pmap-c)# exit NetsTuts_R1(config-pmap)#exitqueue-limitcaps the maximum number of packets that can wait in a class's queue — when the queue is full, new arrivals are tail-dropped. Setting a smaller queue limit reduces latency (packets wait less time) but increases drop rate during bursts.random-detect dscp-basedenables WRED (Weighted Random Early Detection) — it starts probabilistically dropping packets before the queue is completely full, which signals TCP senders to slow down before a catastrophic full-queue tail-drop event. WRED is most effective for TCP bulk data flows (file transfers, database backups) and should not be applied to voice queues (which use the priority command and have their own policing).
9. Troubleshooting MQC Policies
| Symptom | Diagnosis | Cause and Fix |
|---|---|---|
| Policy-map rejected with "bandwidth sum exceeds the interface bandwidth" when applying service-policy | show policy-map [name] — review total bandwidth allocations. show interfaces gi0/1 | include BW — check reported interface bandwidth |
The total of all bandwidth and priority allocations in the policy-map exceeds 75% of the interface bandwidth. Either reduce the allocations, increase the bandwidth statement on the interface to reflect the actual link speed, or use max-reserved-bandwidth 100 on the interface to remove the 25% reservation (use with care) |
| Traffic not matching the expected class — all packets going to class-default | show policy-map interface gi0/1 output — check packet counters per class. Zero packets in named classes means classification is failing |
Class-map mismatch: the DSCP value on the packets does not match the match dscp statement, or the ACL in match access-group does not match the traffic. Verify with show policy-map interface gi0/0 input — are the marking counters incrementing? If the marking policy counter also shows zero, the ACLs may not match the traffic. Use debug ip packet detail briefly to check packet DSCP values |
| Voice still experiencing delay even with LLQ configured | show policy-map interface — check b/w exceed drops counter on the VOICE priority class. Check queue depth on other classes |
If b/w exceed drops is non-zero, voice is sending more than the configured priority rate and the excess is being policed (dropped). Increase the priority kbps value to match actual voice traffic volume. Also verify the marking policy (MARK-INGRESS) is correctly marking voice as DSCP EF — if voice is marked incorrectly it will fall into a non-priority class |
| Scavenger traffic not being policed — still consuming full bandwidth | show policy-map interface — check police conformed/exceeded counters. If conformed count equals total packets (no exceeded), the police rate is too high |
Police rate configured correctly but the upstream marking policy is not marking scavenger traffic as DSCP CS1. Scavenger traffic marked as DSCP 0 falls into class-default, not the SCAVENGER class. Verify the marking policy is correctly identifying and marking the scavenger traffic sources |
| Removing or changing a policy-map that is already applied to an interface | IOS does not allow modification of a policy-map that is currently attached to an interface via service-policy | Remove the service-policy from the interface first (no service-policy output WAN-EGRESS), make changes to the policy-map, then re-apply (service-policy output WAN-EGRESS). This causes a brief interruption in QoS enforcement during the change window. In IOS-XE 16.x and later, some in-service policy changes are permitted |
| NBAR classification not working — traffic falling to class-default | show ip nbar protocol-discovery interface [intf] — verify NBAR is seeing and classifying the protocol traffic |
ip nbar protocol-discovery not enabled on the interface, NBAR protocol pack out of date (update with ip nbar protocol-pack [file]), or the application uses certificate pinning/encryption that prevents DPI classification. As a fallback, use DSCP-based or ACL-based classification |
Key Points & Exam Tips
- MQC is always three steps:
class-map(define what traffic),policy-map(define what to do),service-policy(activate on an interface). Nothing happens to traffic untilservice-policyis applied. Know this sequence for every QoS question. - class-map match-all vs match-any:
match-all(default) requires ALL match statements to be true — logical AND.match-anyrequires ANY match statement to be true — logical OR. A class-map with a single match statement behaves the same either way. - class-default is always implicitly present in every policy-map and catches all traffic not matched by any named class. You reference it in the policy-map but never create a class-map for it. Forgetting to define an action for class-default means unclassified traffic gets no QoS treatment (forwarded as best-effort with no guarantee).
- LLQ vs CBWFQ:
priority [kbps]creates a strict-priority (LLQ) queue — always served first, policed if it exceeds the rate. Use for voice (DSCP EF).bandwidth [kbps]creates a CBWFQ queue — guaranteed minimum during congestion, can use more if available. Use for video and data classes. Only onepriorityclass is typically configured per policy-map. - Police vs Shape:
policedrops (or re-marks) excess packets immediately — no additional delay, but causes packet loss.shapebuffers excess packets and smooths the output rate — no drops (unless the shape buffer fills), but adds delay and jitter. Shape is preferred before a policed link; police is used for enforcement. On the exam, know that policing is a two-bucket (conform/exceed) or three-bucket (conform/exceed/violate) token algorithm. - The bandwidth statement on the interface is critical for MQC on Ethernet WAN links. If the interface has
bandwidth 1544(for a T1) but the policy-map usesbandwidth 512, IOS calculates 512/1544 = 33% allocation. If the bandwidth statement is missing or wrong, all percentage and validation calculations are incorrect. - Service-policy direction:
inputis applied to arriving (ingress) traffic — used for marking and policing.outputis applied to departing (egress) traffic — used for queuing and shaping. Queuing policies (priority/bandwidth) only make sense on egress — congestion is an egress phenomenon (too much traffic trying to leave). On the exam, if a question involves voice quality or bandwidth guarantees, the answer typically involves an output service-policy. - show policy-map interface is the verification command. The key fields to check: packet/byte counters per class (confirm classification is working),
b/w exceed dropson priority class (LLQ policing drops — should be zero or very low), police conformed/exceeded/violated counters (confirm policing rates), and queue depth (current/max — a full queue indicates sustained congestion). - The trust boundary pattern: ingress marking policy (
service-policy input) at the access layer or WAN ingress, followed by DSCP-based classification in the egress queuing policy (service-policy output) at the WAN link. For MQC used to protect the router's own control plane, see Control Plane Policing (CoPP) — the identical three-step MQC framework applied tocontrol-planeinstead of an interface.
shape average.
For complete voice QoS with LLQ and the recommended Cisco QoS
baseline — see
CBWFQ & LLQ
Configuration which covers the full voice-ready QoS policy
model. For CoPP which uses the identical MQC framework to protect
the router CPU, see
Control Plane Policing
(CoPP). For voice VLANs that feed into QoS policies,
see Voice VLAN
Configuration. For ACLs used in class-map match criteria,
see
Extended ACL
Configuration.