class (policy-map)
To specify the name of the class whose policy you want to create or change, use the class command in policy map configuration mode. To remove a class from the policy map, use the no form of this command.
class [type qos] {class-name | class-default}
no class [type qos] {class-name | class-default}
Syntax Description
type qos |
(Optional) Specifies a quality-of-service (QoS) class. |
class-name |
Name of the class for which you want to configure or modify policy. |
class-default |
Configures the default class. |
Command Default
No class is specified.
Type is QoS when not specified.
Command Modes
Policy map configuration
Command History
Release |
Modification |
---|---|
Release 6.0 |
This command was introduced. |
Usage Guidelines
Within a policy map, the class (policy-map) command can be used to specify the name of the class whose policy you want to create or change. The policy map must be identified first.
To identify the policy map (and enter the required policy map configuration mode), use the policy-map command before you use the class (policy-map) command. After you specify a policy map, you can configure the policy for new classes or modify the policy for any existing classes in that policy map.
The class name that you specify in the policy map ties the characteristics for that class—that is, its policy—to the class map and its match criteria, as configured using the class-map command.
RP/0/RP0/CPU0:router(config)# class-map p2
RP/0/RP0/CPU0:router(config-cmap)# match precedence 2
RP/0/RP0/CPU0:router(config-cmap)# end-class-map
RP/0/RP0/CPU0:router(config)# commit
RP/0/RP0/CPU0:router(config)# policy-map pm2
RP/0/RP0/CPU0:router(config-pmap)# class p2
RP/0/RP0/CPU0:router(config-pmap-c)# set precedence 3
RP/0/RP0/CPU0:router(config-pmap-c)# end-policy-map
RP/0/RP0/CPU0:router(config)# commit
RP/0/RP0/CPU0:router(config)# end
RP/0/RP0/CPU0:router# show run policy-map pm2
policy-map pm2
class p2
set precedence 3
!
class class-default
!
end-policy-map
!
Task ID
Task ID |
Operations |
---|---|
qos |
read, write |
Examples
RP/0/RP0/CPU0:router(config)# class-map class1
RP/0/RP0/CPU0:router(config-cmap)# match precedence 3
RP/0/RP0/CPU0:router(config-cmap)# exit
RP/0/RP0/CPU0:router(config)# policy-map policy1
RP/0/RP0/CPU0:router(config-pmap)# class class1
RP/0/RP0/CPU0:routerconfig-pmap-c)# shape average percent 30
RP/0/RP0/CPU0:router(config-pmap-c)# exit
RP/0/RP0/CPU0:router(config-pmap)# class class-default
RP/0/RP0/CPU0:router(config-pmap-c)# shape average percent 20
The default class is used for packets that do not satisfy configured match criteria for class1. Class1 must be defined before it can be used in policy1, but the default class can be directly used in a policy map, as the system defines it implicitly.