class
To define a traffic classification match criteria for the specified class-map name, use the class command in policy-map configuration mode. Use the no form of this command to delete an existing class map.
class {class-map-name | class-default}
no class {class-map-name | class-default}
Syntax Description
class-map-name |
The class map name. |
class-default |
Refers to a system default class that matches unclassified packets. |
Command Default
No policy map class-maps are defined.
Command Modes
Policy-map configuration
Command History
Release |
Modification |
---|---|
Cisco IOS XE 3.3SE |
This command was introduced. |
Usage Guidelines
Before using the class command, you must use the policy-map global configuration command to identify the policy map and enter policy-map configuration mode. After specifying a policy map, you can configure a policy for new classes or modify a policy for any existing classes in that policy map. You attach the policy map to a port by using the service-policy interface configuration command.
After entering the class command, you enter the policy-map class configuration mode. These configuration commands are available:
-
admit —Admits a request for Call Admission Control (CAC)
-
bandwidth —Specifies the bandwidth allocated to the class.
-
exit —Exits the policy-map class configuration mode and returns to policy-map configuration mode.
-
no —Returns a command to its default setting.
-
police —Defines a policer or aggregate policer for the classified traffic. The policer specifies the bandwidth limitations and the action to take when the limits are exceeded. For more information about this command, see Cisco IOS Quality of Service Solutions Command Reference available on Cisco.com.
-
priority —Assigns scheduling priority to a class of traffic belonging to a policy map.
-
queue-buffers —Configures the queue buffer for the class.
-
queue-limit —Specifies the maximum number of packets the queue can hold for a class policy configured in a policy map.
-
service-policy —Configures a QoS service policy.
-
set —Specifies a value to be assigned to the classified traffic. For more information, see set
-
shape —Specifies average or peak rate traffic shaping. For more information about this command, see Cisco IOS Quality of Service Solutions Command Reference available on Cisco.com.
To return to policy-map configuration mode, use the exit command. To return to privileged EXEC mode, use the end command.
The class command performs the same function as the class-map global configuration command. Use the class command when a new classification, which is not shared with any other ports, is needed. Use the class-map command when the map is shared among many ports.
You can configure a default class by using the class class-default policy-map configuration command. Unclassified traffic (traffic that does not meet the match criteria specified in the traffic classes) is treated as default traffic.
You can verify your settings by entering the show policy-map privileged EXEC command.
Examples
This example shows how to create a policy map called policy1. When attached to the ingress direction, it matches all the incoming traffic defined in class1, sets the IP Differentiated Services Code Point (DSCP) to 10, and polices the traffic at an average rate of 1 Mb/s and bursts at 20 KB. Traffic exceeding the profile is marked down to a DSCP value gotten from the policed-DSCP map and then sent.
Device(config)# policy-map policy1
Device(config-pmap)# class class1
Device(config-pmap-c)# set dscp 10
Device(config-pmap-c)# police 1000000 20000 conform-action
Device(config-pmap-c)# police 1000000 20000 exceed-action
Device(config-pmap-c)# exit
This example shows how to configure a default traffic class to a policy map. It also shows how the default traffic class is automatically placed at the end of policy-map pm3 even though class-default was configured first:
Device# configure terminal
Device(config)# class-map cm-3
Device(config-cmap)# match ip dscp 30
Device(config-cmap)# exit
Device(config)# class-map cm-4
Device(config-cmap)# match ip dscp 40
Device(config-cmap)# exit
Device(config)# policy-map pm3
Device(config-pmap)# class class-default
Device(config-pmap-c)# set dscp 10
Device(config-pmap-c)# exit
Device(config-pmap)# class cm-3
Device(config-pmap-c)# set dscp 4
Device(config-pmap-c)# exit
Device(config-pmap)# class cm-4
Device(config-pmap-c)# set precedence 5
Device(config-pmap-c)# exit
Device(config-pmap)# exit
Device# show policy-map pm3
Policy Map pm3
Class cm-3
set dscp 4
Class cm-4
set precedence 5
Class class-default
set dscp af11