Assigning VLANs to Switch Ports
After creating VLANs, the next critical step is to assign switch ports to those VLANs. Until a port is assigned, it remains in VLAN 1 by default.
1. Assign a Single Port to a VLAN
Explanation
Access ports are used to connect end devices such as PCs, printers, and IP phones. Each access port belongs to only one VLAN.
In this example, we assign FastEthernet0/1 to VLAN 10.
Cisco Prompt Commands
Configuring an Access Port for VLAN 10
NetsTuts_SW1#conf t NetsTuts_SW1(config)#interface FastEthernet0/1 NetsTuts_SW1(config-if)#switchport mode access NetsTuts_SW1(config-if)#switchport access vlan 10 NetsTuts_SW1(config-if)#end
The above commands configure a switch port as an access port and assign it to VLAN 10:
-
interface FastEthernet0/1
Enters interface configuration mode for port FastEthernet 0/1, allowing you to configure settings specific to that physical port. -
switchport mode access
Sets the port to access mode, meaning it can carry traffic for only one VLAN. This mode is typically used when connecting end devices such as PCs, printers, or IP phones. -
switchport access vlan 10
Assigns the port to VLAN 10. Any device connected to this port will become part of VLAN 10, and all incoming and outgoing traffic will be associated with that VLAN.
In summary, these commands configure FastEthernet0/1 as a standard access port and place it into VLAN 10, allowing connected devices to communicate within that VLAN.
Verify with "show running-config" command
!
interface FastEthernet0/1
switchport access vlan 10
switchport mode access
!
Verify with "show vlan brief" command
NetsTuts_SW1#sho vla bri
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, Gig0/1
Gig0/2
10 VLAN0010 active Fa0/1
20 VLAN0020 active
30 SALES active
40 HR active
50 IT active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
NetsTuts_SW1#
2. Assign Multiple Ports to a VLAN
When multiple devices belong to the same department, assigning ports individually
is inefficient. Cisco IOS provides the interface range command.
This example assigns FastEthernet0/2 to FastEthernet0/10 to VLAN 20.
Cisco Prompt Commands
NetsTuts_SW1#conf t
NetsTuts_SW1(config)#interface range FastEthernet0/2 - 10
NetsTuts_SW1(config-if-range)#switchport mode access
NetsTuts_SW1(config-if-range)#switchport access vlan 20
NetsTuts_SW1(config-if-range)#end
Verify with "show vlan brief" command
NetsTuts_SW1#sho vla bri
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active 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, Gig0/1, Gig0/2
10 VLAN0010 active Fa0/1
20 VLAN0020 active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10
30 SALES active
40 HR active
50 IT active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
As you can see, multiple ports are assigned to a single VLAN.
3. Assign VLAN with Port Description
Explanation
Adding interface descriptions improves documentation and simplifies troubleshooting in enterprise environments.
Cisco Prompt Commands
NetsTuts_SW1#conf t
NetsTuts_SW1(config)#interface FastEthernet0/11
NetsTuts_SW1(config-if)#description SALES-PC-01
NetsTuts_SW1(config-if)#switchport mode access
NetsTuts_SW1(config-if)#switchport access vlan 30
NetsTuts_SW1(config-if)#end
Verify with "show running-config" command
!
interface FastEthernet0/11
description SALES-PC-01
switchport access vlan 30
switchport mode access
!
Voice VLAN Overview
A Voice VLAN is a specialized VLAN used to separate voice traffic from data traffic on the same physical switch port. This design is commonly used in enterprise networks where an IP phone and a PC share one Ethernet connection.
Voice traffic is tagged with a dedicated VLAN ID and given higher priority, ensuring clear and uninterrupted calls. Data traffic from the connected PC remains untagged and is handled as normal access traffic. This separation improves Quality of Service (QoS), enhances security, and simplifies network cabling.
- VLAN 40 Data
- VLAN 100 Voice
Cisco Prompt Commands
NetsTuts_SW1#conf t
NetsTuts_SW1(config)#interface FastEthernet0/12
NetsTuts_SW1(config-if)#switchport mode access
NetsTuts_SW1(config-if)#switchport access vlan 40
NetsTuts_SW1(config-if)#switchport voice vlan 100
NetsTuts_SW1(config-if)#end
Verify with "show running-config" command
!
interface FastEthernet0/12
switchport mode access
switchport access vlan 40
switchport voice vlan 100
!
Verifying VLAN membership and associated switch ports.
NetsTuts_SW1#sho vla bri
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig0/1, Gig0/2
10 VLAN0010 active Fa0/1
20 VLAN0020 active Fa0/2, Fa0/3, Fa0/4, Fa0/5
Fa0/6, Fa0/7, Fa0/8, Fa0/9
Fa0/10
30 SALES active Fa0/11
40 HR active Fa0/12
100 VLAN0100 active Fa0/12
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active