Classification and Marking on Cisco Switch

When you are configuring QoS on your Cisco switches you are probably familiar with the concept of “trust boundaries”. If not, take a look at this lesson that I wrote earlier that explains the concept and teaches you how to trust markings or (re)mark packets or Ethernet frames.

Using the mls qos trust command we can trust the Cos or DSCP value or an IP phone. With the mls qos cos command we can set a new CoS value if we like. The downside of these two commands is that it applies to all packets or Ethernet frames that arrive on the FastEthernet 0/1 interface. What if we wanted to be a bit more specific? Let me show you an example:

small-network-with-switch-and-router

Above you see a small network with a server, switch and a router connected to a WAN. Let’s imagine the server is running a couple of applications:

  1. SSH server.
  2. Mail server.
  3. MySQL server.

What if the server is unable to mark its own IP packets with a DSCP value but we want to prioritize SSH traffic on the router when it leaves the serial 0/0 interface? In that case we’ll have to do classification and marking ourselves. I will show you how to do this on a Cisco catalyst switch. You can use a standard, extended or MAC access-list in combination with MQC (Modular QoS Configuration) to get the job done.

Let’s start with the standard access-list to classify traffic from the server. Since a standard access-list can only match on source IP addresses I will be unable to differentiate between different applications…

SW1(config)#class-map match-all SERVER
SW1(config-cmap)#match access-group 1

We’ll use a class-map to select our traffic. I will refer to access-list 1 with the match command.

SW1(config)#access-list 1 permit 192.168.1.1

Access-list 1 will match IP address 192.168.1.1. This is the classification part but we still have to mark our traffic. This is done with a policy-map:

SW1(config)#policy-map SET-DSCP-SERVER
SW1(config-pmap)#class SERVER
SW1(config-pmap-c)#set ip dscp 40

Above I created a policy map called “SET-DSCP-SERVER” and i’m referring to the class-map “SERVER” that I created before. Using the set command I will set the DSCP value to 40. Now I am almost done, I still need to activate this policy map on the interface:

SW1(config)#interface FastEthernet 0/1
SW1(config-if)#service-policy input SET-DSCP-SERVER

This is how you activate it on the interface. Use the service-policy command and you can use the input or output keyword to apply it to inbound or outbound traffic. If you want to verify your configuration and see if traffic is being marked you can use the following command:

SW1#show policy-map interface FastEthernet 0/1
 FastEthernet0/1
 
Service-policy input: SET-DSCP-SERVER
 Class-map: SERVER (match-all)
 0 packets, 0 bytes
 5 minute offered rate 0 bps, drop rate 0 bps
 Match: access-group 1

Class-map: class-default (match-any)
 0 packets, 0 bytes
 5 minute offered rate 0 bps, drop rate 0 bps
 Match: any
 0 packets, 0 bytes
 5 minute rate 0 bps

Above you can see that the policy-map has been applied to the FastEthernet0/1 interface and even better, you can see the number of packets that have matched this policy-map and class-map. At the moment there are 0 packets (nothing is connected to my switch at the moment).  You can also see the class-default class. All traffic that doesn’t belong to a class-map will belong to the class-default class.

The example above is nice to demonstrate the class-map and policy-map but I was only able to match on the source IP address because of the standard access-list. Let me show you another example that will only match on SSH traffic using an extended access-list:

SW1(config)#class-map SSH
SW1(config-cmap)#match access-group 100

First i’ll create a class-map called SSH that matches access-list 100. Don’t forget to create the access-list:

SW1(config)#access-list 100 permit tcp host 192.168.1.1 eq 22 any

Access-list 100 will match source IP address 192.168.1.1 and source port 22 (SSH). Now we’ll pull it all together with the policy-map:

We're Sorry, Full Content Access is for Members Only...

If you like to keep on reading, Become a Member Now! Here is why:

  • Learn any CCNA, CCNP and CCIE R&S Topic. Explained As Simple As Possible.
  • Try for Just $1. The Best Dollar You've Ever Spent on Your Cisco Career!
  • Full Access to our 660 Lessons. More Lessons Added Every Week!
  • Content created by Rene Molenaar (CCIE #41726)

510 Sign Ups in the last 30 days

satisfaction-guaranteed
100% Satisfaction Guaranteed!
You may cancel your monthly membership at any time.
No Questions Asked!

Forum Replies

  1. Jose,
    Great to hear–we are thrilled to have you aboard! I hope you will learn a lot.

    --Andrew

  2. Hi Rohini,

    For any non-Cisco phones, you can use mls qos trust cos to use the CoS marking that the phone sends.

    You also might want to look at LLDP, it’s an alternative to CDP which is supported by a couple of vendors.

    Rene

  3. Steve,
    MLS QOS is an older platform method of QOS implementation. In your case, your 3850 switch is much newer, and uses the “modular quality of service command line interface (MQC)” architecture instead of the MLS one.

    This basically means that implementing QoS on your newer switch is pretty much just like implementing QoS on a router. In retrospect, it was kind of dumb for Cisco to have different syntax for a router vs a switch.

    You might want to check out the network lesson on QoS Marking to get started. There are quite a few network lessons on QoS here.

    ... Continue reading in our forum

  4. Hi Rene/ Andrew,

    I have Cisco 7600 router, i try to mark the incoming traffic with DSCP63, the packet looks mark with DSCp63 when show policy map interface.

    But when the traffic forward out the port with policy map, i match the ip with dscp 63, seem it can’t match anything.

    Can you please advise.

    Thanks

    Davis

  5. sorry Dordrecht not Denmark I guess that’s in the Netherlands. Now that I am doing networking I will be taking my first trip out of the USA and I will have to travel to all these branch offices all over Europe. Norway, France, Itally, Netherlands and more so that’s going to be a big experience to me as well as I basically was just a country boy from the US that’s never really been anywhere lol. My world geography knowledge is crappy I am going to have to get better at it.

61 more replies! Ask a question or join the discussion by visiting our Community Forum