// Lesson 19 of 49 · Switching and VLANs
Trunks and 802.1Q
A trunk carries traffic for many VLANs over one link — between switches, to a router, to an AP or to a virtualisation host.
How 802.1Q tagging works
The sending switch inserts a 4-byte 802.1Q tag into each frame. The tag contains the 12-bit VLAN ID (so up to 4094 VLANs) and a 3-bit priority field (CoS) used by QoS. The receiving switch reads the tag, removes it and forwards the frame in that VLAN.
The native VLAN
Frames in the native VLAN cross the trunk untagged. The default native VLAN is 1.
- Both ends must use the same native VLAN, otherwise traffic leaks between VLANs (CDP reports a "native VLAN mismatch").
- Good practice: set the native VLAN to an unused VLAN, so no user traffic is untagged.
Configure a trunk
SW1(config)# interface GigabitEthernet1/0/24
SW1(config-if)# switchport trunk encapsulation dot1q ! only on switches that also support ISL
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk native vlan 999
SW1(config-if)# switchport trunk allowed vlan 10,20,30,110
SW1(config-if)# switchport nonegotiate
Be careful with the allowed list: switchport trunk allowed vlan 40 replaces the list. To add one VLAN, use:
SW1(config-if)# switchport trunk allowed vlan add 40
DTP
Dynamic Trunking Protocol lets Cisco switches negotiate trunking automatically:
| Mode | Behaviour |
|---|---|
switchport mode trunk |
Always trunk |
switchport mode access |
Never trunk |
dynamic desirable |
Actively tries to form a trunk |
dynamic auto |
Trunks only if the other side asks |
Two dynamic auto ports form an access link, not a trunk. Best practice is to set every port explicitly to access or trunk and disable DTP with switchport nonegotiate — negotiation is an attack vector (VLAN hopping).
Verify
SW1# show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gi1/0/24 on 802.1q trunking 999
Port Vlans allowed on trunk
Gi1/0/24 10,20,30,110
Port Vlans allowed and active in management domain
Gi1/0/24 10,20,30,110
Port Vlans in spanning tree forwarding state and not pruned
Gi1/0/24 10,20,30,110
A VLAN must be allowed, active (exists on the switch) and forwarding (not blocked by STP) to pass traffic — the three lists above show exactly where it stops.
VTP in one paragraph
VTP (VLAN Trunking Protocol) can copy VLAN definitions between switches (server, client and transparent modes). It is convenient but risky: a switch with a higher revision number can overwrite the VLANs of the whole domain. Many networks use transparent mode or VTP version 3 with tight control.
Key points
- 802.1Q adds a 4-byte tag with a 12-bit VLAN ID.
- Native VLAN = untagged; must match on both ends; use an unused VLAN.
allowed vlan add— not plainallowed vlan— to add to the list.- Set modes explicitly and disable DTP.
Sign in to save your lesson progress across devices. You can read every published lesson without an account.