The IEEE 802.1Q specification defines a standards-based mechanism not only to provide VLAN tagging but also for Class of Service (CoS) across Ethernet networks.
Because the sound quality of an IP phone call can deteriorate if the data is sent without any sort of protection, the switch supports Quality of Service (QoS) based on IEEE 802.1p CoS. QoS uses classification and scheduling to send network traffic from the switch in a predictable manner.
The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. Also important is making sure that providing priority for one or more flows does not make other flows fail.
This is accomplished through an additional 4 byte tag, which carries VLAN and frame prioritization information, inserted within the header of a Layer 2 Ethernet frame, as mentioned previously. Inside the 4 byte tag as you can see in the figure, we can find several different fields. The field we are focusing on for Voice VLANs is the Priority Code Point (PCP).
Priority Code Point (PCP): A 3-bit field that indicates the frame priority level.
The operation of the three bits of the PCP field is defined within the IEEE 802.1p standard, which is within the 802.1Q tag. The 802.1p and 802.1Q standards, therefore, work together to hasten traffic capabilities at the Data Link Layer.
Configuration command string to select the voice VLAN mode that will be used:
To configure the IP phone uplink, just configure the switch port where the phone connects. The switch instructs the phone to follow the mode that is selected. In addition, the switch port does not need any special trunking configuration commands if a trunk is wanted. If an 802.1Q trunk is needed, a special-case trunk is automatically negotiated by the Dynamic Trunking Protocol (DTP) and CDP.
Switch(config-if)# switchport voice vlan {vlan-id | dot1p | untagged | none}
Configure a port connected to a Cisco IP Phone to use the CoS value to classify incoming traffic, to use 802.1p priority tagging for voice traffic, and to use the default native VLAN (VLAN 0) to carry all traffic:
Configuration
Switch# configure terminal Switch(config)# interface gigabitethernet1/0/1 Switch(config-if)# mls qos trust cos Switch(config-if)# switchport voice vlan dot1p Switch(config-if)# end
Enable switchport voice detect on a Cisco IP Phone:
Switch# configure terminal Switch(config)# interface fastethernet 0/1 Switch(config-if)# switchport voice? detect detection enhancement keyword vlan VLAN for voice traffic Switch(config-if)# switchport voice detect? cisco-phone Cisco IP Phone Switch(config-if)# switchport voice detect cisco-phone? full-duplex Cisco IP Phone Switch(config-if)# switchport voice detect cisco-phone full-duplex full-duplex full duplex keyword Switch(config-if)# end