Information About Policy Maps
Policy maps prioritize network traffic by class. You create policy maps to define how to treat each class of traffic so that it is prioritizes for the best quality of service.
Marking is the process of marking packets, that is changing one of the following in the packet for QoS purposes:
- Differentiated services code point (DSCP)
- Precedence
- CoS
You can map a traffic class to a DSCP, an indicator of the service level for a specified frame. The DSCP value ranges from 0 to 63, and the default is 0. A DSCP value of 46 is disallowed.
Service policies are specified using policy maps. Policy maps provide an ordered mapping of class maps to service levels. You can specify multiple class maps within a policy map, and map a class map to a high, medium, or low service level. The default priority is low. The policy map name is restricted to 63 alphanumeric characters.
The order of the class maps within a policy map is important to determine the order in which the frame is compared to class maps. The first matching class map has the corresponding priority marked in the frame.
Figure 3-1 Packet fields that can be marked
Marking is the setting of QoS information that is related to a packet. You can set the value of standard QoS fields IP precedence, DSCP and Class of Service (CoS), and internal labels that can be used in subsequent actions such as policing.
Once your traffic classes are defined, you can reference them in the policy map where you also define how they should be marked. We recommend keeping the policy simple by using no more than four classes.
The fields available for marking are listed in Table 3-1 .
Table 3-1 Fields That Can be Marked
|
|
DSCP |
Layer 3 Differentiated Service Code Point (DSCP). Note If you mark DSCP, you cannot mark Discard Class. |
IP precedence |
Layer 3 IP precedence. Note IP precedence uses only the lower 3 bits of the Type of Service (TOS) field. The device overwrites the first 3 bits of the TOS field to 0. |
CoS |
Layer 2 Class of Service (CoS). |
QoS group |
Local QoS values that can be marked and matched as needed. The range is from 0 to 126. |
Discard class |
Local QoS values that can be matched and marked as needed. The range is from 0 to 63. Note If you mark Discard Class, you cannot mark DSCP. |
Ingress and egress ports |
The marking applies to incoming or outgoing packets. |
Unless noted as a restriction, you can mark both incoming and outgoing packets.
Creating QoS Policies
This section includes the following topics:
Creating a DSCP Policy
Use this procedure to create a policy that marks the DSCP value in the IP header packet to prioritize traffic in a particular class.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
SUMMARY STEPS
1. config t
2. policy-map [ type qos ] [ match-first ] policy-map-name
3. class [ type qos ] { class_map_name | class-default }
4. set dscp value
5. show policy-map policy-map-name
6. copy running-config startup-config
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
policy-map [ type qos ] [ match-first ] policy-map-name Example: switch(config)# policy-map policy1 switch(config-pmap-qos)# |
Places you into Policy Map QoS Configuration mode for the specified policy map and configures the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap)# class class1 switch(config-pmap-c-qos)# |
In Policy Map QoS Configuration mode for the specified policy map, the named class map is referenced. You are then placed into Policy Map Class QoS Configuration mode for the specified class map. Changes are saved in the running configuration.
- The default is to reference a new class map at the end of the policy map.
- class-default : Selects all traffic not currently matched by classes in the policy map.
|
Step 4 |
set dscp value Example: switch(config-pmap-c-qos)# set dscp af31 switch(config-pmap-c-qos)# |
In Policy Map Class QoS Configuration mode, defines the DSCP value that should be used in all IP headers for the specified class and saves it in the running configuration. You can use a numeric value from 1 to 60, or one of the standard values from the “DSCP and Precedence Values” section. In this example, the standard value of af31 is used. |
Step 5 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 6 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Creating an IP Precedence Policy
You can mark IP Precedence to give priority to all packets in a particular traffic class.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
- You are logged in to the CLI in EXEC mode.
- Table 3-2 lists the RFC 791 precedence values from least to most important.
Table 3-2 Precedence Values
|
|
000 (0) |
Routine or Best Effort |
001 (1) |
Priority |
010 (2) |
Immediate |
011 (3) |
Flash - mainly used for Voice Signaling or for Video. |
100 (4) |
Flash Override |
101 (5) |
Critical -mainly used for Voice RTP. |
110 (6) |
Internet |
111 (7) |
Network |
SUMMARY STEPS
1. config t
2. policy-map [ type qos ] [ match-first ] policy-map-name
3. class [ type qos ] { class_map_name | class-default }
4. set precedence value
5. show policy-map policy-map-name
6. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
policy-map [ type qos ] [ match-first ] policy-map-name Example: switch(config)# policy-map policy1 switch(config-pmap-qos)# |
Places you into Policy Map QoS Configuration mode for the specified policy map and configures the map name in the running configuration. Allowable characters: Up to 40 (alphabetic, hyphen, or underscore). Characters, are case sensitive. |
Step 3 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap-qos)# class class1 switch(config-pmap-c-qos)# |
In Policy Map QoS Configuration mode for the specified policy map, the named class map is referenced. You are then placed into Policy Map Class QoS Configuration mode for the specified class map. Changes are saved in the running configuration.
- The default is to add the new class map to the end of the policy map.
- class-default : Selects all traffic not currently matched by classes in the policy map.
|
Step 4 |
set precedence value Example: switch(config-pmap-c-qos)# set precedence 3 switch(config-pmap-c-qos)# |
In Policy Map Class QoS Configuration mode, adds the precedence value that should be used in all packets for the specified traffic class. The change is saved in the running configuration. You can use a numeric value from 0 to 7, as show in Table 3-2 . |
Step 5 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 6 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Creating a Class of Service Policy
You can mark the CoS field in the IEEE 802.1Q header for all traffic in a specific class.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
- You are logged in to the CLI in EXEC mode.
- You can set CoS in ingress and egress policies.
SUMMARY STEPS
1. config t
2. policy-map [ type qos ] [ match-first ] policy-map-name
3. class [ type qos ] { class_map_name | class-default }
4. set cos cos-value
5. show policy-map policy-map-name
6. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
policy-map [ type qos ] [ match-first ] policy-map-name Example: switch(config)# policy-map policy1 switch(config-pmap-qos)# |
Places you into Policy Map QoS Configuration mode for the specified policy map and configures the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap-qos)# class class1 switch(config-pmap-c-qos)# |
Places you into Policy Map Class QoS Configuration mode for the specified policy map. A reference is also created to the specified class map. Changes are saved in the running configuration.
- The default is to add the class map to the end of the map.
- class-default : Selects all traffic not currently matched by classes in the policy map.
|
Step 4 |
set cos cos-value Example: switch(config-pmap-c-qos)# set cos 3 switch(config-pmap-c-qos)# |
Sets the CoS value to cos-value. The value can range from 0 to 7. You can use this command only in egress policies. |
Step 5 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 6 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Creating a QoS Group Policy
You can mark the locally-defined QoS group value.
BEFORE YOU BEGIN
Before beginning this procedure, you must know or do the following:
- You can mark the QoS group value only in ingress policies.
- You are logged in to the CLI in EXEC mode.
SUMMARY STEPS
1. config t
2. policy-map [ type qos ] [ match-first ] policy-map-name
3. class [ type qos ] { class_map_name | class-default }
4. set qos-group qos-group-value
5. show policy-map policy-map-name
6. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
policy-map [ type qos ] [ match-first ] policy-map-name Example: switch(config)# policy-map policy1 switch(config-pmap-qos)# |
Places you into Policy Map QoS Configuration mode for the specified policy map and configures the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap-qos)# class class1 switch(config-pmap-c-qos)# |
Places you into Policy Map Class QoS Configuration mode for the specified policy map. A reference is also created to the specified class map. Changes are saved in the running configuration.
- The default is to add the class map to the end of the map.
- class-default : Selects all traffic not currently matched by classes in the policy map.
|
Step 4 |
set qos-group qos-group-value Example: switch(config-pmap-c-qos)# set qos-group 100 switch(config-pmap-c-qos)# |
Sets the QoS group value to qos-group-value. The value can range from 0 to 126. |
Step 5 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 6 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Creating a Discard Class Policy
Use this procedure to set a local internal label discard class policy.
BEFORE YOU BEGIN
- If you configure a local internal label discard class policy, you cannot create a DSCP policy
For more information about DSCP policies, see the Creating a DSCP Policy.
- You can set a discard class only in ingress policies.
- To reference the local discard class in a policy or in traffic classification use the match discard-class command.
For more information, see the Configuring Discard Class Classification.
SUMMARY STEPS
1. config t
2. policy-map [ type qos ] [ match-first ] policy-map-name
3. class [ type qos ] { class_map_name | class-default }
4. set discard-class discard-class-value
5. show policy-map policy-map-name
6. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
policy-map [ type qos ] [ match-first ] policy-map-name Example: switch(config)# policy-map policy1 switch(config-pmap-qos)# |
Places you into Policy Map QoS Configuration mode for the specified policy map and configures the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap-qos)# class class1 switch(config-pmap-c-qos)# |
Places you into Policy Map Class QoS Configuration mode for the specified policy map. A reference is also created to the specified class map. Changes are saved in the running configuration.
- The default is to add the class map to the end of the map.
- class-default : Selects all traffic not currently matched by classes in the policy map.
|
Step 4 |
set discard-class discard-class-value Example: switch(config-pmap-c-qos)# set discard-class 40 switch(config-pmap-c-qos)# |
Sets the discard class value to discard-class-value. The value can range from 0 to 63. |
Step 5 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 6 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Creating Ingress and Egress Policies
Use this procedure to attach a policy map to an interface or a port profile so that the marking instructions are applied to the ingress or egress packets.
BEFORE YOU BEGIN
- You already know the policy map and interface or port profile you want to use.
- The policy map you want to use is already defined.
Note You can attach only one input policy and one output policy to an interface or port profile.
SUMMARY STEPS
1. config t
2. {[interface type number ] port-profile name ]}
3. service-policy [ type qos ] { input | output } policy-map-name [ no-stats ]
4. show policy-map policy_map_name
5. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
{[interface type number | port-profile name ]} |
Places you into Configuration mode for the specified Ethernet or Vethernet interface or port profile. |
Example: switch(config)# interface ethernet 1/1 switch(config-if)# |
This example shows an Ethernet interface configuration. |
Example: switch(config)# port-profile accessprofile switch(config-port-prof)# |
This example shows a port profile configuration. |
Step 3 |
service-policy [type qos] {input | output} policy-map-name [no-stats] |
(Optional) Attaches a policy map name that will be added to the input or output packets of the interface or port profile. Note You can attach only one input policy and one output policy to an interface or port profile. |
|
Example: switch(config-if)# service-policy input policy1 switch(config-if)# |
This example shows an Ethernet interface configuration. |
|
Example: switch(config-port-prof)# service-policy input policy1 switch(config-port-prof)# |
This example shows a port profile configuration. |
Step 4 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 5 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |
Marking the Port DSCP
Use this procedure to mark the DSCP port for each class of traffic defined in a specified ingress or egress policy map.
BEFORE YOU BEGIN
- The default behavior is to preserve the DSCP value, or to trust DSCP. To make the port untrusted, change the DSCP value.
- Unless you configure a QoS policy and attach that policy to specified interfaces, the DSCP value is preserved.
Note You can attach only one input policy and one output policy to an interface or port profile.
SUMMARY STEPS
1. config t
2. policy-map [ type qos ] [ match-first ] policy-map-name
3. class [ type qos ] { class_map_name | class-default }
4. set dscp -value
5. exit
6. class [ type qos ] { class_map_name | class-default }
7. set dscp -value
8. exit
9. class [ type qos ] { class_map_name | class-default }
10. set dscp -value
11. exit
12. exit
13. {[interface type number ] port-profile name ]}
14. service-policy [ type qos ] { input | output } policy-map-name [ no-stats ]
15. show policy-map policy_map_name
16. copy running-config startup-config
DETAILED STEPS
|
|
|
Step 1 |
config t Example: switch# config t switch(config)# |
Places you into CLI Global Configuration mode. |
Step 2 |
policy-map [ type qos ] [ match-first ] policy-map-name Example: switch(config)# policy-map policy1 switch(config-pmap-qos)# |
Places you into Policy Map QoS Configuration mode for the specified policy map and configures the map name in the running configuration. Allowable characters: Up to 40 alphabetic, hyphen, or underscore. Characters, are case sensitive. |
Step 3 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap)# class class1 switch(config-pmap-c-qos)# |
Places you into Policy Map Class QoS Configuration mode for the specified policy map. A reference is also created to the specified class map which is saved in the running configuration.
- The default is to add the class map to the end of the map.
- class-default : Selects all traffic not currently matched by classes in the policy map.
|
Step 4 |
set dscp -value Example: switch(config-pmap-c-qos)# set dscp af31 switch(config-pmap-c-qos)# |
Sets a DSCP value. Valid values are shown in the “DSCP and Precedence Values” section. |
Step 5 |
exit Example: switch(config-pmap-c-qos)# exit switch(config-pmap-qos)# |
Returns you to Policy Map Configuration mode. |
Step 6 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap-qos)# class class2 switch(config-pmap-c-qos)# |
- In the policy map, creates a reference to the specified class map name, and then places you into Policy-map Class Configuration mode.
- Adds the class to the end of the policy map.
- Specify class-default to select all traffic not currently matched by classes in the policy map.
|
Step 7 |
set dscp -value Example: switch(config-pmap-c-qos)# set dscp af13 switch(config-pmap-c-qos)# |
Sets the DSCP value to dscp-value. Valid values are shown in the “DSCP and Precedence Values” section. |
Step 8 |
exit Example: switch(config-pmap-c-qos)# exit switch(config-pmap-qos)# |
Returns to Policy Map Configuration mode. |
Step 9 |
class [ type qos ] { class_map_name | class-default } Example: switch(config-pmap-qos)# class class-default switch(config-pmap-c-qos)# |
- Creates a reference to the specified class map.
- Places you into Policy Map Class Configuration mode.
- Adds the class to the end of the policy map.
- Specify class-default to select all traffic not currently matched by classes in policy map.
|
Step 10 |
set dscp -value Example: switch(config-pmap-c-qos)# set dscp af22 switch(config-pmap-c-qos)# |
Sets the DSCP value to dscp-value. Valid values are shown in the “DSCP and Precedence Values” section. |
Step 11 |
exit Example: switch(config-pmap-c-qos)# exit switch(config-pmap-qos)# |
Returns you to Policy Map Configuration mode. |
Step 12 |
exit Example: switch(config-pmap)# exit switch(config)# |
Returns you to Global Configuration mode. |
Step 13 |
{[interface type number | port-profile name ]} |
Places you into Configuration mode for the specified Ethernet or Vethernet interface or port profile. |
Example: switch(config)# interface ethernet 1/1 switch(config-if)# |
This example shows an Ethernet interface configuration. |
Example: switch(config)# port-profile accessprofile switch(config-port-prof)# |
This example shows a port profile configuration. |
Step 14 |
service-policy [type qos] {input | output} policy-map-name [no-stats] |
(Optional) Attaches a policy map name that will be added to the input or output packets of the interface or port profile. Note You can attach only one input policy and one output policy to an interface or port profile. |
|
Example: switch(config-if)# service-policy input policy1 switch(config-if)# |
This example shows an Ethernet interface configuration. |
|
Example: switch(config-port-prof)# service-policy input policy1 switch(config-port-prof)# |
This example shows a port profile configuration. |
Step 15 |
show policy-map policy_map_name
Example:
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)#
|
Displays the policy map configuration for the specified map name. |
Step 16 |
copy running-config startup-config Example:
switch(config-pmap-c-qos)# copy running-config startup-config
[######################################] 100%
switch(config-pmap-c-qos)#
|
(Optional) Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration. |