Home > Articles > Networking > Routing & Switching

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

A Quick MQC Review

Over time, various Cisco IOS Software versions and hardware platforms have invented different ways to control QoS behaviors (policing, marking, queuing, and dropping). There have been many different CLIs that accomplish very similar things. A GSR QoS configuration was different from a 7200 configuration was different from a 7500 configuration, and so forth.

Along came MQC. MQC's goal is to unify all the QoS configuration steps into a single, flexible CLI that can be used across all IOS platforms.

This chapter covers only the MQC, because that is the preferred way to configure QoS. You can configure QoS services in other ways, but they are not covered here. If you have questions about a specific router model or software version, see the relevant documentation.

MQC is very powerful, and it can be a bit complex to the beginner. This section is a quick review of MQC. This is not a book on QoS, so this chapter doesn't go into great detail on the different types of services—merely how you can configure them with MQC.

MQC has three pieces:

  • Class map—How you define what traffic you're interested in

  • Policy map—What you do to the traffic defined in a class map

  • Service policy—How you enable a policy map on an interface

The options you have within each of these pieces vary between code versions and platforms, so some of the options shown here might not be available to you. The basic idea remains constant, though.

Configuring a Class Map

The first step in using MQC is to build a class map. Not surprisingly, you do this with the class-map command:

vxr12(config)#class-map ?
  WORD       class-map name
  match-all  Logical-AND all matching statements under this classmap
  match-any  Logical-OR all matching statements under this classmapm

The match-all and match-any keywords let you specify whether traffic matches this class, if it matches all the rules in this class or any of them, respectively. The default is match-all.

You create a class by giving it a name. This puts you in a submode called config-cmap:

vxr12(config)#class-map voice
vxr12(config-cmap)#?
QoS class-map configuration commands:
  description  Class-Map description
  exit         Exit from QoS class-map configuration mode
  match        classification criteria
  no           Negate or set default values of a command
  rename       Rename this class-mapm

The most useful option under config-cmap is match, which lets you define the traffic you want to match with this class map. Its options are as follows:

vxr12(config-cmap)#match ?
  access-group         Access group
  any                  Any packets
  class-map            Class map
  cos                  IEEE 802.1Q/ISL class of service/user priority values
  destination-address  Destination address
  fr-de                Match on Frame-relay DE bit
  input-interface      Select an input interface to match
  ip                   IP specific values
  mpls                 Multi Protocol Label Switching specific values
  not                  Negate this match result
  protocol             Protocol
  qos-group            Qos-group
  source-address       Source addressm

There are a few interesting options here. Note that you can match a class map; this lets you define hierarchical classes. A class called "Business," for example, can match an "Email" class and a "Payroll" class you define so that all business-class e-mail and all traffic to or from the payroll department gets the same treatment. You can also match not, which lets you match everything except a specific thing. You might now start to understand the awesome power of MQC.

Table 6-1 lists the matches of interest here.

Table 6-1 Class Map Matches

Match Type

Function

Configuration Syntax

access-group

Matches a named or numbered access list.

access-group {name acl-name | acl-number 1-2699}

ip

Matches IP packets of a specific DSCP or IP Precedence value (or a range of RTP ports, but that's not addressed here).

ip {dscp name-or-number | precedence name or number | rtp lower-bound range}

mpls

Matches MPLS packets that have a particular EXP value.

mpls experimental 0-7


For the example in this chapter, create a simple LLQ policy matching MPLS EXP 5 traffic, and assume it is Voice over IP (VoIP) traffic. The necessary configuration is as follows:

class-map match-all voice
  match mpls experimental  5
policy-map llq
  class voice
    priority percent 30

This defines a class that matches any MPLS traffic that has the EXP bits set to 5 and then defines a policy for that traffic that gives the traffic 30 percent of a link's bandwidth. The policy map hasn't been enabled on an interface yet; you'll see that in a minute.

You can match multiple values with the same line using the following command sequence:

class-map match-any bronze-service
  match mpls experimental  0  1

This matches any packets that have an MPLS EXP of 0 or 1. As with route maps, multiple values specified within the same match clause (such as match mpls experimental 0 1) are implicitly ORed together; a packet can't have both EXP 0 and EXP 1, so this implicit ORing makes sense.

You can also match more than one criteria within a class, and you can use the match-any and match-all statements to decide how you want to match traffic. For example, the following policy matches traffic that has MPLS EXP 5 or traffic that entered the router on interface POS3/0:

class-map match-any gold
  match mpls experimental  5
  match input-interface POS3/0

The following policy matches any traffic that has MPLS EXP 5 and that came in on interface POS3/0:

class-map match-all gold
  match mpls experimental  5
  match input-interface POS3/0

See the difference? The first class map is match-any (the default), and the second is match-all.

The output for show class-map {class-map-name} shows you the configured class maps, as demonstrated in Example 6-1.

Example 6-1 Displaying the Configured Class Maps

vxr12#show class-map
 Class Map match-all gold (id 2)
   Match mpls experimental  5
   Match input-interface POS3/0

 Class Map match-any class-default (id 0)
   Match any

 Class Map match-all voice (id 3)
   Match mpls experimental  5

Note the class-default class in this list. class-default is a predefined class; it can be used to match any traffic that doesn't match any other class. You'll read more about this in the next section.

Configuring a Policy Map

After you define the class maps you want to match, you need to associate the class of traffic with a behavior. You create the behavior with the policy-map command, which, like class-map, puts you in a special submode:

vxr12(config)#policy-map ?
  WORD  policy-map name

vxr12(config)#policy-map llq
vxr12(config-pmap)#?
QoS policy-map configuration commands:
  class        policy criteria
  description  Policy-Map description
  exit         Exit from QoS policy-map configuration mode
  no           Negate or set default values of a command
  rename       Rename this policy-map

Under the config-pmap submode, you specify the class you want to match. This puts you in the config-pmap-c submode:

vxr12(config)#policy-map llq
vxr12(config-pmap)#class voice
vxr12(config-pmap-c)#?
QoS policy-map class configuration commands:
  bandwidth       Bandwidth
  exit            Exit from QoS class action configuration mode
  no              Negate or set default values of a command
  police          Police
  priority        Strict Scheduling Priority for this Class
  queue-limit     Queue Max Threshold for Tail Drop
  random-detect   Enable Random Early Detection as drop policy
  service-policy  Configure QoS Service Policy
  set             Set QoS values
  shape           Traffic Shaping

You can do all sorts of things here. Table 6-2 shows the options of interest for the purposes of this chapter.

Table 6-2 policy-map Command Options

Policy Type

Function

Configuration Syntax

bandwidth

Allocates the configured amount of bandwidth to the matched class. This is CBWFQ.

bandwidth {bandwidth-kbps | remaining percent percentage | percent percentage}

police

A token bucket policer that conforms to RFCs 2697 and 2698.

police {cir cir} [bc conform-burst] {pir pir} [be peak-burst] [conform-action action [exceed-action action [violate-action action]]]

priority

Allocates the configured amount of bandwidth to the matched class. This differs from the bandwidth option in that the priority keyword is LLQ.

priority {bandwidth-kbps | percent percentage} [burst]

random-detect

Sets the WRED parameters for this policy.

random-detect {prec precedence min-threshold max-threshold [mark-probability-denominator]

set

Sets IP Precedence, DSCP, or the EXP value on a packet.

set {ip {dscp value | precedence value} | {mpls experimental value}}

shape

Shapes the matched traffic to a certain profile.

shape {average value | max-buffers value | peak value}


The syntax for all those commands makes them look intimidating, but it's easy. Example 6-2 shows the LLQ policy you read about earlier, using the voice class map that's already been defined.

Example 6-2 LLQ Policy with a Defined voice Class Map

class-map match-any voice
  match mpls experimental  5
policy-map llq
  class voice
    priority percent 30

A predefined class called class-default implicitly matches anything not matched by a specific class; this gives you an easy way to give all unmatched packets the same treatment if you want to. For example, you can expand this class map to cover two types of service: voice and business. Business class is any data that has an MPLS EXP of 3 or 4, that is allocated 60 percent of the link bandwidth, and in which MPLS-based VoIP packets (EXP 5) get 30 percent of the link bandwidth. All other traffic is matched with class-default, which gets the remaining 10 percent of link bandwidth. This requires both a new class (to match the EXP 3 and 4 traffic) and a new policy map to define the treatment these classes get (see Example 6-3).

Example 6-3 Defining a Policy Map with a Business Class

class-map match-all business
  match mpls experimental  3  4
class-map match-all voice
  match mpls experimental  5
policy-map business-and-voice
  class voice
    priority percent 30
  class business
   bandwidth percent 60
  class class-default
   bandwidth percent 10

The show policy-map command gives you a fair amount of detail about the policy maps defined on a router and the class maps inside them. Example 6-4 shows two policy maps—llq and business-and-voice; the llq policy matches the voice class, and the business-and-voice policy matches the voice and business classes.

Example 6-4 Displaying Policy Map Information

vxr12#show policy-map
  Policy Map business-and-voice
    Class voice
      Weighted Fair Queuing
            Strict Priority
            Bandwidth 30 (%)
    Class business
      Weighted Fair Queuing
            Bandwidth 60 (%) Max Threshold 64 (packets)
    Class class-default
      Weighted Fair Queuing
            Bandwidth 10 (%) Max Threshold 64 (packets)

  Policy Map llq
    Class voice
      Weighted Fair Queuing
            Strict Priority
            Bandwidth 30 (%)

Configuring a Service Policy

This is the easiest part of the MQC. So far, you've seen a few class definitions and a policy definition. Now all that's left is to apply the policy to an interface, as shown in Example 6-5.

Example 6-5 Applying a Service Policy to a Router Interface

vxr12(config-if)#service-policy ?
  history  Keep history of QoS metrics
  input    Assign policy-map to the input of an interface
  output   Assign policy-map to the output of an interface

vxr12(config-if)#service-policy out
vxr12(config-if)#service-policy output ?
  WORD  policy-map name

vxr12(config-if)#service-policy output llq

That's it. Note that you can have both an inbound and an outbound service policy.

show policy-map interface interface gives you details about which policy maps are applied to an interface, as demonstrated in Example 6-6.

Example 6-6 Determining Which Policy Maps Are Applied to an Interface

vxr12#show policy-map interface pos3/0
 POS3/0

  Service-policy output: llq

    Class-map: voice (match-all)
      0 packets, 0 bytes
      5 minute offered rate 0 bps, drop rate 0 bps
      Match: mpls experimental  5
      Weighted Fair Queuing
        Strict Priority
        Output Queue: Conversation 264
        Bandwidth 30 (%)
        Bandwidth 46500 (kbps) Burst 1162500 (Bytes)
        (pkts matched/bytes matched) 0/0
        (total drops/bytes drops) 0/0

    Class-map: class-default (match-any)
      21 packets, 15744 bytes
      5 minute offered rate 3000 bps, drop rate 0 bps
      Match: any

If you're still not comfortable with either MQC or the underlying QoS concepts such as CBWFQ and LLQ, it is highly recommended that you check out the references in Appendix B.

  • + Share This
  • 🔖 Save To Your Account