Configuring QoS Marking Policies

This chapter contains the following sections:

Information About Policy Maps

Policy maps prioritize network traffic by class. You create policy maps to define how to treat each class of traffic so that it is prioritized for the best quality of service.

Marking is a method that you use to modify the QoS fields of the incoming and outgoing packets. The QoS fields that you can mark are CoS in Layer 2, and IP precedence and Differentiated Service Code Point (DSCP) in Layer 3. The QoS group and discard class are two labels local to the system that you can assign intermediate marking values. You can use these two labels to determine the final values marked in a packet.

Service policies are specified using policy maps. Policy maps provide an ordered mapping of class maps to service levels. You can specify multiple class maps within a policy map, and map a class map to a high, medium, or low service level. The default priority is low. The policy map name is restricted to 63 alphanumeric characters.

The order of the class maps within a policy map is important to determine the order in which the frame is compared to class maps. The first matching class map has the corresponding priority marked in the frame.

Figure 1. Packet Fields Available for Marking



After you define your traffic classes, you can reference them in the policy map where you also define how they should be marked.

Criteria for Marking Fields

The following table lists fields that are available for marking.

Field

Description

DSCP

Layer 3 differentiated services code point (DSCP).

Note   

If you change the DSCP value, you cannot change discard class values, and vice-versa.

IP Precedence

Layer 3 IP precedence.

Note   

IP precedence uses only the lower 3 bits of the type of service (ToS) field. The device overwrites the first 3 bits of the ToS field to 0.

CoS

Layer 2 class of service (CoS).

QoS Group

Local QoS values that can be marked and matched as needed. The range is from 0 to 126.

Discard Class

Local QoS values that can be matched and marked as needed. The range is from 0 to 63.

Note   

If you change the DSCP value, you cannot change discard class values, and vice-versa.

Table Maps

Method to use table maps for marking.

Unless noted as a restriction, you can mark both incoming and outgoing packets.

Prerequisites for QoS Marking Policies

Marking has the following prerequisites:

  • You must have already classified your network traffic. For more information, see Configuring QoS Classification.

  • You are already logged in to the CLI in EXEC mode.

Guidelines and Limitations for QoS Marking Policies

  • The set cos command is applicable only to 802.1Q interfaces. So, although you can use the set cos command on an ingress interface, the setting is only applied if a packet eventually egresses an 802.1Q compliant interface.

  • For a single class, you can set operations on any two out of the following five fields: CoS, IP Precedence, DSCP, QoS Group, and Discard Class.

  • You can use the set qos-group command only in ingress policies.

  • You can use the set discard-class command only in ingress policies.

Creating QoS Marking Policies

Creating a DSCP Policy

You can create a policy that marks the DSCP value in the IP header packet to prioritize traffic in a particular class.

Before You Begin
Procedure
     Command or ActionPurpose
    Step 1switch# configure terminal  

    Enters global configuration mode.

     
    Step 2switch(config)# policy-map [type qos] [match-first] policy-map-name  

    Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.

    The policy-map-name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map.

     
    Step 3switch(config-pmap)# class [type qos] {class_map_name |class-default}  

    Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.

    Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.

    The class_map_name argument is a unique alphabetic string that can be up to 40 case-insensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map.

     
    Step 4switch (config-pmap-c-qos)# set dscp value  

    Defines the DSCP value that should be used in all IP headers for the specified class and saves it in the running configuration.

    You can use a numeric value from 1 to 60 or one of the standard values from Commonly Used DSCP Values and IP Precedence Values.

    In the example below, the standard value of af31 is used.

     
    Step 5switch(config-pmap-c-qos)#show policy-map policy-map-name  

    Displays the policy map configuration for the specified map name.

    The policy_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.

     
    Step 6switch(config-pmap-c-qos)# copy running-config startup-config   (Optional)

    Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.

     

    This example shows how to create a DSCP policy:

    switch# configure terminal
    switch(config)# policy-map policy1
    switch(config-pmap)# class class1
    switch(config-pmap-c-qos)# set dscp af31
    switch(config-pmap-c-qos)# show policy-map policy1
    Type qos policy-maps
     ====================
    
     policy-map type qos policy1 
       class  class1
         set dscp af31 
    switch(config-pmap-c-qos)# copy running-config startup-config

    Creating an IP Precedence Policy

    Before You Begin
    • You are logged in to the CLI in EXEC mode.

    • See the RFC 791 precedence values from least to most important in the table IP Precedence Values.

    Procedure
       Command or ActionPurpose
      Step 1switch# configure terminal  

      Enters global configuration mode.

       
      Step 2switch(config)# policy-map [type qos] [match-first] policy-map-name  

      Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.

      The policy-map-name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map.

       
      Step 3switch(config-pmap-qos)# class [type qos] {class_map_name |class-default}  

      Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.

      Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.

      The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.

       
      Step 4switch (config-pmap-c-qos)# set precedence value  

      Adds the precedence value that should be used in all IP headers for the specified class and saves it in the running configuration.

      You can use a numeric value from 0 to 7 as shown in the following table:

      Value

      Description

      000 (0)

      Routine or Best Effort

      001 (1)

      Priority

      010 (2)

      Immediate

      011 (3)

      Flash (mainly used for voice signaling or for video)

      100 (4)

      Flash Override

      101 (5)

      Critical (mainly used for voice RTP)

      110 (6)

      Internet

      111 (7)

      Network

       
      Step 5switch(config-pmap-c-qos)# show policy-map policy-map-name  

      Displays the policy map configuration for the specified map name.

       
      Step 6switch(config-pmap-c-qos)# copy running-config startup-config   (Optional)

      Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.

       

      This example shows how to create an IP precedence policy:

      switch# configure terminal
      switch(config)# policy-map policy1
      switch(config-pmap)# class class1
      switch(config-pmap-c-qos)# set precedence 3
      switch(config-pmap-c-qos)# show policy-map policy1
      Type qos policy-maps
       ====================
      
       policy-map type qos policy1 
         class  class1
           set prec 3
      switch(config-pmap-c-qos)# copy running-config startup-config

      Creating a Class of Service Policy

      You can mark the CoS field in the IEEE 802.1Q header for all traffic in a specific class. If you mark this field in an ingress or egress policy, it will only be set when a packet egresses an IEEE 802.1Q-capable interface.

      Before You Begin
      • You are logged in to the CLI in EXEC mode.

      • You can set CoS in ingress and egress policies.

      Procedure
         Command or ActionPurpose
        Step 1switch# configure terminal  

        Enters global configuration mode.

         
        Step 2switch(config)# policy-map [type qos] [match-first] policy-map-name  

        Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.

        The policy-map-name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map.

         
        Step 3switch(config-pmap-qos)# class [type qos] {class_map_name | class-default}  

        Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.

        The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.

        Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.

         
        Step 4 switch (config-pmap-c-qos)# set cos cos-value  

        Sets the CoS value to cos-value. The value can range from 0 to 7. You can use this command only in egress policies.

         
        Step 5switch(config-pmap-c-qos)# show policy-map policy-map-name  

        Displays the policy map configuration for the specified map name.

         
        Step 6switch(config-pmap-c-qos)# copy running-config startup-config   (Optional)

        Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.

         

        This example shows how to create a class of service policy:

        switch# configure terminal
        switch(config)# policy-map policy1
        switch(config-pmap-qos)# class class1
        switch(config-pmap-c-qos)# set cos 3
        switch(config-pmap-c-qos)# show policy-map policy1
        
          Type qos policy-maps
         ====================
        
         policy-map type qos policy1 
           class  class1
             set cos 3
        switch(config-pmap-c-qos)#
        

        Creating a QoS Group Policy

        Before You Begin
        • You are logged in to the CLI in EXEC mode.

        • You can mark the QoS group value only in ingress policies.

        Procedure
           Command or ActionPurpose
          Step 1switch# configure terminal  

          Enters global configuration mode.

           
          Step 2switch(config)# policy-map [type qos] [match-first] policy-map-name  

          Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.

          The policy-map-name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map.

           
          Step 3switch(config-pmap-qos)# class [type qos] {class_map_name | class-default}  

          Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.

          The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.

          Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.

           
          Step 4switch (config-pmap-c-qos)# set qos-group qos-group-value  

          Sets the QoS group value to qos-group-value. The value can range from 0 to 126.

           
          Step 5switch(config-pmap-c-qos)# show policy-map policy-map-name  

          Displays the policy map configuration for the specified map name.

           
          Step 6switch(config-pmap-c-qos)# copy running-config startup-config   (Optional)

          Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.

           

          This example shows how to create a QoS group policy:

          switch# configure terminal
          switch(config)# policy-map policy1
          switch(config-pmap-qos)# class class1
          switch(config-pmap-c-qos)# set qos-group 100
          switch(config-pmap-c-qos)# show policy-map policy1
          Type qos policy-maps
           ====================
          
           policy-map type qos policy1 
             class  class1
               set qos-group 100
          switch(config-pmap-c-qos)# copy running-config startup-config

          Creating a Discard Class Policy

          You can set a local internal label discard class policy.

          Before You Begin
          • If you configure a local internal label discard class policy, you cannot create a DSCP policy. For more information about DSCP policies, see the Creating a DSCP Policy.

          • You can set a discard class only in ingress policies.

          • To reference the local discard class in a policy or in traffic classification, use the match discard-class command. For more information, see Configuring Discard Class Classification.

          Procedure
             Command or ActionPurpose
            Step 1switch# configure terminal  

            Enters global configuration mode.

             
            Step 2switch(config)# policy-map [type qos] [match-first] policy-map-name  

            Places you into policy map QoS configuration mode for the specified policy map and configures the map name in the running configuration.

            The policy-map-name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters. The map name must be unique across class-maps and policy-maps. For example, you cannot have a class-map and a policy-map with the same name of HR_Map.

             
            Step 3switch(config-pmap-qos)# class [type qos] {class_map_name |class-default}  

            Creates a reference to class-map-name and enters policy-map class QoS configuration mode for the specified class map. By default, the class is added to the end of the policy map. Changes are saved in the running configuration.

            The class_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.

            Use the class-default keyword to select all traffic that is not currently matched by classes in the policy map.

             
            Step 4switch (config-pmap-c-qos)# set discard-class discard-class-value  

            Sets the discard-class value to discard-class-value. The value ranges from 0 to 63.

             
            Step 5switch(config-pmap-c-qos)# show policy-map policy-map-name  

            Displays the policy map configuration for the specified map name.

             
            Step 6switch(config-pmap-c-qos)# copy running-config startup-config   (Optional)

            Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.

             

            This example shows how to create a discard class policy:

            switch# configure terminal
            switch(config)# policy-map policy1
            switch(config-pmap-qos)# class class1
            switch(config-pmap-c-qos)# set discard-class 40
            switch(config-pmap-c-qos)# show policy-map policy1
            Type qos policy-maps
             ====================
            
             policy-map type qos policy1 
               class  class1
                 set discard-class 40
            switch(config-pmap-c-qos)# copy running-config startup-config

            Creating Ingress and Egress Policies

            You can attach a policy map to an interface or a port profile so that the marking instructions are applied to the ingress or egress packets.

            Before You Begin
            • The interface or port profile have been created.

            • The policy map that you want to use has been defined.


            Note


            You can attach only one input policy and one output policy to an interface or port profile.


            Procedure
               Command or ActionPurpose
              Step 1switch# configure terminal  

              Enters global configuration mode.

               
              Step 2Enter one of the following commands:
              • switch (config)# interface type number
              • switch (config)# port-profile name
               

              Places you into configuration mode for the specified Ethernet or vEthernet interface or port profile.

               
              Step 3switch (config-if)# service-policy [type qos] {input | output} policy-map-name [no stats]   (Optional) Attaches a policy map name that will be added to the input or output packets of the interface or port profile.
              Note   

              You can attach only one input policy and one output policy to an interface or port profile.

              The policy_map_name argument is a unique alphabetic string that can be up to 40 case-sensitive characters long, including hyphen (-) and underscore (_) characters.

               
              Step 4switch(config-if)# show policy-map policy-map-name   (Optional)

              Displays the policy map configuration for the specified map name.

               
              Step 5switch(config-if)# copy running-config startup-config   (Optional)

              Saves the running configuration persistently through reboots and restarts by copying it to the startup configuration.

               

              This example shows how to configure an ingress policy on an Ethernet interface:

              switch# configure terminal
              switch(config-if)# interface port-channel 1
              switch(config-if)# service-policy input policy1
              switch(config-if)# show policy-map interface port-channel 1 input 
              
              
              Global statistics status :   enabled
              
              port-channel1
              
               Service-policy (qos) input:   policy1 
                 policy statistics status:   enabled
              
                 Class-map (qos):   class1 (match-all)
                   283 packets 
                   Match: access-group testacl1
                   Match: packet length 3-6000
                   set dscp af31 
              
              switch(config-if)# copy running-config startup-config
              
              

              This example shows how to configure an egress policy on a port profile:

              switch# configure terminal
              switch(config)# port-profile 2225-ephe
              switch(config-port-prof)# service-policy output policy1
              switch(config)# show policy-map interface vethernet 1
              
              Global statistics status :   enabled
              
              Vethernet1
              
               Service-policy (qos) output:   policy1 
                 policy statistics status:   enabled
              
                 Class-map (qos):   class1 (match-all)
                   0 packets 
                   Match: access-group testacl1
                   Match: packet length 3-6000
                   set dscp af31 
              
              switch(config-if)# copy running-config startup-config

              Verifying the QoS Policy Configuration

              Use one of the following commands to verify the configuration:

              Command

              Description

              show policy-map [type qos] [name policy_map_name]

              Displays the policy map configuration.

              show policy-map interface name

              Displays the policy applied on a interface with statistics.

              show policy-map interface brief

              Displays all the interfaces on which QoS policy is applied.

              show running-config ipqos

              Displays all configured class, policy maps, and interfaces.

              Configuration Example for QoS Marking Policies

              This example shows how to display a specific policy-map policy applied on a interface:

              switch(config)# show policy-map policy1 
              
              
                Type qos policy-maps
                ====================
              
                policy-map type qos policy1 
                  class  class1
                    set dscp af31 
              switch(config)# sh class-map class1
              
              
                Type qos class-maps
                ====================
              
                  class-map type qos match-all class1
                    match access-group name testacl1
                    match packet length 3-6000
              
              switch(config)# int veth 1
              switch(config-if)# service-policy ty qos input policy1 
              switch(config-if)# sh run int veth 1
              
              !Command: show running-config interface Vethernet1
              
              
              interface Vethernet1
                inherit port-profile 2225-ephe
                service-policy type qos input policy1
                description data-2-00-1, Network Adapter 2
                vmware dvport 416 dvswitch uuid "d8 39 0d 50 d2 4a 37 c2-4f 55 f5 b3 d2 fa f8 e9"
                vmware vm mac 0050.5681.443C
              
              switch(config-if)# show policy-map interface vethernet 1
              
              
              Global statistics status :   enabled
              
              Vethernet1
              
                Service-policy (qos) input:   policy1 
                  policy statistics status:   enabled
              
                  Class-map (qos):   class1 (match-all)
                    0 packets 
                    Match: access-group testacl1
                    Match: packet length 3-6000
                    set dscp af31 
              
                
              switch(config-if)# show policy-map interface brief 
              
              
               Interface/VLAN [Status]:INP QOS       OUT QOS       INP QUE       OUT QUE
              ================================================================================     
              Vethernet1      [Active]:policy1                                          
              Vethernet2      [Active]:              policy1                                   
              Vethernet3      [Active]:              policy1                                   
               

              Feature History for QoS Marking Policies

              This section provides the QoS marking policies release history.

              Feature Name

              Release

              Feature Information

              QoS Marking Policies

              4.0

              This feature was introduced.

              QoS Marking Policies

              4.0(4)SV1(2)

              DSCP and Discard Class are no longer mutually exclusive. For a single class, you can set operations on any two out of the following five fields: CoS, IP Precedence, DSCP, QoS Group, and Discard Class.