Applying QoS Features Using the MQC
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contents
Applying QoS Features Using the MQCLast Updated: June 21, 2011
This module contains the concepts about applying QoS features using the Modular Quality of Service (QoS) Command-Line Interface (CLI) (MQC) and the tasks for configuring the MQC. The MQC allows you to define a traffic class, create a traffic policy (policy map), and attach the traffic policy to an interface. The traffic policy contains the QoS feature that will be applied to the traffic class.
Finding Feature InformationYour software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the Feature Information Table at the end of this document. Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required. Restrictions for Applying QoS Features Using the MQCThe MQC supports a maximum of 256 classes in a single policy map. Information About Applying QoS Features Using the MQC
The MQC StructureThe MQC structure allows you to define a traffic class, create a traffic policy, and attach the traffic policy to an interface. 1. Define a traffic class by using the class-mapcommand. A traffic class is used to classify traffic. 2. Create a traffic policy by using the policy-map command. (The terms traffic policy and policy map are often synonymous.) A traffic policy (policy map) contains a traffic class and one or more QoS features that will be applied to the traffic class. The QoS features in the traffic policy determine how to treat the classified traffic. 3. Attach the traffic policy (policy map) to the interface by using the service-policy command. DETAILED STEPS
Elements of a Traffic ClassA traffic class contains three major elements: a traffic class name, a series of match commands, and, if more than one match command is used in the traffic class, instructions on how to evaluate these match commands. The match commands are used for classifying packets. Packets are checked to determine whether they meet the criteria specified in the matchcommands; if a packet meets the specified criteria, that packet is considered a member of the class. Packets that fail to meet the matching criteria are classified as members of the default traffic class. Available match CommandsThe table below lists some of the available match commands that can be used with the MQC. The available match commands vary by Cisco IOS release and platform. For more information about the commands and command syntax, see the command reference for the Cisco IOS release and platform that you are using. If the traffic class contains more than one match command, you need to specify how to evaluate the match commands. You specify this by using either the match-any or match-allkeywords of the class-map command. Note the following points about the match-any and match-all keywords:
Elements of a Traffic PolicyA traffic policy contains three elements: a traffic policy name, a traffic class (specified with the class command), and the command used to enable the QoS feature. The traffic policy (policy map) applies the enabled QoS feature to the traffic class once you attach the policy map to the interface (by using the service-policy command).
The commands used to enable QoS features vary by Cisco IOS release and platform. The table below lists some of the available commands and the QoS features that they enable. For complete command syntax, see the command reference for the Cisco IOS release and platform that you are using.
Nested Traffic ClassesThe MQC does not necessarily require that you associate only one traffic class to one traffic policy. When packets meet more than one match criterion, multiple traffic classes can be associated with a single traffic policy. Similarly, the MQC allows multiple traffic classes (nested traffic classes, which are also called nested class maps or MQC Hierarchical class maps) to be configured as a single traffic class. This nesting can be achieved with the use of the match class-map command. The only method of combining match-any and match-all characteristics within a single traffic class is with the match class-map command. match-all and match-any Keywords of the class-map CommandOne of the commands used when you create a traffic class is the class-mapcommand. The command syntax for the class-map command includes two keywords: match-all and match-any. The match-all and match-any keywords need to be specified only if more than one match criterion is configured in the traffic class. Note the following points about these keywords:
input and output Keywords of the service-policy CommandThe QoS feature configured in the traffic policy can be applied to packets entering the interface or to packets leaving the interface. Therefore, when you use the service-policy command, you need to specify the direction by using the input or output keyword. For instance, the service-policy output class1command would apply the feature in the traffic policy to the interface. All packets leaving the interface are evaluated according to the criteria specified in the traffic policy named class1. How to Apply QoS Features Using the MQCTo create a traffic class, 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 that you specify are placed in the traffic class. The traffic policy (policy map) applies the enabled QoS feature to the traffic class once you attach the policy map to the interface (by using the service-policy command). For more information about the service-policy command, see the GUID-3F2F3A24-38E0-4B88-ACB7-B99C2B3AE1CF. Depending on the platform and Cisco IOS XE release that you are using, a traffic policy can be attached to an ATM permanent virtual circuit (PVC) subinterface, to a Frame Relay data-link connection identifier (DLCI), or to another type of interface.
Creating a Traffic Class Using the MQC
DETAILED STEPS
Creating a Traffic Policy Using the MQC
DETAILED STEPS
Attaching a Traffic Policy to an InterfaceThe traffic policy (policy map) applies the enabled QoS feature to the traffic class once you attach the policy map to the interface (by using the service-policy command). For information about the input and output keywords of the service-policy command, see the input and output Keywords of the service-policy Command. Depending on the platform and Cisco IOS release that 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. To attach a traffic policy to an interface, complete the following steps.
DETAILED STEPS
Verifying the Traffic Class and Traffic Policy InformationSUMMARY STEPS
DETAILED STEPS
Configuration Examples for Applying QoS Features Using the MQC
Example Creating a Traffic ClassIn the following example, two traffic classes are created and their match criteria are defined. For the first traffic class called class1, access control list (ACL) 101 is used as the match criterion. For the second traffic class called class2, ACL 102 is used as the match criterion. Packets are checked against the contents of these ACLs to determine if they belong to the class. Router(config)# class-map class1 Router(config-cmap)# match access-group 101 Router(config-cmap)# exit Router(config)# class-map class2 Router(config-cmap)# match access-group 102 Router(config-cmap)# end Example Creating a Traffic PolicyIn the following example, a traffic policy called policy1 is defined. The traffic policy contains the QoS features to be applied to two classes--class1 and class2. The match criteria for these classes were previously defined (as described in the Example Creating a Traffic Class). For class1, the policy includes a bandwidth allocation request and a maximum packet count limit for the queue reserved for the class. For class2, the policy specifies only a bandwidth allocation request. Router(config)# policy-map policy1 Router(config-pmap)# class class1 Router(config-pmap-c)# bandwidth 3000 Router(config-pmap-c)# queue-limit 30 Router(config-pmap-c)# exit Router(config-pmap)# class class2 Router(config-pmap-c)# bandwidth 2000 Router(config-pmap-c)# end Example Attaching a Traffic Policy to an InterfaceThe following example shows how to attach an existing traffic policy to an interface. After you define a traffic policy with the policy-map command, you can attach it to one or more interfaces by using the service-policy command in interface configuration mode. Although you can assign the same traffic policy to multiple interfaces, each interface can have only one traffic policy attached in the input direction and only one traffic policy attached in the output direction. Router(config)# interface ethernet1/1 Router(config-if)# service-policy output policy1 Router(config-if)# exit Router(config)# interface fastethernet1/0/0 Router(config-if)# service-policy output policy1 Router(config-if)# exit Example match not CommandThe match notcommand is used to specify a specific QoS policy value that is not used as a match criterion. When using the match not command, all other values of that QoS policy become successful match criteria. For instance, if the match not qos-group 4 command is issued in class-map configuration mode, the specified class will accept all QoS group values except 4 as successful match criteria. In the following traffic class, all protocols except IP are considered successful match criteria: Router(config)# class-map noip Router(config-cmap)# match not protocol ip Router(config-cmap)# end Example Default Traffic Class ConfigurationUnclassified traffic (traffic that does not meet the match criteria specified in the traffic classes) is treated as belonging to the default traffic class. If you do not configure a default class, packets are still treated as members of the default class. However, by default, the default class has no QoS features enabled. Therefore, packets belonging to a default class have no QoS functionality. These packets are placed into a first-in, first-out (FIFO) queue managed by tail drop. Tail drop is a means of avoiding congestion that treats all traffic equally and does not differentiate between classes of service. Queues fill during periods of congestion. When the output queue is full and tail drop is in effect, packets are dropped until the congestion is eliminated and the queue is no longer full. The following example configures a traffic policy for the default class of the traffic policy called policy1. The default class (which is always called class-default) has these characteristics: 10 queues for traffic that does not meet the match criteria of other classes whose policy is defined by the traffic policy policy1, and a maximum of 20 packets per queue before tail drop is enacted to handle additional queued packets. Router(config)# policy-map policy1 Router(config-pmap)# class class-default Router(config-pmap-c)# fair-queue Router(config-pmap-c)# queue-limit 20 Example class-map match-any and class-map match-all CommandsThis example illustrates the difference between the class-map match-any command and the class-map match-all command. The match-any and match-all keywords determine how packets are evaluated when multiple match criteria exist. Packets must either meet all of the match criteria (match-all) or meet one of the match criterion (match-any) to be considered a member of the traffic class. The following example shows a traffic class configured with the class-map match-allcommand: Router(config)# class-map match-all cisco1 Router(config-cmap)# match protocol ip Router(config-cmap)# match qos-group 4 Router(config-cmap)# match access-group 101 If a packet arrives on a router with the 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 is classified as a member of the traffic class cisco1. The following example shows a traffic class that is 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 the 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 the IP protocol can be used as a match criterion. If the IP protocol can be used as a match criterion, the packet is matched to traffic class cisco2. If the 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 default traffic class (class default-class). Note that the class-map match-allcommand requires that all of the match criteria be met in order for the packet to be considered a member of the specified traffic class (a logical AND operator). In the first example, protocol IP AND QoS group 4 AND access group 101 must be successful match criteria. However, only one match criterion must be met in order 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 second example, protocol IP OR QoS group 4 OR access group 101 must be successful match criterion. Example Traffic Class as a Match Criterion (Nested Traffic Classes)There are two reasons to use the match class-map command. One reason is maintenance; if a large traffic class currently exists, using the traffic class match criterion is simply easier than retyping the same traffic class configuration. The more common reason for the match class-map command is to allow users to use match-any and match-all statements in the same traffic class. If you want to combine match-all and match-any characteristics in a traffic policy, create a traffic class using one match criterion evaluation instruction (either match-any or match-all) and then use this traffic class as a match criterion in a traffic class that uses a different match criterion type. Here is a possible scenario: Suppose A, B, C, and D were all separate match criterion, and you wanted traffic matching for A, orB, 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 four 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.
Example Nested Traffic Class for MaintenanceIn the following example, the traffic class called class1 has the same characteristics as the traffic class called class2, with the exception that traffic class class1 has added a destination address as a match criterion. Rather than configuring traffic class class1 line by line, you can enter the match class-map class2 command. This command allows all of the characteristics in the traffic class called class2 to be included in the traffic class called class1, and you can simply add the new destination address match criterion without reconfiguring the entire traffic class. Router(config)# class-map match-any class2 Router(config-cmap)# match protocol ip Router(config-cmap)# match qos-group 3 Router(config-cmap)# match access-group 2 Router(config-cmap)# exit Router(config)# class-map match-all class1 Router(config-cmap)# match class-map class2 Router(config-cmap)# match destination-address mac 00.00.00.00.00.00 Router(config-cmap)# exit Example Nested Traffic Class to Combine match-any and match-all Characteristics in One Traffic ClassThe 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 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 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)# end Example Traffic Policy as a QoS Policy (Hierarchical Traffic Policies)A traffic policy can be included in a QoS policy when the service-policy command is used in policy-map class configuration mode. A traffic policy that contains a traffic policy is called a hierarchical traffic policy. A hierarchical traffic policy contains a child policy and a parent policy. The child policy is the previously defined traffic policy that is being associated with the new traffic policy through the use of the service-policy command. The new traffic policy using the preexisting traffic policy is the parent policy. In the example in this section, the traffic policy called child is the child policy and traffic policy called parent is the parent policy. Hierarchical traffic policies can be attached to subinterfaces and ATM PVCs. When hierarchical traffic policies are used, a single traffic policy (with a child and a parent policy) can be used to shape and prioritize PVC traffic. In the following example, the child policy is responsible for prioritizing traffic and the parent policy is responsible for shaping traffic. In this configuration, the parent policy allows packets to be sent from the interface, and the child policy determines the order in which the packets are sent. Router(config)# policy-map child Router(config-pmap)# class voice Router(config-pmap-c)# priority 50 Router(config)# policy-map parent Router(config-pmap)# class class-default Router(config-pmap-c)# shape average 10000000 Router(config-pmap-c)# service-policy child The value used with the shape command is provisioned from the committed information rate (CIR) value from the service provider. Additional ReferencesRelated DocumentsMIBsTechnical Assistance
Feature Information Applying QoS Features Using the MQCThe following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature. Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to www.cisco.com/go/cfn. An account on Cisco.com is not required.
Cisco and the Cisco Logo are trademarks of Cisco Systems, Inc. and/or its affiliates in the U.S. and other countries. A listing of Cisco's trademarks can be found at www.cisco.com/go/trademarks. Third party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1005R) Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||