Sub topic 5
Trunk ports: carrying many VLANs on one link
This chapter assumes you know how a switch learns MAC addresses and floods frames, how access ports assign a device to one VLAN, and basic switch command-line use. It covers what a trunk is and how to configure and check one. The tag format, native VLAN, pruning and negotiation each get their own chapter.
Why a trunk exists
An access port carries one VLAN, and its frames are untagged. Suppose two switches both host VLAN 10 and VLAN 20. Linking them with access ports would need one cable per VLAN. That does not scale.
A trunk port carries many VLANs over one physical link. The sending switch adds an 802.1Q tag to each frame. The tag holds the VLAN ID. The receiving switch reads the tag and keeps the frame inside that VLAN.
What happens on the wire
- Host A sends an untagged frame into an access port in VLAN 10.
- Switch 1 looks up the destination MAC address in the MAC table for VLAN 10 only.
- If the frame must leave through the trunk, Switch 1 inserts a tag with VLAN ID 10.
- Switch 2 receives the tagged frame and forwards it only within VLAN 10.
- If the frame leaves through an access port, Switch 2 removes the tag first. Host C never sees it.
Broadcasts and unknown-unicast floods work the same way. They go out of the trunk tagged, and they stay in their own VLAN on the far side.
Configuring a static trunk
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk native vlan 999
switchport trunk allowed vlan 10,20
switchport nonegotiateswitchport mode trunkforces the port to trunk. It does not wait for the neighbor to agree.switchport trunk native vlan 999sets the VLAN used for untagged frames on this trunk. Both ends must match.switchport trunk allowed vlan 10,20limits which VLANs may cross the link.switchport nonegotiatestops the port from sending DTP negotiation frames.
Verifying a trunk
show interfaces trunk
show interfaces GigabitEthernet0/24 switchportshow interfaces trunk lists each trunking port with its mode, encapsulation, status and native VLAN. It also shows three VLAN lists:
- The VLANs allowed on the trunk.
- The VLANs allowed and active in the management domain.
- The VLANs in the spanning-tree forwarding state and not pruned.
A VLAN missing from the last list is not being carried, even if you allowed it.
Common errors
| Symptom | Likely cause |
|---|---|
| Hosts in a VLAN cannot reach the same VLAN on the other switch | VLAN not in the allowed list, or the VLAN does not exist on one switch |
| Native VLAN mismatch messages in the log | The two ends use different native VLANs |
| Link works one way or not at all | One end is a trunk and the other is an access port |
| Port does not show in `show interfaces trunk` | Port is down or not operating as a trunk |
Exercise
Switch 1 and Switch 2 are joined by a trunk with switchport trunk allowed vlan 10,20 on both ends. Hosts in VLAN 30 on each switch cannot reach each other. Both switches have VLAN 30 and the host ports are correct. What is the most likely cause, and how do you fix it?
Show answer
VLAN 30 is not in the trunk's allowed list, so the trunk does not carry its frames. Add it on both ends with switchport trunk allowed vlan add 30, then confirm it appears in show interfaces trunk.