QoSGlobal Config

class-map match-all [name]

Creates a class map that matches packets based on multiple match criteria, requiring all conditions to be true (logical AND) for traffic classification in QoS policies.

Syntax·Global Config
class-map match-all [name]

When to Use This Command

  • Classify VoIP traffic by matching both DSCP EF and UDP port range 16384-32767 to ensure priority queuing.
  • Identify mission-critical database traffic by matching source IP subnet 10.1.1.0/24 and destination TCP port 1521.
  • Isolate video conferencing traffic by matching both DSCP AF41 and RTP port range 10000-20000.
  • Classify management traffic by matching protocol SSH (TCP/22) and destination IP 192.168.1.0/24.

Command Examples

Classify VoIP traffic with DSCP and UDP port

class-map match-all VOIP match ip dscp ef match ip udp range 16384 32767
Router(config-cmap)# class-map match-all VOIP
Router(config-cmap)# match ip dscp ef
Router(config-cmap)# match ip udp range 16384 32767
Router(config-cmap)# exit
Router(config)# do show class-map VOIP
Class Map match-all VOIP (id 1)
   Match criteria:
      ip dscp: ef (46)
      ip udp range 16384 32767
   Description:

The class-map is named VOIP and uses match-all (AND). The output shows two match statements: DSCP EF (46) and UDP ports 16384-32767. Both must match for a packet to belong to this class.

Classify database traffic with source subnet and TCP port

class-map match-all DB_TRAFFIC match access-group name DB_ACL match ip dscp af31
Router(config-cmap)# class-map match-all DB_TRAFFIC
Router(config-cmap)# match access-group name DB_ACL
Router(config-cmap)# match ip dscp af31
Router(config-cmap)# exit
Router(config)# do show class-map DB_TRAFFIC
Class Map match-all DB_TRAFFIC (id 2)
   Match criteria:
      access-group: name DB_ACL
      ip dscp: af31 (26)
   Description:

This class-map uses an ACL named DB_ACL (which could match source subnet and TCP port) combined with DSCP AF31. Both conditions must be true. The output shows the match criteria.

Understanding the Output

The 'show class-map [name]' command displays the class-map configuration. The 'Class Map match-all' line indicates the name and match type (match-all = AND). The 'id' is an internal identifier. Under 'Match criteria', each match statement is listed. For 'ip dscp', the value and numeric code are shown (e.g., ef (46)). For 'access-group', it shows the ACL name. For 'ip udp range', it shows the port range. If a match is not configured, it will not appear. A properly configured class-map should have at least one match statement. Missing match statements or incorrect syntax will cause errors when applying the policy-map. In production, verify that the class-map matches the intended traffic using 'show policy-map interface' to see packet counters.

CCNA Exam Tips

1.

Remember: match-all requires ALL conditions to match (logical AND); match-any requires ANY condition to match (logical OR).

2.

The class-map name is case-sensitive and must be unique; spaces are not allowed.

3.

You cannot use 'match ip dscp' and 'match ip precedence' in the same match-all class-map; they are mutually exclusive.

4.

CCNA exam may ask you to identify the correct class-map type for a given QoS requirement (e.g., VoIP needs DSCP EF AND UDP port).

Common Mistakes

Using match-all when match-any is needed, causing traffic to not be classified because not all conditions are met.

Forgetting to enter the class-map sub-configuration mode before adding match statements, resulting in syntax errors.

Mixing match types like 'match ip dscp' and 'match ip precedence' in the same class-map, which is invalid.

Related Commands

Practice for the CCNA 200-301

Test your knowledge with hundreds of CCNA practice questions covering all exam domains.

Practice CCNA Questions