VLAN Concepts and Configuration
After the IP phone has received power, it must determine its VLAN assignment. Because of security risks associated with having data and voice devices on the same network, Cisco recommends isolating IP phones in VLANs dedicated to voice devices. To understand how to implement this recommendation, let's first review a few key VLAN concepts.
VLAN Review
When VLANs were introduced a number of years ago, the concept was so radical and beneficial that it was immediately adopted into the industry. Nowadays, it is rare to find any reasonably sized network that is not using VLANs in some way.
VLANs allow you to break up switched environments into multiple broadcast domains. Here is the basic summary of a VLAN:
A VLAN = A Broadcast Domain = An IP Subnet
There are many benefits to using VLANs in an organization, some of which include the following:
- Increased performance: By reducing the size of the broadcast domain, network devices run more efficiently.
- Improved manageability: The division of the network into logical groups of users, applications, or servers allows you to understand and manage the network better.
- Physical topology independence: VLANs allow you to group users regardless of their physical location in the campus network. If departments grow or relocate to a new area of the network, you can simply change the VLAN on their new ports without making any physical network changes.
- Increased security: A VLAN boundary marks the end of a logical subnet. To reach other subnets (VLANs), you must pass through a routed (Layer 3) device. Any time you send traffic through a router, you have the opportunity to add filtering options (such as access lists) and other security measures.
VLAN Trunking/Tagging
VLANs are able to transcend individual switches, as shown in Figure 3-4.
Figure 3-4 VLANs Move Between Switches
If a member of VLAN_GRAY sends a broadcast message, it goes to all VLAN_GRAY ports on both switches. The same holds true for VLAN_WHITE. To accommodate this, the connection between the switches must carry traffic for multiple VLANs. This type of port is known as a trunk port.
Trunk ports are often called tagged ports because the switches send frames between each other with a VLAN "tag" in place. Figure 3-5 illustrates the following process:
- HostA (in VLAN_GRAY) wants to send data to HostD (also in VLAN_GRAY). HostA transmits the data to SwitchA.
- SwitchA receives the data and realizes that HostD is available through the FastEthernet 0/24 port (because HostD's MAC address has been learned on this port). Because FastEthernet 0/24 is configured as a trunk port, SwitchA puts the VLAN_GRAY tag in the IP header and sends the frame to SwitchB.
- SwitchB processes the VLAN_GRAY tag because the FastEthernet 0/24 port is configured as a trunk. Before sending the frame to HostD, the VLAN_GRAY tag is removed from the header.
- The tagless frame is sent to HostD.
Figure 3-5 VLAN Tags
Using this process, the PC never knows what VLAN it belongs to. The VLAN tag is applied when the incoming frame crosses a trunk port. The VLAN tag is removed when exiting the port to the destination PC. Always keep in mind that VLANs are a switching concept; the PCs never participate in the VLAN tagging process.
VLANs are not a Cisco-only technology. Just about all managed switch vendors support VLANs. In order for VLANs to operate in a mixed-vendor environment, a common trunking or "tagging" language must exist between them. This language is known as 802.1Q. All vendors design their switches to recognize and understand the 802.1Q tag, which is what allows us to trunk between switches in any environment.
Understanding Voice VLANs
It is a common and recommended practice to separate voice and data traffic by using VLANs. There are already easy-to-use applications available, such as Wireshark and Voice Over Misconfigured Internet Telephones (VOMIT), that allow intruders to capture voice conversations on the network and convert them into WAV data files. Separating voice and data traffic using VLANs provides a solid security boundary, preventing data applications from reaching the voice traffic. It also gives you a simpler method to deploy QoS, prioritizing the voice traffic over the data.
One initial difficulty you can encounter when separating voice and data traffic is the fact that PCs are often connected to the network using the Ethernet port on the back of a Cisco IP Phone. Because you can assign a switchport to only a single VLAN, it initially seems impossible to separate voice and data traffic. That is, until you see that Cisco IP Phones support 802.1Q tagging.
The switch built into Cisco IP Phones has much of the same hardware that exists inside of a full Cisco switch. The incoming switchport is able to receive and send 802.1Q tagged packets. This gives you the capability to establish a type of trunk connection between the Cisco switch and IP phone, as shown in Figure 3-6.
Figure 3-6 Separating Voice and Data Traffic Using VLANs
You might call the connection between the switch and IP phone a "mini-trunk" because a typical trunk passes a large number of VLANs (if not all VLANs). In this case, the IP phone tags its own packets with the correct voice VLAN (VLAN 25, in the case of Figure 3-6). Because the switch receives this traffic on a port supporting tagged packets (our mini-trunk), the switch can read the tag and place the data in the correct VLAN. The data packets pass through the IP phone and into the switch untagged. The switch assigns these untagged packets to whatever VLAN you have configured on the switchport for data traffic.
VLAN Configuration
Configuring a Cisco switch to support Voice VLANs is a fairly simple process. First, you can add the VLANs to the switch, as shown in Example 3-1.
Example 3-1. Adding and Verifying Data and Voice VLANs
Switch#configure terminal
Switch(config)#vlan 10
Switch(config-vlan)#name VOICE
Switch(config-vlan)#vlan 50
Switch(config-vlan)#name DATA
Switch(config-vlan)#end
Switch#show vlan brief
VLAN Name
Status
Ports
---- -------------------------------- --------- -------------------------------
1
default
active
Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10, Fa0/11, Fa0/12, Fa0/13
Fa0/14, Fa0/15, Fa0/16, Fa0/17
Fa0/18, Fa0/19, Fa0/20, Fa0/21
Fa0/22, Fa0/23, Fa0/24, Gi0/1
Gi0/2
10
VOICE
active
50
DATA
active
1002 fddi-default
act/unsup
1003 token-ring-default
act/unsup
1004 fddinet-default
act/unsup
1005 trnet-default
act/unsup
Sure enough, VLANs 10 (VOICE) and 50 (DATA) now appear as valid VLANs on the switch. Now that the VLANs exist, you can assign the ports attaching to Cisco IP Phones (with PCs connected to the IP Phone) to the VLANs, as shown in Example 3-2.
Example 3-2. Assigning Voice and Data VLANs
Switch#configure terminal
Switch(config)#interface range fa0/2 - 24
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#spanning-tree portfast
Switch(config-if-range)#switchport access vlan 50
Switch(config-if-range)#switchport voice vlan 10
Switch(config-if-range)#end
Switch#show vlan brief
VLAN Name
Status
Ports
---- -------------------------------- --------- -------------------------------
1
default
active
Gi0/1, Gi0/2
10 VOICE active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9 Fa0/10, Fa0/11, Fa0/12, Fa0/13 Fa0/14, Fa0/15, Fa0/16, Fa0/17 Fa0/18, Fa0/19, Fa0/20, Fa0/21 Fa0/22, Fa0/23, Fa0/24
50 DATA active Fa0/2, Fa0/3, Fa0/4, Fa0/5 Fa0/6, Fa0/7, Fa0/8, Fa0/9 Fa0/10, Fa0/11, Fa0/12, Fa0/13 Fa0/14, Fa0/15, Fa0/16, Fa0/17 Fa0/18, Fa0/19, Fa0/20, Fa0/21 Fa0/22, Fa0/23, Fa0/24 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup
The ports are now configured to support a voice VLAN of 10 and a data VLAN of 50. This syntax is a newer form of configuration for IP Phone connections. In the "old days," you would configure the interface as a trunk port because the switch was establishing a trunking relationship between it and the IP phone. This was less secure because a hacker could remove the IP phone from the switchport and attach their own device (another managed switch or PC) and perform a VLAN-hopping attack. The more modern syntax configures the port as a "quasi-access port," because an attached PC will be able to access only VLAN 50. Only an attached Cisco IP Phone will be able to access the voice VLAN 10.