Lab: VLANs and 802.1Q trunks between two switches
In short: VLANs split one physical switch into separate broadcast domains, and a trunk carries several VLANs over one link. In this lab you build two VLANs across two switches, secure the trunk, and prove that hosts in the same VLAN can talk while different VLANs cannot.
Aim and what you need
The aim is to separate staff and student devices into their own virtual LANs (VLANs) across two switches, and to carry both VLANs over one link using IEEE 802.1Q tagging. Without a router, the two VLANs must not be able to reach each other; that is the proof the separation works.
- Packet Tracer or two Cisco switches in your own lab.
- Four PCs: one per VLAN on each switch.
- A crossover or straight-through cable for the trunk (modern switches auto-detect).
Topology and addressing
| VLAN | Name | Subnet | Test PCs |
|---|---|---|---|
| 10 | STAFF | 192.168.10.0/24 | PC-A on S1 Fa0/1 (.11), PC-C on S2 Fa0/1 (.12) |
| 20 | STUDENTS | 192.168.20.0/24 | PC-B on S1 Fa0/11 (.11), PC-D on S2 Fa0/11 (.12) |
| 99 | NATIVE | none (unused) | none |
Steps
- Address the four PCs as shown. No gateway is needed yet.
- On both switches, create and name the VLANs. VLANs are local to each switch unless you use VLAN Trunking Protocol (VTP), so set VTP to transparent to keep control.
- Assign the access ports and turn off trunk negotiation on them.
- Configure G0/1 on both switches as a static trunk with native VLAN 99 and an allowed list.
- Shut down unused ports and put them in an unused VLAN.
configure terminal
vtp mode transparent
vlan 10
name STAFF
vlan 20
name STUDENTS
vlan 99
name NATIVE
vlan 999
name PARKING
exit
interface range fa0/1 - 10
switchport mode access
switchport access vlan 10
interface range fa0/11 - 20
switchport mode access
switchport access vlan 20
interface g0/1
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan 10,20,99
switchport nonegotiate
interface range fa0/21 - 24
switchport mode access
switchport access vlan 999
shutdown
end
copy running-config startup-config
Tip: on multilayer switches such as the 3560, you may need switchport trunk encapsulation dot1q before switchport mode trunk. The 2960 supports only 802.1Q, so the command does not exist there.
Verify
Run these on each switch. Success looks like this: show vlan brief lists VLANs 10 and 20 with the right ports; show interfaces trunk shows G0/1 trunking, native VLAN 99, and VLANs 10, 20 and 99 allowed and forwarding.
show vlan brief
show interfaces trunk
show interfaces fa0/1 switchport
show interfaces g0/1 switchport
Then test from the PCs. PC-A must reach PC-C (same VLAN, across the trunk). PC-A must not reach PC-B or PC-D, because they are in a different VLAN and subnet with no router.
ping 192.168.10.12
ping 192.168.20.11
Troubleshooting and clean-up
- Same-VLAN ping across switches fails: the VLAN may not exist on the second switch, or it is missing from the allowed list. Both show up in
show interfaces trunk. - Native VLAN mismatch messages: one side still uses VLAN 1. Native VLANs must match on both ends.
- Port shows as inactive in
show vlan brief: it was assigned to a VLAN that has not been created. - Trunk will not form: with
nonegotiateon, both ends must be set to trunk manually.
To clean up a real switch, remove the VLAN database and startup configuration and reload. Keep the Packet Tracer file: the next lab, inter-VLAN routing, builds directly on it. A dedicated, unused native VLAN and a parking VLAN for unused ports are the two habits examiners and auditors look for first.
delete flash:vlan.dat
write erase
reload
Practice
PC-A (VLAN 10) cannot reach PC-B (VLAN 20). Is the lab broken?
Why change the native VLAN away from VLAN 1?
Which command shows the allowed and active VLANs on a trunk?
show interfaces trunk.Key takeaways
- Create VLANs on every switch that needs them; they are local unless VTP is used.
- Access ports carry one VLAN; trunks carry many using 802.1Q tags.
- Use a dedicated native VLAN, an allowed VLAN list and nonegotiate on trunks.
- Shut unused ports and park them in an unused VLAN.
- Verify with show vlan brief and show interfaces trunk.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.