This episode discusses the need for trunking when VLANs span multiple physical switches, the 4-byte IEEE 802.1Q tag mechanism, and the risks of native VLAN and VLAN hopping. You configure a trunk, restrict the VLANs allowed, then understand VTP domains, server client transparent modes, and pruning.

In episode 4 you created VLANs on a single switch. The problem arises as the network grows: how do you carry VLAN 10 and VLAN 20 traffic across two physical switches at once? The solution is trunking — and episode 5 discusses all of its details.
We will learn the IEEE 802.1Q tag mechanism, the native VLAN risk, Cisco trunk configuration, and then VTP (VLAN Trunking Protocol) with all its shortcomings. This material is very important because trunking mistakes are the most common cause of Layer 2 problems in both labs and production.
If two switches each have PCs in VLAN 10, a normal cable is not enough: without trunking, a switch does not know which VLAN a frame from the other switch belongs to. A trunk link is a single physical link that carries traffic from many VLANs at once. Because several VLANs pass over the same single link, every frame must be tagged with its VLAN identity.
IEEE 802.1Q inserts a 4-byte tag between the source MAC address and the Type/Length field of an Ethernet frame. The tag contains a 12-bit VLAN ID (VID), supporting up to 4096 VLANs. When a frame arrives at another switch, the switch reads the tag, forwards the frame to the correct VLAN, and removes the tag before sending the frame to an access port.
Practice it in PNETLab: connect two switches, then capture the trunk link with
Wireshark. You will see frames tagged 802.1Q Virtual LAN, PRI 0, CFI 0, ID 10
as they move between the switches.
On an 802.1Q trunk, the native VLAN is sent untagged. By default the native VLAN is VLAN 1. Because it is untagged, native VLAN frames are considered to belong to every connected switch — this is the gap exploited by the VLAN hopping technique: an attacker pretends to be a trunk switch (double tagging) to reach other VLANs.
Standard mitigation: change the native VLAN from 1 to a dedicated VLAN, never use VLAN 1 for data, and disable automatic trunking (DTP) on access ports.
In PNETLab, connect SW1 and SW2, then configure trunk on both:
configure terminal
interface g0/0
switchport trunk encapsulation dot1q
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan 10,20
exitOn IOL L2 switches, the command switchport trunk encapsulation dot1q
sets 802.1Q encapsulation; on switches that only support dot1q, this command is
automatically ignored. switchport mode trunk makes the port a trunk link.
Best practice: only allow the VLANs that are actually needed across the trunk.
switchport trunk allowed vlan 10,20 restricts the traffic to only VLANs 10
and 20. Other VLANs, including VLAN 1, will not be forwarded — a small step
that reduces the attack surface and broadcast load.
VTP propagates the VLAN database from one switch to another within a single domain. There are three modes:
A minimal configuration:
configure terminal
vtp domain PNETLAB
vtp mode server
exitvtp domain PNETLAB sets the domain name, and vtp mode server
makes the switch the source of the VLAN database.
The main danger of VTP: the revision number. Every server change
increments the database revision number. If a switch with a higher revision
number connects to the network, the VLAN database of the entire domain can be
overwritten — VLANs can be deleted or created unintentionally. In production
networks, many engineers choose vtp mode transparent or disable VTP
entirely.
VTP Pruning is a feature that prevents VLAN broadcast traffic from being sent to switches that do not have members of that VLAN. This saves bandwidth on large trunks, but it must be configured carefully because it adds complexity.
Before closing this episode, three golden rules of trunking: always configure trunk on both sides of the link, always set the same native VLAN on both sides (a mismatch will break communication), and never let a trunk propagate unintentionally to ports facing end users. Verify with the following commands:
SW1# show interfaces trunk
SW1# show interfaces g0/0 switchportshow interfaces trunk displays the list of active trunks along
with the allowed VLANs, while show interfaces switchport shows the mode and
native VLAN of each interface.
Key takeaways:
switchport mode trunk plus allowed vlan secures a trunk.show interfaces trunk.In the next episode, episode 6, we build the bridge between VLANs: inter-VLAN routing — the router-on-a-stick (ROAS) method with sub-interfaces, the SVI method on Layer 3 switches, configuring both in PNETLab, and a comparison of performance and efficiency between the two approaches.