Cisco VLAN configuration becomes easier when you practice it as a complete lab: create VLANs, assign access ports, configure an 802.1Q trunk, verify forwarding, and troubleshoot common mistakes. This guide complements our conceptual VLAN introduction by focusing on hands-on switch configuration.
VLAN Lab Topology
Use two Cisco switches connected through a trunk. Connect one PC in VLAN 10 and one PC in VLAN 20 on each switch. Devices in the same VLAN should communicate across the trunk, while communication between VLANs requires a router or multilayer switch.
Step 1: Create and Name VLANs
enable
configure terminal
vlan 10
name STAFF
vlan 20
name SALES
vlan 99
name MANAGEMENT
end
Create the required VLANs on every switch that must forward their traffic. A VLAN missing from one switch can interrupt connectivity even when the trunk is operational.
Step 2: Configure Access Ports
configure terminal
interface range gigabitEthernet 0/1 - 2
switchport mode access
switchport access vlan 10
spanning-tree portfast
exit
interface range gigabitEthernet 0/3 - 4
switchport mode access
switchport access vlan 20
spanning-tree portfast
end
Use PortFast only on appropriate edge ports connected to endpoints. Do not apply it carelessly to links where switches may appear.
Step 3: Configure the Trunk
configure terminal
interface gigabitEthernet 0/24
description TRUNK_TO_SW2
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan 10,20,99
no shutdown
end
Configure the other end with matching native and allowed VLAN settings. Native-VLAN mismatches can produce warnings and unexpected forwarding behavior.
Step 4: Verify the VLANs
show vlan briefβ checks VLAN existence and access-port membership.show interfaces trunkβ checks trunk operation, native VLAN, and allowed VLANs.show interfaces switchportβ shows administrative and operational switchport settings.show mac address-table dynamicβ confirms MAC learning by VLAN and interface.show spanning-tree vlan 10β checks forwarding state and the root path.
Step 5: Test Connectivity
Assign IP addresses from the same subnet to endpoints in the same VLAN. Test local connectivity first, then test across the trunk. If same-VLAN communication succeeds but different-VLAN communication fails, confirm that inter-VLAN routing is configured.
Common VLAN Troubleshooting Scenarios
Access Port in the Wrong VLAN
Compare the intended design with show vlan brief and show interfaces switchport. Correct the access VLAN and verify the endpoint address.
VLAN Missing from the Trunk
Use show interfaces trunk. Confirm the VLAN exists locally and appears in the allowed and forwarding lists.
Trunk Not Forming
Check interface status and the configured switchport mode on both ends. Confirm the connection uses the intended interfaces and no physical error is present.
Native VLAN Mismatch
Configure the same native VLAN on both trunk endpoints. Review neighbor messages and trunk output after correcting the mismatch.
No Inter-VLAN Communication
Verify switched virtual interfaces or router subinterfaces, gateway addresses, Layer 3 routing, access lists, and interface status.
Save the Configuration
copy running-config startup-config
Save only after verifying that the lab operates as expected.
Frequently Asked Questions
Do VLANs need to exist on both switches?
Yes, when both switches must carry or use those VLANs and no supported VLAN-distribution mechanism creates them automatically.
Can two different VLANs use the same IP subnet?
Normal design maps each VLAN to a separate subnet to maintain clear Layer 2 and Layer 3 boundaries.
Where can I practice more switching questions?
Review our CCNA interview questions and answers. For focused preparation, see the Cisco 200-301 Premium PDF with the latest available questions and answers.
CiscoForAll provides independent study and practice material. Always use official Cisco documentation as a primary preparation source.