CCNA Lab 2: VLANs, Trunking, and Layer 2 Fundamentals
VLANs are the backbone of any switched network. A single misconfiguration can take down an entire segment.
A VLAN (Virtual LAN) is a logical subgroup within a Layer 2 network. Devices in the same VLAN see each otherβs broadcasts; devices in different VLANs do not. This segments broadcast domains without adding physical switches.
vlan 10
name DATA
vlan 20
name VOICE
vlan 30
name MANAGEMENT
vlan 99
name NATIVEVLAN 1 exists by default. Never use VLAN 1 for user traffic β it is the default management VLAN and a security risk.
interface GigabitEthernet0/1
switchport mode access
switchport access vlan 10
spanning-tree portfastPortfast forces the port into forwarding state immediately, skipping STP listening/learning. Use it only on access ports connected to end devices β never on trunk ports.
interface range GigabitEthernet0/1-24
switchport mode access
switchport access vlan 10Trunks carry multiple VLANs between switches:
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan 10,20,30,99The native VLAN carries untagged traffic on the trunk. Both ends must match:
switchport trunk native vlan 99A native VLAN mismatch causes traffic to leak between VLANs β one of the most common and dangerous misconfigurations.
Restrict the trunk to only the VLANs you need:
switchport trunk allowed vlan 10,20,30,99VTP propagates VLAN information across the network. It is useful in large environments but dangerous if misused.
vtp mode transparentBest practice: set every switch to VTP transparent or disable VTP entirely. VTP server/client mode can wipe VLAN databases across your entire network if a switch with a higher revision number joins.
To reset VTP revision:
delete vlan.dat
reloadshow vlan brief
show vlan id 10
show interfaces trunk
show interfaces switchport
show interfaces status
show running-config | section interface| Issue | Symptom | Fix |
|---|---|---|
| Native VLAN mismatch | Traffic leaking between VLANs | Match native VLAN on both trunk ends |
| Trunk allowed VLAN missing | No connectivity across trunk | Add VLAN to allowed list |
| Port not in correct VLAN | Device canβt reach gateway | Check switchport access vlan |
| VTP revision too high | VLAN database wiped | Set VTP transparent, delete vlan.dat |
Missing switchport mode trunk | Port stays in DTP dynamic mode | Explicitly set mode trunk |
| STP blocking port | No link but port is up | Check STP topology, root bridge placement |
STP prevents loops in redundant topologies:
spanning-tree vlan 1 root primary
spanning-tree vlan 10 root primaryVerify:
show spanning-tree
show spanning-tree rootWhen a switch port is flapping (up/down/up/down):
# On the switch
show log | include down
interface Gi0/5
shutdown
description DISABLED - flapping port
end
wrswitchport nonegotiateswitchport port-security on access ports when neededRelated Articles
CCNA Lab 2: VLANs, Trunking, and Layer 2 Fundamentals
Configure VLANs, trunk ports, VTP, and troubleshoot common Layer 2 issues on Cisco switches. Practical lab scenarios included.
CCNA Lab 1: Switch Initial Configuration and Hostnames
Step-by-step guide to configuring hostnames, banners, passwords, and SSH on Cisco switches β the foundation every network engineer needs.
CCNA Lab 11: EtherChannel and Link Aggregation
Configure and troubleshoot EtherChannel on Cisco switches β LACP, PAgP, load balancing, and common failure modes.