
The voice VLAN feature enables access ports to carry IP voice traffic from an IP phone. When a switch is connected to a Cisco IP phone, the IP phone sends voice traffic with Layer 3 precedence and Layer 2 class of service (CoS) values, which are both set to 5 for voice traffic; all other traffic defaults to 0.
Because the sound quality of an IP phone call can deteriorate if the data is unevenly sent, the switch supports the quality of service (QoS) based on IEEE 802.1p CoS. (802.1p provides a mechanism for implementing QoS at the MAC level.) The 802.1p field is carried in the 802.1Q trunk header. If you look at the fields in an 802.1Q tag, you will see a field called the priority field; this is where the 802.1p information goes. QoS uses classification and scheduling to send network traffic from the switch in an organized, predictable manner.
The Cisco IP phone is a configurable device, and you can configure it to forward traffic with an IEEE 802.1p priority. You can also configure the switch to either trust or override the traffic priority assigned by an IP phone which is exactly what we’re going to do. The Cisco phone basically has a three-port switch; one to connect to the Cisco switch, one to a PC device, and one to the actual phone which is internal.
You can also configure an access port with an attached Cisco IP phone to use one VLAN for voice traffic and another VLAN for data traffic from a device attached to the phone like a PC. You can configure access ports on the switch to send Cisco Discovery Protocol (CDP) packets that instruct an attached Cisco IP phone to send voice traffic to the switch in any of these ways:
- In the voice VLAN tagged with a Layer 2 CoS priority value
- In the access VLAN tagged with a Layer 2 CoS priority value
- In the access VLAN untagged (no Layer 2 CoS priority value)
The switch can also process tagged data traffic (traffic in IEEE 802.1Q or IEEE 802.1p frame types) from the device attached to the access port on the Cisco IP phone. You can configure layer 2 access ports on the switch to send CDP packets that instruct the attached Cisco IP phone to configure the IP phone access port in one of these modes.
In trusted mode, all traffic received through the access port on the Cisco IP Phone passes through the IP phone unchanged.
In untrusted mode, all traffic in IEEE 802.1Q or IEEE 802.1p frames received through the access port on the IP phone receive a configured Layer 2 CoS value. The default layer 2 CoS value is 0. The untrusted mode is the default.
Configuring the Voice VLAN
By default, the voice VLAN feature is disabled; you enable it by using the interface command switchport voice vlan. When the voice VLAN feature is enabled, all untagged traffic is sent according to the default CoS priority of the port. The CoS value is not trusted for IEEE 802.1p or IEEE 802.1Q tagged traffic.
These are the voice VLAN configuration guidelines:
- You should configure voice VLAN on switch access ports; voice VLAN isn’t supported on trunk ports, even though you can actually configure it.
- The voice VLAN should be present and active on the switch for the IP phone to correctly communicate on it. Use the show vlan privileged EXEC command to see if the VLAN is present if it is, it’ll be listed in the display.
- Before you enable the voice VLAN, it’s recommended that you enable QoS on the switch y entering the mls qos global configuration command and set the port trust state to trust by entering the mls qos trust cos interface configuration command.
- You must make sure that CDP is enabled on the switch port connected to the Cisco IP phone to send the configuration. This is on by default, so unless you disable it, you shouldn’t have a problem.
- The PortFast feature is automatically enabled when the voice VLAN is configured, but when you disable the voice VLAN, the PortFast feature isn’t automatically disabled.
- To return the port to its default setting, use the no switch port voice vlan interface configuration command.
Configuring IP Phone Voice Traffic
You can configure a port connected to the Cisco IP phone to send CDP packets to the phone to configure the way in which the phone sends voice traffic. The phone can carry voice traffic in IEEE 802.1Q frames for a specified voice VLAN with a Layer 2 CoS value. It can use IEEE 802.1p priority tagging to give voice traffic a higher priority as well as forward all voice traffic through the native (access) VLAN. The IP phone can also send untagged voice traffic, or use its own configuration to send voice traffic in the access VLAN. In all configuration, the voice traffic carries a Layer 3 IP precedence value again, for voice the setting is usually 5.
We think it’s about time to give you some actual examples to make this clear to you. This example shows you how to configure four things:
- How to configure a port connected to an IP phone to use the CoS value for classifying incoming traffic.
- How to configure the port to use IEEE 802.1p priority tagging for voice traffic
- How to configure it to use the Voice VLAN (10) to carry all voice traffic.
- And last, how to configure VLAN 3 to carry PC data.
Switch#configure t
Switch(config)#mls qos
Switch(config)#interface f0/1
Switch(config-if)#switchport priority extend ?
Cos override 802.1p priority of devices on appliance Trust 802.1p priorities of devices on appliance
Switch(config-if)#switchport priority extend trust
Switch(config-if)#mls qos trust cos
Switch(config-if)#switchport voice vlan dot1p
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 3
Switch(config-if)#switchport voice vlan 10
The command mls qos trust cos will configure the interface to classify incoming traffic packets by using the packet CoS value. For untagged packets, the port’s default CoS value will be used. But before configuring the port trust state, you must globally enable QoS by using the mls qos global configuration command.
Notice how we added two access VLANs to the same port? We can only do this if we have one for data VLAN and another one for a voice VLAN.