Free tech learning for everyone, from basics to pro

Networking LabsLabsBeginner

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

Two-switch VLAN labSwitch S1Fa0/1-10: VLAN 10 STAFFFa0/11-20: VLAN 20 STUDENTSG0/1: 802.1Q trunkNative VLAN 99Switch S2Fa0/1-10: VLAN 10 STAFFFa0/11-20: VLAN 20 STUDENTSG0/1: 802.1Q trunkNative VLAN 99
Figure 1. Both switches use the same port plan, joined by one trunk on G0/1 that carries VLANs 10, 20 and 99.
VLANNameSubnetTest PCs
10STAFF192.168.10.0/24PC-A on S1 Fa0/1 (.11), PC-C on S2 Fa0/1 (.12)
20STUDENTS192.168.20.0/24PC-B on S1 Fa0/11 (.11), PC-D on S2 Fa0/11 (.12)
99NATIVEnone (unused)none

Steps

  1. Address the four PCs as shown. No gateway is needed yet.
  2. 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.
  3. Assign the access ports and turn off trunk negotiation on them.
  4. Configure G0/1 on both switches as a static trunk with native VLAN 99 and an allowed list.
  5. 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 nonegotiate on, 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?
No. Different VLANs are separate broadcast domains and need a Layer 3 device to route between them.
Why change the native VLAN away from VLAN 1?
Untagged traffic on a trunk belongs to the native VLAN; using an unused VLAN reduces VLAN-hopping risks and keeps user traffic tagged.
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.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

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.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.