QoS - CoS to DSCP and DSCP to CoS mapping
Differentiated Services Code Point DSCP values are those found within the appropriate field in the IP header. The 802.1Q priority field which contains the Cost of Service or CoS values is part of the VLAN tag that is found in the Layer 2 Ethernet header. These tags are only present for frames traversing a trunk link. Each of these operates at a different layer of the OSI Model.
Now both of these features can be used in QoS mechanisms. For example, the CoS values can be derived from the 802.1Q priority field. The CoS can then be used to classify frames traversing a trunk. The frames arriving at a trunk port can then be queued and prioritized accordingly.
For the DSCP values, these can be used to classify and mark IP packets that can then subsequently be used by QoS mechanisms to ensure the correct prioritization.
Because DSCP/IP precedence and 802.1Q priorities are constructs that belong to different layers, and are applied and used separately, there is no direct relationship between them. However, it is possible to create a “cos-to-dscp” or a “dscp-to-cos” mapping that will allow an 802.1Q priority field to adopt the priorities indicated in the DSCP of the IP header or visa versa. You can either use a default mapping or create your own.
CoS to DSCP mapping can be configured using the mls qos
commands. The CoS values range from 0 to 7, and the DSCP values can range from 0 to 63.
Here's a simple example of a CoS to DSCP mapping configuration:
mls qos map cos-dscp
In the above configuration:
- CoS value 0 maps to DSCP value 0
- CoS value 1 maps to DSCP value 8
- CoS value 2 maps to DSCP value 16
- CoS value 3 maps to DSCP value 24
- CoS value 4 maps to DSCP value 32
- CoS value 5 maps to DSCP value 46 (often used for VoIP EF - Expedited Forwarding)
- CoS value 6 maps to DSCP value 48
- CoS value 7 maps to DSCP value 56
To verify your mapping, you can use the show mls qos maps
command:
show mls qos maps
This will display the current CoS to DSCP mappings among other QoS mappings.
For these configurations to take effect, you also need to enable QoS globally on the switch using the mls qos
command.
Links:
https://forum.networklessons.com/t/ip-precedence-and-dscp-values/1135/95?u=lagapides
https://networklessons.com/quality-of-service/how-to-configure-qos-trust-boundary-on-cisco-switches