Home > Articles > Cisco Network Technology > General Networking > Traffic Engineering with MPLS

Traffic Engineering with MPLS

  • Sample Chapter is provided courtesy of Cisco Press.
  • Date: Aug 16, 2002.

Chapter Description

This sample chapter offers a brief look at the DiffServ architecture and its interaction with IP and MPLS packets, the MQC, and DS-TE.

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
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


Configuration Syntax


Matches a named or numbered access list.

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


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}


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
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
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


Configuration Syntax


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

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


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]]]


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]


Sets the WRED parameters for this policy.

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


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

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


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

  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.

3. DiffServ and IP Packets | Next Section Previous Section

Cisco Press Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Cisco Press and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Cisco Press products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@ciscopress.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Cisco Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.ciscopress.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020