QoSPolicy-map Config

class [class-map-name]

The class command in policy-map configuration mode associates a traffic class (defined via class-map) with a set of QoS actions (like policing, shaping, or marking) within a service policy.

Syntax·Policy-map Config
class [class-map-name]

When to Use This Command

  • Apply bandwidth guarantees to voice traffic while limiting web traffic in a WAN link.
  • Mark VoIP packets with DSCP EF and police FTP traffic to 10 Mbps.
  • Shape all traffic from a specific VLAN to 50 Mbps using a parent policy.
  • Drop traffic exceeding a rate limit for a specific application class.

Command Examples

Basic class configuration with bandwidth and police

policy-map QOS_POLICY class VOICE priority 1000 police 1000000 20000 40000 conform-action transmit exceed-action drop class WEB bandwidth 2000 random-detect dscp-based class class-default fair-queue
Router(config)# policy-map QOS_POLICY
Router(config-pmap)# class VOICE
Router(config-pmap-c)# priority 1000
Router(config-pmap-c)# police 1000000 20000 40000 conform-action transmit exceed-action drop
Router(config-pmap-c)# exit
Router(config-pmap)# class WEB
Router(config-pmap-c)# bandwidth 2000
Router(config-pmap-c)# random-detect dscp-based
Router(config-pmap-c)# exit
Router(config-pmap)# class class-default
Router(config-pmap-c)# fair-queue
Router(config-pmap-c)# end

The 'class VOICE' enters the class configuration for the VOICE class-map. 'priority 1000' reserves 1000 kbps with strict priority. 'police' sets a policer at 1 Mbps with burst parameters. 'class WEB' enters the WEB class, 'bandwidth 2000' guarantees 2000 kbps, 'random-detect dscp-based' enables WRED. 'class class-default' configures the default class with fair-queue.

Using class with match-all and match-any in a policy

policy-map SHAPE_PARENT class class-default shape average 10000000 service-policy CHILD_POLICY
Router(config)# policy-map SHAPE_PARENT
Router(config-pmap)# class class-default
Router(config-pmap-c)# shape average 10000000
Router(config-pmap-c)# service-policy CHILD_POLICY
Router(config-pmap-c)# end

This example shows a parent policy that shapes all traffic to 10 Mbps and then applies a child policy (CHILD_POLICY) for finer classification. The 'class class-default' matches all traffic not matched by other classes.

Understanding the Output

The class command itself does not produce output; it enters a subconfiguration mode. The relevant output appears when you use 'show policy-map' or 'show policy-map interface'. In 'show policy-map interface', each class is listed with counters for packets, bytes, and actions (e.g., dropped, marked). Key fields: 'Class' shows the class-map name; 'Matched' shows packets/bytes matching; 'Actions' show what was applied (e.g., priority, bandwidth, police). Good values: low drop counts for priority classes, high match counts for expected traffic. Bad values: excessive drops in a class indicate congestion or misconfiguration. Watch for 'conform/exceed' actions in police output to see if traffic is within limits.

CCNA Exam Tips

1.

CCNA exam tip: The 'class' command is used only inside a policy-map; you must first create a class-map with 'class-map'.

2.

CCNA exam tip: 'class class-default' is always present and matches all traffic not matched by other classes; you cannot delete it.

3.

CCNA exam tip: In a policy-map, you can use 'class' multiple times, but each class-map name must be unique.

4.

CCNA exam tip: The order of classes matters; traffic is matched against classes in the order they are configured.

Common Mistakes

Mistake 1: Forgetting to create the class-map before referencing it in a policy-map, causing an error.

Mistake 2: Using 'class' with a class-map that has no match statements, resulting in no traffic being matched.

Mistake 3: Applying conflicting actions (e.g., both 'priority' and 'bandwidth' in the same class) which is not allowed.

Related Commands

Practice for the CCNA 200-301

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

Practice CCNA Questions