L2 QoS lab with DSCP mutation map and QoS port
The dscp mutation map is a per-port configuration that permits to modify the dscp field of a packet. The mutation map works for EGRESS traffic only
We trust the documentation but it's event better to verify it.
The topology si simple:
PC1 11.0.0.1 --> G1/0/1 C3750-24 G1/0/24 --> G1/0/24 C3750-48 G1/0/1 --> PC2 11.0.0.2 running wireshark
First step: turn on QOS on both switches with the command
mls qos
Then on C3750-24 port G1/0/1 we set COS to 5:
interface GigabitEthernet1/0/1
description PC1
mls qos cos 5
mls qos cos override
Let's check the statistics of the port:
C3750-24#sh mls qos interface g1/0/1 statistics
------------ cut -------------
cos: incoming
-------------------------------
0 - 4 : 0 0 0 0 0
5 - 7 : 20 0 0
----------- cut --------------
As expected we are receiving packets with COS = 5
Whats going out of C3750-24 port G1/0/24 facing the other switch?
dscp: outgoing
-------------------------------
40 - 44 : 167
cos: outgoing
-------------------------------
5 - 7 : 168
Packets form PC1 are being sent with COS = 5 and DSCP = 40
Why DSCP = 40? Because the default cos-dscp map is applied:
C3750-24#sh mls qos maps cos-dscp
Cos-dscp map:
cos: 0 1 2 3 4 5 6 7
--------------------------------
dscp: 0 8 16 24 32 40 48 56
What's received on switch C3750-48 port G1/0/24 if we trust COS on the port?
C3750-48(config)#inte g1/0/24
C3750-48(config-if)#mls qos trust cos
cos: incoming
-------------------------------
0 - 4 : 83 0 0 0 0
5 - 7 : 0 0 0
We receive only COS = 0. The reason is we're working with VLAN 1 thats is untagged on the port, COS value exists in the dot1q header so no header means no COS.
What about DSCP?
dscp: incoming
-------------------------------
40 - 44 : 60
We receive DSCP = 40, since the value exists in the IP header.
What if we tag the native vlan in the trunk between the two switches?
On both switches:
vlan dot1q tag native
cos: incoming
----------------------
5 - 7 : 53 0 0
Now we're receiving COS = 5 and DSCP = 40.
Check the DSCP value of the packets sent from PC1 and received by PC2:
DSCP value is hex 28 that is decimal 40.
Verify on C3750-48 G1/0/1 port statistics:
dscp: outgoing
-------------------------------
40 - 44 : 80 0 0 0 0
Everything worked as expected until now.
Now let's create and apply a DSCP mutation map on the port connected to PC2. We remap DSCP 40 to DSCP 46:
C3750-48(config)#mls qos map dscp-mutation 40to46 40 to 46
C3750-48(config)#inte g1/0/1
C3750-48(config-if)#mls qos dscp-mutation 40to46
Check again if on PC2 we are receiving packest with DSCP 46 instead of 40 from PC1.
Something's wrong: we're still getting DSCP hex 28, decimal 40.
The command reference guide says that DSCP mutation map works egress on the interface right? But what if we apply the dscp mutation map to port G1/0/24 instead?
We're getting the correct DSCP hex 2E, decimal 46 now.
What's on the statistics of port G1/0/24?
dscp: incoming
-------------------------------
40 - 44 : 60
On port G1/0/1 to PC2:
dscp: outgoing
-------------------------------
45 - 49 : 0 122
So the dscp mutation map is applied for egress packets but the command must be applied to the port where packets are coming in, not where they're going out.