Configuring QoS in Cisco IOSThis article explains how to configure QoS in a cisco IOS using MQC. MQC stands for Modular Quality of Service (QoS) Command-Line Interface (CLI).
How MQC WorksThe MQC structure allows you to define a traffic class, create a traffic policy, and attach the traffic policy to an interface. MQC configuration involves following steps:
- Define a traffic class by using the class-map command. A traffic class is used to classify traffic.
- Create a traffic policy (policy map) by using the policy-map command. 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 process traffic for the given traffic class.
- Attach the traffic policy (policy map) to the interface by using the service-policy command.
Step-1 Defining a Traffic ClassA traffic class contains three elements:
- a traffic class name
- a series of match commands to classifying packets into a traffic class. Available match commands vary for each Cisco IOS release and platform.
- if more than one match command is used in the traffic class, instructions on how to evaluate these match commands, using match-any or match-all. If not specified match-all is default value.
All packets that fail to meet the matching criteria are classified as members of the default traffic class. class-map [match-all | match-any] class-map-name match cos cos-number Enter additional match commands, if applicable; otherwise,issue: end
Example configuration: class-map match-any class1 match cos 2 match destination-address aaaa.bbbb.cccc end
Step-2 Creating a Traffic PolicyA traffic policy contains three elements: - a traffic policy name
- a traffic class, specified with the class command
- a command used to enable the QoS feature. QoS feature commands vary by Cisco IOS release and platform. Most used commands include police and shape.
The MQC configurations allows you to create the traffic policy (policy map) once and then apply it to as many traffic classes as needed. You can also attach the traffic policies to as many interfaces as needed.
Example configuration: policy-map policy-map-name class {class-name | class-default} bandwidth {bandwidth-kbps | percent percent} additional QoS feature commands you want to enable, otherwise issue: end Example configuration: policy-map policy1 class class1 bandwidth 3000 end
Remember that traffic policy (policy map) applies the enabled QoS feature to the traffic class only, when you attach the policy map to the interface. Step-3 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 using the service-policy command. The QoS feature configured in the traffic policy can be applied to packets entering the interface (input) or to packets leaving the interface (output). interface interface-type interface-number service-policy {input | output} policy-map-name end Example Configuration: interface serial0 service-policy input policy1 end
MQC Configuration ExampleCreate two traffic classes: 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)# exit
Create a traffic policy, by appling seperate QoS features on each traffic class: 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)# exit
Attaching one traffic policy to multiple interfaces for outgoing and incoming traffic: Router(config)# interface fastethernet1/1 Router(config-if)# service-policy output policy1 Router(config-if)# exit
Router(config)# interface fastethernet1/0/0 Router(config-if)# service-policy input policy1 Router(config-if)# exit
|