3.4 6 Lab Configure VLANs and Trunking
Introduction to VLANs and Trunking in Network Labs
In modern networking environments, VLANs (Virtual Local Area Networks) and trunking are foundational concepts that enable efficient network segmentation and seamless communication across multiple VLANs. Now, this lab focuses on configuring VLANs and trunking on Cisco switches, simulating a real-world scenario where network administrators must organize devices into logical broadcast domains while allowing inter-VLAN communication through trunk links. Understanding how to properly configure these features is critical for optimizing network performance, enhancing security, and simplifying management in enterprise networks.
This hands-on lab will guide you through creating VLANs, assigning switch ports to specific VLANs, and configuring trunk ports to carry traffic for multiple VLANs between switches. By the end of this exercise, you will have a solid grasp of VLAN implementation and trunking protocols, preparing you for more advanced network design challenges.
Lab Topology and Prerequisites
Before diving into configuration, it’s essential to understand the lab setup. Worth adding: in this scenario, we will use two Cisco Catalyst switches (e. g., Catalyst 2960) connected via a trunk link.
- VLAN 10: Sales Department
- VLAN 20: Engineering Department
- VLAN 30: Management Department
Each VLAN will have its own subnet, and the trunk link will allow these VLANs to communicate across switches. The switches will be connected to a router or Layer 3 switch for inter-VLAN routing (though routing configuration is beyond the scope of this lab) It's one of those things that adds up..
Equipment Required:
- 2 x Cisco Catalyst 2960 switches
- 2 x PCs (assigned to different VLANs)
- Console access to both switches
- Cisco IOS image supporting VLAN and trunking features
Step-by-Step Configuration Process
Step 1: Create VLANs on Both Switches
Begin by entering global configuration mode and creating the required VLANs on Switch1:
Switch1> enable
Switch1# configure terminal
Switch1(config)# vlan 10
Switch1(config-vlan)# name Sales
Switch1(config-vlan)# exit
Switch1(config)# vlan 20
Switch1(config-vlan)# name Engineering
Switch1(config-vlan)# exit
Switch1(config)# vlan 30
Switch1(config-vlan)# name Management
Switch1(config-vlan)# exit
Repeat the same process on Switch2 to ensure VLAN consistency across both devices Not complicated — just consistent..
Step 2: Assign Switch Ports to VLANs
Next, assign physical switch ports to the appropriate VLANs. As an example, configure FastEthernet 0/1 and 0/2 for VLAN 10 (Sales), FastEthernet 0/3 and 0/4 for VLAN 20 (Engineering), and FastEthernet 0/5 for VLAN 30 (Management):
Switch1(config)# interface range fa0/1 - 2
Switch1(config-if-range)# switchport mode access
Switch1(config-if-range)# switchport access vlan 10
Switch1(config-if-range)# exit
Switch1(config)# interface range fa0/3 - 4
Switch1(config-if-range)# switchport mode access
Switch1(config-if-range)# switchport access vlan 20
Switch1(config-if-range)# exit
Switch1(config)# interface fa0/5
Switch1(config-if)# switchport mode access
Switch1(config-if)# switchport access vlan 30
Switch1(config-if)# exit
Repeat these assignments on Switch2, ensuring corresponding ports match the VLAN structure Turns out it matters..
Step 3: Configure Trunking Between Switches
The final step is to configure the link between the two switches as a trunk. This allows tagged traffic from all VLANs to traverse the connection. Use the following commands on both switches:
Switch1(config)# interface fa0/24
Switch1(config-if)# switchport mode trunk
Switch1(config-if)# switchport trunk allowed vlan 10,20,30
Switch1(config-if)# exit
On Switch2, apply the same configuration to the corresponding port (e.g., fa0/24):
Switch2(config)# interface fa0/24
Switch2(config-if)# switchport mode trunk
Switch2(config-if)# switchport trunk allowed vlan 10,20,30
Switch2(config-if)# exit
Note: The
switchport trunk allowed vlancommand restricts the VLANs carried on the trunk. If omitted, all active VLANs will be transmitted by default.
Step 4: Save Configuration and Verify Settings
Always save your configuration to prevent loss during reboots:
Switch1# copy running-config startup-config
Switch2# copy running-config startup-config
Verify VLAN assignments using:
Switch1# show vlan brief
Check trunk status with:
Switch1# show interfaces trunk
Ensure the trunk is operational and carrying the correct VLANs Took long enough..
Scientific Explanation: How VLANs and Trunking Work
VLANs logically segment a physical network into multiple broadcast domains, reducing collision domains and improving security. Each VLAN operates as a separate network layer, even though they share the same physical infrastructure. When a switch port is assigned to a VLAN, any device connected to that port belongs to the VLAN’s broadcast domain Which is the point..
Trunking, on the other hand, allows a single physical link to carry traffic for multiple VLANs. This is achieved through VLAN tagging (using the IEEE 802.1Q standard), which inserts a 4-byte tag into Ethernet frames to identify the VLAN membership of each packet. Without trunking, only one VLAN could traverse a link between switches, severely limiting network scalability.
The Dynamic Trunking Protocol (DTP) automates trunk negotiation, but manual configuration ensures predictable behavior. Using switchport mode trunk forces the port into trunk mode, bypassing DTP negotiation.
Common Issues and Troubleshooting
- VLAN Mismatch: Ensure both switches have identical VLAN IDs and names. Use
show vlan briefto compare configurations. - Trunk Not Active: