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 |
Assigns a name to the class map. |
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 Release 15.2(7)E3k |
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 policy-map class configuration mode. These configuration commands are available:
-
exit—Exits policy-map class configuration mode and returns to policy-map configuration mode.
-
no—Returns a command to its default setting.
-
police—Defines a policer for the classified traffic. The policer specifies the bandwidth limitations and the action to take when the limits are exceeded. For more information, see police .
-
set—Specifies a value to be assigned to the classified traffic. For more information, see set .
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.
Examples
This example shows how to configure a default traffic class to a policy map:
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)# exit
Device(config-pmap)# exit
You can verify your settings by entering the show policy-map privileged EXEC command.
This example shows how the default traffic class is automatically placed at the end of policy-map pm3 even though class-default was configured first:
Device# show policy-map pm3
Policy Map pm3
Class cm-3
set dscp 4
Class class-default
set dscp 10
Device#