Use it when traffic does not land in the intended QoS class.
Class Map
A class-map defines which traffic belongs to a class, using match criteria such as DSCP, ACL, protocol (NBAR) or CoS, with match-any or match-all logic.
1. Class-maps classify traffic (match-any/match-all).
2. Match DSCP, ACL, NBAR protocol.
3. class-default catches the rest.
4. Order of classes matters in the policy.
5. Verify counters.
traffic → class-map match → class
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
class-map match-any <name>Primary Commands
Configuration and operational commands for this Topic.
class-map match-any <name>ReferenceCreate a class map that matches traffic if any match statement is true.
Use when: Use this command at the QoS boundary in the documented evidence chain.
Quick note: Cisco IOS / IOS XE first. A configured policy-map does not prove attachment, matching traffic, congestion or end-to-end service quality.
Cisco IOS / IOS XE · mixedclass-map match-all <name>ReferenceCreate a class map that matches traffic only if all match statements are true.
Use when: Use this command at the QoS boundary in the documented evidence chain.
Quick note: Cisco IOS / IOS XE first. A configured policy-map does not prove attachment, matching traffic, congestion or end-to-end service quality.
Cisco IOS / IOS XE · mixedmatch access-group name <acl>ReferenceMatch traffic in a class map using a named ACL.
Use when: Use at the Control Plane Policing / CoPP boundary after prerequisite state is verified.
Quick note: Operational guidance. CoPP counters do not alone prove an attack or safe thresholds; legitimate bursts can exceed a poorly sized policer.
Cisco IOS / IOS XE · mixedmatch dscp <value>ReferenceMatch traffic in a class map by DSCP value.
Use when: Use this command at the QoS boundary in the documented evidence chain.
Quick note: Cisco IOS / IOS XE first. A configured policy-map does not prove attachment, matching traffic, congestion or end-to-end service quality.
Cisco IOS / IOS XE · mixedmatch cos <value>ReferenceMatch traffic in a class map by 802.1p CoS value.
Use when: Use this command at the QoS boundary in the documented evidence chain.
Quick note: Cisco IOS / IOS XE first. A configured policy-map does not prove attachment, matching traffic, congestion or end-to-end service quality.
Cisco IOS / IOS XE · mixedShow Commands
Read-only Cisco show commands for confirming state, narrowing a fault and interpreting the current boundary.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification and what it shows Verify boundary
Generate traffic with known DSCP/protocol/address characteristics, verify it increments the intended class under the applied service policy and confirm competing classes do not match unexpectedly. A class-map definition shows desired matching logic only; applied policy counters show effective classification for the observed traffic.
Step 2 Verification and output interpretation Verify boundary
Verify the class-map definition first, then confirm which policy references it and where that policy is attached. Use policy/interface counters with representative traffic to show packets are actually entering the class. If counters remain zero, check direction, attachment point and match criteria before changing queue parameters. Compare offered packets/bytes over a time interval because a static zero can simply mean no matching traffic occurred during the observation window.
Step 3 Observation → implication → next check Narrow the fault
Observation → implication → next check: zero class matches with known traffic points to match criteria, direction or policy attachment before scheduler behavior. Matches in the wrong class point to overlapping criteria/order. Correct class counters with bad treatment move to the policy-map action and interface scheduler rather than changing classification.
- A class map defines which traffic belongs to a class using match statements.
match-anyneeds one match;match-allneeds all.- Unmatched traffic falls into
class-default.
show class-map— class definitionsshow policy-map interface <interface>— packets matched per class
ReferenceWhy it matters2 sections · depth on demand
When to use it
Use it to express service intent and protect constrained resources under congestion.
How it works in operation
A class map defines packet classification criteria and match-all/match-any behavior; it does not itself queue, police or mark traffic until referenced by a policy map that is applied to an interface or control point. Classification counters are effective-state evidence and should be tied to the direction and traffic tuple being tested.
ReferenceImportant terms & boundaries4 sections · depth on demand
In depth
A class map defines which packets belong to a traffic class
In the Catalyst 9300 QoS guide's MQC model, a class map holds match criteria, and a policy map refers to it to apply actions. Match criteria include access lists, DSCP, IP precedence, CoS, VLAN and QoS group.
C9300(config)# class-map match-any CM-VIDEO
C9300(config-cmap)# match dscp af41 af42 af43
C9300(config-cmap)# match dscp cs4
C9300(config)# class-map match-all CM-VOICE-VLAN20
C9300(config-cmap)# match dscp ef
C9300(config-cmap)# match vlan 20
C9300(config)# class-map match-any CM-SCAVENGER
C9300(config-cmap)# match access-group name ACL-BACKUP
C9300# show class-map CM-VIDEO
Class Map match-any CM-VIDEO (id 3)
Match dscp af41 (34) af42 (36) af43 (38)
Match dscp cs4 (32)
match-any versus match-all
| Keyword | A packet belongs to the class if |
|---|---|
match-any | Any one criterion matches |
match-all (default) | Every criterion matches |
Documented rules
| Rule | Consequence |
|---|---|
| IPv4 and IPv6 matches can't be mixed in one class map | Separate class maps per address family |
| In a policy map, the first matching class wins | Put specific classes before general ones |
Unmatched traffic goes to class-default | Configure it explicitly |
Matching with ACLs
| ACL entry | Effect in a class map |
|---|---|
permit | Traffic matches the class |
deny | Traffic doesn't match this class; it continues to the next class |
ACL deny in a QoS ACL doesn't drop traffic. It only excludes it from the class.
Naming
Name class maps after what they represent (CM-VOICE, CM-VIDEO, CM-SCAVENGER), not after the queue they use. The same class map can then be reused in input and output policies on different platforms.
Checks
show class-map shows the criteria. show policy-map interface shows how many packets hit each class. A class with zero hits usually means a wrong match or the wrong direction.
Documented example, not captured output.
Quick reference
A class map defines a traffic class with match criteria such as DSCP, ACL, NBAR protocol or CoS. match-any requires one criterion to match; match-all (default) requires all of them.
class-map match-any VOICE
match dscp ef
class-map match-any CRITICAL-DATA
match protocol citrix
match access-group name ERP-SERVERS
Documented example, not captured output.
Traffic that matches no class falls into class-default. Order matters in the policy map, not in the class map.
State model and technical mechanics
Classification is the first logical stage of MQC-style QoS policy. A class map can match fields such as DSCP/CoS, ACL-defined addresses/protocols, protocol recognition or other platform-supported attributes. match-all requires all configured match criteria to succeed, while match-any treats any criterion as sufficient. Classification happens at the policy attachment point and direction, so the same packet can be classified differently at different interfaces or before/after another marking function. The class-map name is only a reference object; operational effect begins when a policy map uses it and that policy is attached to traffic. Read the mechanism as a chain of dependent state rather than a single boolean. The same configured object can be healthy locally while an adjacent interface, policy, route, neighbor or endpoint prevents the intended service, so the reference keeps those state boundaries explicit.
Limits and common misconceptions
A class map that parses correctly does not affect forwarding until it is referenced by an active policy. Matching a packet also does not imply the traffic received priority or bandwidth; that depends on the policy action. Likewise, DSCP match semantics do not show the marking is trustworthy—an endpoint can set a value unless the design defines where markings are accepted or rewritten.
ReferenceConfiguration & state1 section · depth on demand
Design and configuration model
Build classes around explicit traffic intent and keep match criteria mutually understandable. Avoid broad ACL or protocol matches that unintentionally absorb traffic intended for another class, and remember that class evaluation order in the policy can matter when matches overlap. Where markings are trusted from upstream, document the trust boundary; where traffic must be identified independently, match on fields appropriate to that boundary. Prefer a small number of explainable classes over a taxonomy so granular that counters cannot be interpreted operationally.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in IP Services → QoS → Class Map. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc2475.html · confidence 94%Quick lookup tables
Class Map · technical reference
Compact mechanics, configuration and evidence boundaries for fast lookup.
| Layer | Question |
|---|---|
| Class map | Which packets match? |
| Policy map | What action applies? |
| Service policy | Where/direction is it active? |
| Counters | Did real traffic hit the class? |