Policy maps prioritize network traffic by class. You create policy maps to define how to treat each class of traffic so that it is prioritized 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, which is 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 1. Packet Fields Available for Marking
Marking is the setting of QoS information that is related to a packet. You can set the value of standardt 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 that you keep the policy simple by using no more than four classes.
Criteria for Marking Fields
Fields that are available for marking are listed in the following table:
Field
Description
DSCP
Layer 3 differentiated services code point (DSCP).
Note
f 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.
For a single class, you can set operations on any two out of the following five fields: CoS, IP Precedence, DSCP, QoS Group, and Discard Class. Unless noted as a restriction, you can mark both incoming and outgoing packets.
You are already logged in to the CLI in EXEC mode.
Guidelines and Limitations
The set cos command is applicable only to 802.1Q interfaces. So, although you can use the set cos command on an ingress interface, the setting is only applied if a packet eventually egresses an 802.1Q compliant interface.
For a single class, you can set operations on any two out of the following five fields: CoS, IP Precedence, DSCP, QoS Group, and Discard Class.
You can only use the set qos-group command in ingress policies.
You can only use the set discard-class command in ingress policies.
When designing your QoS and access control list (ACL) policies, note that ACLs referenced within a QoS policy are processed as follows as part of the QoS policy:
Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.
The policy_map_name argument is an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-pmap)# class [type qos] {class_map_name |class-default}
Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.
Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.
Step 4
switch (config-pmap-c-qos)# set dscpvalue
Define the DSCP value that should be used in all IP headers for the specified class and saves it in the running configuration.
Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.
The policy_map_name argument is an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-pmap-qos)# class [type qos] {class_map_name |class-default}
Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.
Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.
Step 4
switch (config-pmap-c-qos)#set precedencevalue
Adds the precedence 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 0 to 7 as shown in the following table:
Value
Description
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
Step 5
switch(config-pmap-c-qos)# show policy-mappolicy-map-name
Displays the policy map configuration for the specified map name.
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.
This example shows how to create an IP precedence policy:
switch# config terminal
switch(config)# policy-map policy1
switch(config-pmap)# class class1
switch(config-pmap-c-qos)# set precedence 3
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)# copy running-config startup-config
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. If you mark this field in an ingress or egress policy, it will only be set when a packet egresses an IEEE 802.1Q-capable interface.
Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.
The policy_map_name argument is an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-pmap-qos)# class [type qos] {class_map_name | class-default}
Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.
Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.
Step 4
switch (config-pmap-c-qos)# set coscos-value
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
switch(config-pmap-c-qos)# show policy-mappolicy-map-name
Displays the policy map configuration for the specified map name.
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.
This example shows how to create a class of service policy:
This example shows how to create a class of service policy.
switch# config terminal
switch(config)# policy-map policy1
switch(config-pmap-qos)# class class1
switch(config-pmap-c-qos)# set cos 3
switch(config-pmap-c-qos)# show policy-map policy1
Type qos policy-maps
====================
policy-map type qos policy1
class class1
set dscp 26
set cos 3
class class2
set dscp 14
class class-default
set dscp 20
police cir 256000 bps bc 300 ms pir 256000 bps be 300 ms conform transmit exceed set dscp dscp table cir-mar kdown-map violate drop
Creating a QoS Group Policy
Before You Begin
You are logged in to the CLI in EXEC mode.
You can mark the QoS group value only in ingress policies.
Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.
The policy_map_name argument is an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-pmap-qos)# class [type qos] {class_map_name | class-default}
Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.
Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.
Step 4
switch (config-pmap-c-qos)# set qos-groupqos-group-value
Sets the QoS group value to qos-group-value. The value can range from 0 to 126.
Step 5
switch(config-pmap-c-qos)# show policy-mappolicy-map-name
Displays the policy map configuration for the specified map name.
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.
This example shows how to create a QoS group policy:
switch# config terminal
switch(config)# policy-map policy1
switch(config-pmap-qos)# class class1
switch(config-pmap-c-qos)# set qos-group 100
switch(config-pmap-c-qos)# show policy-map policy1
switch(config-pmap-c-qos)# copy running-config startup-config
Creating a Discard Class Policy
You can 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 Configuring Discard Class Classification.
Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.
The policy_map_name argument is an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-pmap-qos)# class [type qos] {class_map_name |class-default}
Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.
Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.
Step 4
switch (config-pmap-c-qos)# set discard-classdiscard-class-value
Sets the discard-class value to discard-class-value. The value ranges from 0 to 63.
Step 5
switch(config-pmap-c-qos)# show policy-mappolicy-map-name
Displays the policy map configuration for the specified map name.
Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.
The policy_map_name argument is an alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters.
Step 3
switch(config-pmap)# class [type qos] {class_map_name |class-default}
Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.
Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.
Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.
This example shows how to mark the DSCP port for each class of traffic defined in an ingress policy map on an Ethernet interface:
switch# config terminal
switch(config)# policy-map policy1
switch(config-pmap-qos)# class class1
switch(config-pmap-c-qos)# set dscp af31
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# exit
switch(config)# interface ethernet 1/1
switch(config-if)#service-policy input policy1
switch(config-if)# show policy-map policy1
Type qos policy-maps
====================
policy-map type qos policy1
class class1
set dscp af31
class class2
set dscp af13
class class-default
set dscp af22
switch(config-if)# copy running-config startup-config
This example shows how to mark the DSCP port for each class of traffic defined in an ingress policy map on an Ethernet interface:
switch# config terminal
switch(config)# policy-map policy1
switch(config-pmap)# class class1
switch(config-pmap-c-qos)# set dscp af31
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# class class2
switch(config-pmap-c-qos)# set dscp af13
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# class class-default
switch(config-pmap-c-qos)# set dscp af22
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# exit
switch(config)# interface ethernet 1/1
switch(config-if)# service-policy input policy1
switch(config-if)# show policy-map policy1
Type qos policy-maps
====================
policy-map type qos policy1
class class1
set dscp af31
class class2
set dscp af13
class class-default
set dscp af22
switch(config-if)# copy running-config startup-config
This example shows how to mark the DSCP port for each class of traffic defined in an ingress policy map on a port profile:
switch(config)# config terminal
switch(config)# policy-map policy1
switch(config-pmap-qos)# class class1
switch(config-pmap-c-qos)# set dscp af31
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# class class2
switch(config-pmap-c-qos)# set dscp af13
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# class class-default
switch(config-pmap-c-qos)# set dscp af22
switch(config-pmap-c-qos)# exit
switch(config-pmap-qos)# exit
switch(config)# port-profile accessprofile
switch(config-port-prof)# service-policy input policy1
switch(config-port-prof)# show policy-map policy1
Type qos policy-maps
====================
policy-map type qos policy1
class class1
set dscp af31
class class2
set dscp af13
class class-default
set dscp af22
switch(config-if)# copy running-config startup-config
Verifying the QoS Policy Configuration
Use one of the following commands to verify the configuration:
Command
Description
show policy-map [type qos] [namepolicy_map_name]
Displays the policy map configuration.
show table-mapname
Displays the table map configuration.
Configuration Example for QoS Marking Policies
This example shows how to display a specific policy-map policy:
switch(config)# show policy-map policy-ipacl
Type qos policy-maps
====================
policy-map type qos policy-ipacl
class class-ipacl
set dscp 10
This example shows how to display policy maps for all interfaces:
switch# show policy-map interface brief
Interface/VLAN [Status]:INP QOS OUT QOS INP QUE OUT QUE
================================================================================
Vethernet1 [Active]: media
Vethernet10 [Active]: media
Vethernet13 [Active]:web_policer
Vethernet15 [Active]:iperf
Vethernet16 [Active]: iperf_policer
Vethernet17 [Active]:ixia_in ixia_out
Vethernet18 [Active]: media
Vethernet19 [Active]:iperf
Vethernet20 [Active]: iperf_policer
Vethernet21 [Active]:netperf_polic
================================================================================