Class of Service (CoS) or Quality of Service (QoS) is a way to manage multiple traffic profiles over a network by giving certain types of traffic priority over others. For example you can give Voice traffic priority over email or http traffic. CoS is offered by service providers normally within an MPLS (Multi Protocol Label Switching) offering.
CoS is the classification of specific traffic (at layer 2) by manipulating the class of service bits (in the frame header). It effectively 'marks' the traffic so that QoS can use this identification/classification as a means to actually manipulate the traffic according to your policy. It is one way to identify traffic (along with ToS, ACLs, etc) so that QoS knows what to manipulate and how to manipulate.
Unlike QoS (Quality of Service) CoS does not offer guarantees with bandwidth or delivery time its based on a best effort basis.
There are three main CoS technologies:
802.1p Layer 2 Tagging
Type of Service (ToS)
Differentiated Services (DiffServ)
CoS Value Marking:
Marking a packet with a local CoS value allows users to associate a Layer 2 Class of Service value with a packet. The value can then be used to classify packets based on user-defined requirements. Layer 2 to Layer 3 mapping can also be configured by matching on the CoS value, since switches already have the capability to match and set CoS values. If a packet that needs to be marked to differentiate user-defined QoS services is leaving a router and entering a switch, the router should set the CoS value of the packet, since the switch can process the layer 2 CoS header marking.
The CoS value cannot be marked as part of an input traffic policy (which is attached to an interface using the "service-policy input" command). A CoS value marking can only be applied to output traffic policies (which are attached using the "service-policy output" command)
Configuring a CoS Value:
In the following example, a service policy called policy1 is created. This service policy is associated to a previously defined classification policy through the use of the class command. This example assumes that a classification policy called class1 was previously configured.
In the following example, the CoS value is set to 5.