QoS CLI
QoS CLI
QoS CLI
This section contains the tasks for configuring QoS functionality using the Modular Quality of Service (QoS) Command-Line Interface (CLI) (MQC). For complete conceptual information, see the chapter Modular Quality of Service Command-Line Interface Overview in this book. For a complete description of the QoS commands in this chapter, refer to the Cisco IOS Quality of Service Solutions Command Reference, Release 12.4T. To locate documentation of other commands that appear in this chapter, use the command reference master index or search online. To identify the hardware platform or software image information associated with a feature, use the Feature Navigator on Cisco.com to search for information about the feature or refer to the software release notes for a specific release. For more information, see the Identifying Supported Platforms section in the Using Cisco IOS Software chapter in this book.
Creating a Traffic Class (Required) Creating a Traffic Policy (Required) Attaching a Traffic Policy to an Interface (Required) Verifying the Traffic Class and Traffic Policy Information (Optional)
See the end of this chapter for the section Modular QoS CLI Configuration Examples.
QC-405
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Task List
The match-all and match-any keywords need to be specified only if more than one match criterion is configured in the traffic class. The match-all keyword is used when all of the match criteria in the traffic class must be met in order for a packet to be placed in the specified traffic class. The match-any keyword is used when only one of the match criterion in the traffic class must be met in order for a packet to be placed in the specified traffic class. If neither the match-all nor match-any keyword is specified, the traffic class will behave in a manner consistent with match-all keyword.
About The match not Command
The match not command, rather than identifying the specific match parameter to use as a match criterion, is used to specify a match criterion that prevents a packet from being classified as a member of the class. For instance, if the match not qos-group 6 command is issued while you configure the traffic class, QoS group 6 becomes the only QoS group value that is not considered a successful match criterion. All other QoS group values would be successful match criteria.
Procedure
To create a traffic class containing match criteria, use the class-map command to specify the traffic class name. Then use one or more match commands to specify the appropriate match criteria. Packets matching the criteria you specify are placed in the traffic class.
Note
In the following steps, a number of match commands are listed. The specific match commands available vary by platform and Cisco IOS release. For the match commands available, see the Cisco IOS command reference for the platform and Cisco IOS release you are using.
Command or Action
Step 1 Step 2 Step 3
Router> enable Router# configure terminal Router(config)# class-map [match-all | match-any] class-name
Purpose Enables privileged EXEC mode. Enters global configuration mode. Creates a class to be used with a class map, and enters class-map configuration mode. The class map is used for matching packets to the specified class.
Note
The match-all keyword specifies that all match criteria must be met. The match-any keyword specifies that one of the match criterion must be met.
(Optional) Configures the match criteria for a class map on the basis of the specified access control list (ACL).
Note
Access lists configured with the optional log keyword of the access-list command are not supported when configuring a traffic class. For more information about the access-list command, see the Cisco IOS IP Application Services Command Reference, Release 12.4 T.
QC-406
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Task List
Command or Action
Step 5 Step 6
Router(config-cmap)# match any
Purpose (Optional) Configures the match criteria for a class map to be successful match criteria for all packets. (Optional) Specifies the name of a traffic class to be used as a matching criterion (for nesting traffic class [nested class maps] within one another). (Optional) Matches a packet based on a Layer 2 class of service (CoS) marking. (Optional) Uses the destination Media Access Control (MAC) address as a match criterion. (Optional) Matches packets of a certain discard class. (Optional) Identifies a specific IP differentiated service code point (DSCP) value as a match criterion. Up to eight DSCP values can be included in one match statement. (Optional) Configures the match criteria for a class map on the basis of the fields defined in the protocol header description files (PHDFs). (Optional) Specifies the Frame Relay data-link connection identifier (DLCI) number as a match criterion in a class map. (Optional) Configures a class map to use the specified input interface as a match criterion. (Optional) Configures a class map to use the Real-Time Protocol (RTP) protocol port as the match criterion. (Optional) Configure a class map to use the specified value of the Multiprotocol Label Switching (MPLS) experimental (EXP) field as a match criterion. (Optional) Matches the MPLS EXP value in the topmost label. (Optional) Specifies the single match criterion value to use as an unsuccessful match criterion. (Optional) Specifies the Layer 3 packet length in the IP header as a match criterion in a class map.
Router(config-cmap)# match cos cos-number Router(config-cmap)# match destination-address mac address Router(config-cmap)# match discard-class class-number Router(config-cmap)# match [ip] dscp dscp-value [dscp-value dscp-value dscp-value dscp-value dscp-value dscp-value dscp-value] Router(config-cmap)# match field protocol protocol-field {eq [mask] | neq [mask] | gt | lt | range range | regex string} value [next next-protocol] Router(config-cmap)# match fr-dlci dlci-number Router(config-cmap)# match input-interface interface-name Router(config-cmap)# match ip rtp starting-port-number port-range Router(config-cmap)# match mpls experimental mpls-values
Step 11
Router(config-cmap)# match mpls experimental topmost values Router(config-cmap)# match not match-criteria Router(config-cmap)# match packet length {max maximum-length-value [min minimum-length-value] | min minimum-length-value [max maximum-length-value]} Router(config-cmap)# match port-type {routed | switched} Router(config-cmap)# match [ip] precedence precedence-value [precedence-value precedence-value precedence-value]
Step 19 Step 20
(Optional) Matches traffic on the basis of the port type for a class map. (Optional) Identifies IP precedence values as match criteria.
QC-407
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Task List
Command or Action
Step 21
Router(config-cmap)# match protocol protocol-name
Purpose (Optional) Configures the match criteria for a class map on the basis of the specified protocol.
Note
There is a separate match protocol (NBAR) command used to configure network-based application recognition (NBAR) to match traffic by a protocol type known to NBAR.
Step 22
Router(config-cmap)# match protocol citrix [app application-name-string] [ica-tag ica-tag-value] Router(config-cmap)# match protocol fasttrack file-transfer "regular-expression" Router(config-cmap)# match protocol gnutella file-transfer "regular-expression" Router(config-cmap)# match protocol http [url url-string | host hostname-string | mime MIME-type | c-header-field c-header-field-string | s-header-field s-header-field-string] Router(config-cmap)# match protocol rtp [audio | video | payload-type payload-string] Router(config-cmap)# match qos-group qos-group-value Router(config-cmap)# match source-address mac address-destination Router(config-cmap)# match start {l2-start | l3-start} offset number size number {eq | neq | gt | lt | range range | regex string} {value [value2] | [string]} Router(config-cmap)# match tag {tag-name} Route(config-cmap)# exit
Step 23
(Optional) Configures NBAR to match FastTrack peer-to-peer traffic. (Optional) Configures NBAR to match Gnutella peer-to-peer traffic.
Step 24
Step 25
(Optional) Configures NBAR to match Hypertext Transfer Protocol (HTTP) traffic by URL, host, Multipurpose Internet Mail Extension (MIME) type, or fields in HTTP packet headers. (Optional) Configures NBAR to match Real-Time Transfer Protocol (RTP) traffic. (Optional) Identifies a specific QoS group value as a match criterion. (Optional) Uses the source MAC address as a match criterion. (Optional) Configures the match criteria for a class map on the basis of the datagram header (Layer 2) or the network header (Layer 3).
Step 26
Step 30 Step 31
(Optional) Specifies tag type as a match criterion. (Optional) Exits class-map configuration mode.
After using the policy-map command, use the class command to associate the traffic class (created in the Creating a Traffic Class section on page 405) with the traffic policy. The syntax of the class command is as follows: class class-name no class class-name
QC-408
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Task List
For the class-name argument, use the name of the class you created when you used the class-map command to create the traffic class (Step 3 of the Creating a Traffic Class section on page 405). After entering the class command, you are automatically in policy-map class configuration mode. The policy-map class configuration mode is the mode used for enabling the specific QoS features.
Procedure
To create a traffic policy (or policy map) and enable one or more QoS features, perform the following steps.
Note
This procedure lists many of the commands you can use to enable one or more QoS features. For example, to enable Class-Based Weighted Fair Queuing (CBWFQ), you would use the bandwidth command. Not all QoS features are available on all platforms or in all Cisco IOS releases. For the features and commands available to you, see the Cisco IOS documentation for your platform and version of Cisco IOS software you are using.
Command
Step 1 Step 2 Step 3 Step 4
Router> enable Router# configure terminal Router(config)# policy-map policy-name
Purpose Enables privileged EXEC mode. Enters global configuration mode. Creates or specifies the name of the traffic policy and enters policy-map configuration mode. Specifies the name of a traffic class (previously created in the Creating a Traffic Class section on page 405) and enters policy-map class configuration mode. (Optional) Specifies a minimum bandwidth guarantee to a traffic class in periods of congestion. A minimum bandwidth guarantee can be specified in kbps or by a percentage of the overall available bandwidth. (Optional) Specifies the number of queues to be reserved for a traffic class. (Optional) Configures traffic policing.
Use one or more of the following commands to enable the specific QoS feature you want to use.
Step 5
Router(config-pmap-c)# bandwidth {bandwidth-kbps | percent percent}
Step 6 Step 7
Router(config-pmap-c)# fair-queue number-of-queues Router (config-pmap-c)# police bps [burst-normal] [burst-max] conform-action action exceed-action action [violate-action action] Router(config-pmap-c)# priority {bandwidth-kbps | percent percentage} [burst] Router(config-pmap-c)# queue-limit number-of-packets Router(config-pmap-c)# random-detect [dscp-based | prec-based] Router(config-pmap-c)# set atm-clp
Step 8
(Optional) Gives priority to a class of traffic belonging to a policy map. (Optional) Specifies or modifies the maximum number of packets the queue can hold for a class configured in a policy map. (Optional) Enables Weighted Random Early Detection (WRED) or distributed WRED (DWRED). (Optional) Sets the cell loss priority (CLP) bit when a policy map is configured.
QC-409
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Task List
Command
Step 12
Router(config-pmap-c)# set cos {cos-value | from-field [table table-map-name]} Router(config-pmap-c)# set discard-class value Router(config-pmap-c)# set [ip] dscp {dscp-value | from-field [table table-map-name]} Router(config-pmap-c)# set fr-de
Purpose (Optional) Sets the Layer 2 class of service (CoS) value of an outgoing packet. (Optional) Marks a packet with a discard-class value. (Optional) Marks a packet by setting the differentiated services code point (DSCP) value in the type of service (ToS) byte. (Optional) Changes the discard eligible (DE) bit setting in the address field of a Frame Relay frame to 1 for all traffic leaving an interface. (Optional) Sets the precedence value in the packet header.
Step 13 Step 14
Step 15
Step 16
Router(config-pmap-c)# set precedence {precedence-value | from-field [table table-map-name]} Route(config-pmap-c)# set mpls experimental value Router (config-pmap-c)# set qos-group {group-id | from-field [table table-map-name]} Router(config-pmap-c)# service-policy policy-map-name
Step 17 Step 18
(Optional) Designates the value to which the MPLS bits are set if the packets match the specified policy map. (Optional) Sets a QoS group identifier (ID) that can be used later to classify packets. (Optional) Specifies the name of a traffic policy used as a matching criterion (for nesting traffic policies [hierarchical traffic policies] within one another). (Optional) Shapes traffic to the indicated bit rate according to the algorithm specified. (Optional) Exits policy-map class configuration mode.
Step 19
Step 20
Step 21
Procedure
To attach a traffic policy to an interface, perform the following steps.
Note
Depending on the platform and Cisco IOS release you are using, a traffic policy can be attached to an ATM permanent virtual circuit (PVC) subinterface, a Frame Relay data-link connection identifier (DLCI), or another type of interface.
QC-410
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Examples
Command
Step 1 Step 2 Step 3 Step 4
Router> enable Router# configure terminal Router(config)# interface serial0
Purpose Enables privileged EXEC mode. Enters global configuration mode. Configures an interface type and enters interface configuration mode. Attaches a policy map to an interface.
Router(config-if)# service-policy output [type access-control] {input | output} policy-map-name Router (config-if)# exit
Step 5
Note
Multiple traffic policies on tunnel interfaces and physical interfaces are not supported if the interfaces are associated with each other. For instance, if a traffic policy is attached to a tunnel interface while another traffic policy is attached to a physical interface with which the tunnel interface is associated, only the traffic policy on the tunnel interface works properly.
Purpose Enables privileged EXEC mode. (Optional) Displays all class maps and their matching criteria. (Optional) Displays the configuration for the specified class of the specified policy map. (Optional) Displays the configuration of all classes for a specified policy map or all classes for all existing policy maps. (Optional) Displays the packet statistics of all classes that are configured for all service policies either on the specified interface or subinterface or on a specific permanent virtual circuit (PVC) on the interface. (Optional) Exits privileged EXEC mode.
Router# show policy-map interface [type access-control] type number [vc [vpi/] vci] [dlci dlci] [input | output]
Step 6
Router# exit
Traffic Classes Defined Example Traffic Policy Created Example Traffic Policy Attached to an Interface Example match not Command Example
QC-411
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Examples
Default Traffic Class Configuration Example class-map match-any and class-map match-all Commands Example Traffic Class as a Match Criterion (Nested Class Maps) Example Traffic Policy as a QoS Policy (Hierarchical Traffic Policies) Example
For information on how to configure the QoS functionality with the Modular QoS CLI, see the section Modular QoS CLI Configuration Task List in this chapter.
QC-412
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Examples
QC-413
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Examples
For moredetailed information on the preceding commands, refer to the Cisco IOS Quality of Service Solutions Command Reference, Release 12.4T.
If a packet arrives on a router with traffic class called cisco1 configured on the interface, the packet is evaluated to determine if it matches the IP protocol, QoS group 4, and access group 101. If all three of these match criteria are met, the packet matches traffic class cisco1. The following example shows a traffic class configured with the class-map match-any command:
Router(config)# class-map match-any cisco2 Router(config-cmap)# match protocol ip Router(config-cmap)# match qos-group 4 Router(config-cmap)# match access-group 101
In traffic class called cisco2, the match criteria are evaluated consecutively until a successful match criterion is located. The packet is first evaluated to the determine whether IP protocol can be used as a match criterion. If IP protocol can be used as a match criterion, the packet is matched to traffic class cisco2. If IP protocol is not a successful match criterion, then QoS group 4 is evaluated as a match criterion. Each criterion is evaluated to see if the packet matches that criterion. Once a successful match occurs, the packet is classified as a member of traffic class cisco2. If the packet matches none of the specified criteria, the packet is classified as a member of the traffic class. Note that the class-map match-all command requires that all of the match criteria must be met in order for the packet to be considered a member of the specified traffic class (a logical AND operator). In the example, protocol IP AND QoS group 4 AND access group 101 have to be successful match criteria. However, only one match criterion must be met for the packet in the class-map match-any command to be classified as a member of the traffic class (a logical OR operator). In the example, protocol IP OR QoS group 4 OR access group 101 have to be successful match criterion.
QC-414
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Examples
Here is a possible scenario: Suppose A, B, C, and D were all separate match criterion, and you wanted traffic matching A, B, or C and D (A or B or [C and D]) to be classified as belonging to the traffic class. Without the nested traffic class, traffic would either have to match all 4 of the match criterion (A and B and C and D) or match any of the match criterion (A or B or C or D) to be considered part of the traffic class. You would not be able to combine and (match-all) and or (match-any) statements within the traffic class, and you would therefore be unable to configure the desired configuration. The solution: Create one traffic class using match-all for C and D (which we will call criterion E), and then create a new match-any traffic class using A, B, and E. The new traffic class would have the correct evaluation sequence (A or B or E, which would also be A or B or [C and D]). The desired traffic class configuration has been achieved. The only method of mixing match-all and match-any statements in a traffic class is through the use of the traffic class match criterion.
Nested Traffic Class to Combine match-any and match-all Characteristics in One Traffic Class Example
The only method of including both match-any and match-all characteristics in a single traffic class is to use the match class-map command. To combine match-any and match-all characteristics into a single class, a traffic class created with the match-any instruction must use a class configured with the match-all instruction as a match criterion (through the match class-map command), or vice versa. The following example shows how to combine the characteristics of two traffic classes, one with match-any and one with match-all characteristics, into one traffic class with the match class-map command. The result of traffic class class3 requires a packet to match one of the following three match criteria to be considered a member of traffic class class4: IP protocol and QoS group 4, destination MAC address 00.00.00.00.00.00, or access group 2. In this example, only the traffic class called class4 is used with the traffic policy called policy1.
Router(config)# class-map match-all class3 Router(config-cmap)# match protocol ip Router(config-cmap)# match qos-group 4 Router(config-cmap)# exit Router(config)# class-map match-any class4 Router(config-cmap)# match class-map class3
QC-415
Configuring the Modular Quality of Service Command-Line Interface Modular QoS CLI Configuration Examples
Router(config-cmap)# match destination-address mac 00.00.00.00.00.00 Router(config-cmap)# match access-group 2 Router(config-cmap)# exit Router(config)# policy-map policy1 Router(config-pmap)# class class4 Router(config-pmap-c)# police 8100 1500 2504 conform-action transmit exceed-action set-qos-transmit 4 Router(config-pmap-c)# exit
With the exception that the values associated with the priority and shape commands can be modified, the example is the required configuration for PVCs using FRF.12 (or higher). The value used with the shape command is provisioned from the committed information rate (CIR) value from the service provider. For more information about FRF.12 (or higher) PVCs, see the Cisco IOS Wide-Area Networking Configuration Guide, Release 12.4. For more information about the service-policy command, see the Cisco IOS Quality of Service Solutions Command Reference, Release 12.4T.
QC-416