Creating a DSCP policy based on TCP/UDP port number classifiers

The following procedure creates a DSCP policy for IP packets carrying the selected TCP or UDP port-number classifier.

Procedure
  1. Identify the TCP or UDP port-number classifier you want to use for assigning a DSCP policy.
  2. Determine the DSCP policy for packets carrying the selected TCP or UDP port number or range of port numbers.
    1. Determine the DSCP you want to assign to the selected packets. (This codepoint will be used to overwrite (re-mark) the DSCP carried in packets received from upstream devices.)

    2. Determine the 802.1p priority you want to assign to the DSCP.

  3. If necessary, use the qos dscp-map <codepoint> priority <0-7> command to configure the DSCP policy (codepoint and associated 802.1p priority) that you want to use to mark matching packets.
    NOTE:

    Prerequisite: A DSCP codepoint must have a preconfigured 802.1p priority (0 - 7) before you can use the codepoint to mark matching packets. If a codepoint you want to use shows No-override in the Priority column of the DSCP Policy table (using the show qos dscp-map command), you must first configure a priority for the codepoint before proceeding (using the qos dscp-map priority command).

    (Optional) This command is required only if an 802.1p priority is not already assigned to the specified <codepoint> in the DSCP Policy table. Valid values for a DSCP codepoint are as follows:

    • A binary value for the six-bit codepoint from 000000 to 111111.

    • A decimal value from 0 (low priority) to 63 (high priority) that corresponds to a binary DSCP bit set

    • An ASCII standard (hexadecimal) name for a binary DSCP bit set:

      af11 (001010)

      af42 (100100)

      af12 (001100)

      af43 (100110)

      af13 (001110)

      ef (101110)

      af21 (010010)

      cs1 (001000) = precedence 1

      af22 (010100)

      cs2 (010000) = precedence 2

      af23 (010110)

      cs3 (011000) = precedence 3

      af31 (011010)

      cs4 (100000) = precedence 4

      af32 (011100)

      cs5 (101000) = precedence 5

      af33 (011110)

      cs6 (110000) = precedence 6

      af41 (100010)

      cs7 (111000) = precedence 7

      default (000000)

       
      Enter ? to display the list of valid codepoint entries.

      When the switch applies the specified DSCP policy to a packet, the priority determines the packet's queue in the outbound port to which it is sent. If the packet leaves the switch on a tagged port, it carries the 802.1p priority with it to the next downstream device. For IP packets, the DSCP will be replaced by the codepoint specified in this command.

      (Default: No-override for most codepoints.)

  4. Configure the switch to assign the DSCP policy to packets with the specified TCP or UDP port number or range of port numbers.
    
    no qos {udp-port | tcp-port} [ipv4 | ipv6 | ipv-all] {<port-number> | range <port start><port end>} {dscp < codepoint> | priority <priority>}
    
    no qos {udp-port | tcp-port} [ipv4 | ipv6 | ipv-all] {<port-number> | range <port start><port end>} {dscp < codepoint> | priority <priority>}
    

    Assigns a DSCP policy to outbound packets having the specified TCP or UDP application-port number or port range, and overwrites the DSCP in these packets with the assigned <codepoint> value, where:

    • port-number: specifies a TCP/UDP port-number from 1 to 65535.
    • range <start end>: specifies a range of TCP/UDP ports. If you specify a range, the minimum port number must precede the maximum port number in the range.
    • dscp <codepoint>: overwrites the DSCP codepoint in the IPv4 ToS byte or IPv6 Traffic Class byte of matching packets with the specified value.Valid values for the DSCP codepoint are as follows:
      • A binary value for the 6-bit codepoint from 000000 to 111111.

      • A decimal value from 0 (low priority) to 63 (high priority) that corresponds to a binary DSCP bit set

      • An ASCII standard name for a binary DSCP bit set

        Enter ? to display the list of valid codepoint entries.

        The DSCP value you enter must be currently associated with an 802.1p priority in the DSCP Policy table. The 802.1p priority and determines the packet's queue in the outbound port to which it is sent. If the packet leaves the switch on a tagged port, it carries the 802.1p priority with it to the next downstream device.

        The default DSCP codepoint is No-override. The DSCP codepoint is not overwritten in matching packets.

      The no form of the command deletes the specified UDP or TCP port number or range of port numbers as a QoS classifier. If you configured a range of port numbers as the QoS classifier, you must enter the entire range in the no command; you cannot remove part of a range.
    Syntax
    
    show qos tcp-udp-port-priority
    
    Displays a listing of all TCP and UDP QoS classifiers currently in the running-config file.

Example:

This example shows how to assign the following DSCP policies to packets that match the specified TCP and UDP port applications:

Port Applications

DSCP Policies

DSCP

Priority

23-UDP

000111

7

80-TCP

000101

5

914-TCP

000010

1

1001-UDP

000010

1

  1. Determine if the DSCP codepoints that you want to use to mark matching packets already have an 802.1p priority assigned, which could indicate use by existing applications (show qos dscp-map command).

    A DSCP codepoint must also have a priority configured before you can use it to mark matching packets.
    switch(config)# show qos dscp-map
    
      DSCP -> 802.p priority mappings
    
      NOTE: ‘qos type-of-service diff-services’ must be configured
             before DSCP is honored on inbound traffic.
    
      DSCP CodePoint DSCP Value 802.1p tag   DSCP Policy name
      -------------- ---------- -----------  ----------------------
      000000         0          0            cs0
      000001         1          No-override
      000010         2          No-override
      000011         3          No-override
      000100         4          No-override
      000101         5          No-override
      000110         6          No-override
      000111         7          No-override
      001000         8          1            cs1
      001001         9          No-override
  2. Configure the DSCP policies for the codepoints you want to use.
    switch(config)# qos dscp-map af11 priority 3
    switch(config)# qos dscp-map 13 priority 3
    switch(config)# qos dscp-map af13 priority 3
    switch(config)# write memory
    
    switch(config)# show config
    switch configuration:
    
    ; J9146 Configuration Editor; Created on release XX.15.XX
    
    hostname “Switch”
    time daylight-time-rule None
    qos dscp-map af11 priority 3
    qos dscp-map 13 priority 3
    qos dscp-map af13 priority 3
    ...
  3. Assign the DSCP policies to the selected TCP/UDP port applications and display the result.
    switch(config)# qos udp-port 23 dscp 000111
    switch(config)# qos tcp-port 80 dscp 000101
    switch(config)# qos tcp-port 914 dscp 000010
    switch(config)# qos udp-port range 1001 2000 dscp 000010
    
      TCP/UDP port based priorities
    
               | IP Packet Application            |
      Protocol | Type      Port        Apply rule | DSCP   Priority
      -------- + --------- ----------- ---------- + ------ -----------
      UDP      | IPV4      23          DSCP       | 8      7
      TCP      | IPV4      80          DSCP       | 6      5
      TCP      | IPV4      914         DSCP       | 3      1
      UDP      | IPV4      1001-2000   DSCP       | 3      1
    The switch applies the DSCP policies in the above output to IP packets with the specified TCP/UDP port applications that are received in the switch. The switch manages the packets as follows:
    • Overwrites the original DSCPs in the selected packets with the new DSCPs specified in the above policies.

    • Assigns the 802.1p priorities in the above policies to the selected packets.