class-map match-any [name]
Creates a class map that matches traffic if any one of the specified match criteria is true, used to classify traffic for QoS policies.
class-map match-any [name]When to Use This Command
- Classify multiple types of traffic (e.g., HTTP, FTP) into a single class for bandwidth allocation
- Mark traffic from different source subnets with the same DSCP value
- Apply policing to a mix of voice and video traffic that share a common ACL
- Combine different match criteria (e.g., protocol and port) to identify application traffic
Command Examples
Creating a class map to match HTTP or FTP traffic
class-map match-any WEB_AND_FTPRouter(config-cmap)# match protocol http Router(config-cmap)# match protocol ftp Router(config-cmap)# exit
The class-map command enters class-map configuration mode. The 'match-any' keyword means traffic matching any one of the subsequent match statements will be classified. Here, HTTP or FTP traffic will match. The 'exit' command returns to global config.
Creating a class map with multiple ACLs
class-map match-any CRITICAL_APPSRouter(config-cmap)# match access-group name VOICE_ACL Router(config-cmap)# match access-group name VIDEO_ACL Router(config-cmap)# end
This class map matches traffic that matches either the VOICE_ACL or the VIDEO_ACL. The 'end' command exits to privileged EXEC mode. The class map is now ready to be used in a policy map.
Understanding the Output
The class-map command itself does not produce output; it enters a configuration submode. The output shown is the CLI prompt changes. After configuration, use 'show class-map' to verify. The output of 'show class-map' lists all class maps, their match type (match-all or match-any), and the match criteria. For a class-map match-any, any single match criterion being true makes the traffic belong to that class. In a real network, you would then apply the class map in a policy map to perform QoS actions like marking, policing, or queuing.
CCNA Exam Tips
Remember: 'match-any' is OR logic; 'match-all' is AND logic. Exam questions often test the difference.
You can match on protocols, ACLs, DSCP values, CoS, etc. Know which match types are available.
Class maps are useless without being referenced in a policy map. The exam may ask you to identify missing steps.
The class-map name is case-sensitive and must be unique on the device.
Common Mistakes
Using 'match-all' when 'match-any' is needed, causing traffic that meets only one criterion to not be classified.
Forgetting to exit class-map configuration mode before creating the policy map.
Typing the class-map name incorrectly, leading to a mismatch when applying in a policy map.
Related Commands
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.
policy-map [name]
Creates or modifies a QoS policy-map that defines a set of class-maps and associated actions (e.g., bandwidth, priority, drop) to apply to traffic on Cisco IOS routers.
show class-map
Displays the configuration and match criteria of all class maps or a specific class map, used to verify QoS classification rules.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions