QoS implementation can occur at both Layer 2 and Layer 3, and also work in conjunction to provide end-to-end QoS for services on the network. QoS implementation at Layer 2 is known as class of service (CoS). A Layer 2 device, such as a Catalyst switch, will provide preferential treatment for traffic that has higher Layer 2 CoS settings.
Packets are given priority based on their CoS value. The CoS values range from 0 to 7, with 7 as the highest priority level. The CoS resides inside the IEEE 802.1Q and Inter-Switch Link (ISL) headers. The three most significant bits in the 4-byte Tag field in IEEE 802.1Q are used for CoS. In the ISL header, the three least significant bits in the 1-byte User field carry the CoS value. Chapter 4, "Layer 2 Fundamentals," can be referenced for detailed discussion on the format of IEEE 802.1Q and Cisco ISL frames.
A network administrator can set, for example, voice traffic with a higher CoS value as the voice traffic passes through the switch. If this configuration is not made, the voice traffic on the switch will not be given preferential treatment by the switch and, as a result, will have to compete for bandwidth and incur latency similar to other nonpriority traffic. In other words, for QoS implementation to be effective, QoS requires both Layer 2 and Layer 3 device configuration.