CCNA · Lesson 4 of 13
Trunk Links and 802.1Q
How do several VLANs travel between two switches without one cable per VLAN? With a trunk.
In a nutshell
A trunk carries many VLANs over one cable. Each frame travels with an 802.1Q tag that says which VLAN it belongs to.
In this lesson
The problem
You have two switches, and both have Sales (VLAN 10) and Accounting (VLAN 20) users. One cable per VLAN? With 50 VLANs that would be 50 cables and 50 wasted ports.
The solution: a trunk
A trunk link is one cable that carries many VLANs. So the other switch knows which VLAN each frame belongs to, the switch adds a tag before sending it. It is like putting a colored wristband on everyone crossing a bridge: on the other side, each person goes to their own room.
The 802.1Q tag
IEEE 802.1Q (also called dot1q) is the tagging standard. It inserts 4 bytes into the Ethernet frame, between the source MAC and the Type field:
| Field | Size | Purpose |
|---|---|---|
| TPID | 16 bits | Value 0x8100. Means "this frame is tagged". |
| PRI (PCP) | 3 bits | Priority (CoS). Used to prioritize voice. |
| DEI | 1 bit | Marks whether the frame can be dropped under congestion. |
| VLAN ID | 12 bits | The VLAN number (that is why the maximum is 4095). |
Because the frame changes, the switch recalculates the FCS. ISL was Cisco's old proprietary protocol: it encapsulated the whole frame (26-byte header + 4-byte CRC). It is obsolete today; for the CCNA always think 802.1Q.
Configure a trunk
SW1(config)# interface g0/1
SW1(config-if)# switchport trunk encapsulation dot1q ← only on switches that also support ISL (e.g. 3560)
SW1(config-if)# switchport mode trunk
SW1(config-if)# switchport trunk allowed vlan 10,20 ← optional: limit VLANs
Configure the other end (SW2) the same way. By default a trunk allows all VLANs (1–4094).
Watch out for allowed vlan
| Command | Result |
|---|---|
switchport trunk allowed vlan 30 | Replaces the list: now only VLAN 30 passes. |
switchport trunk allowed vlan add 30 | Adds 30 to the existing list. |
switchport trunk allowed vlan remove 30 | Removes only 30. |
switchport trunk allowed vlan all | Allows all VLANs again. |
Very common real mistake
Forgetting add and taking down every other VLAN on the trunk.
Verify
SW1# show interfaces trunk
Port Mode Encapsulation Status Native vlan
Gi0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Gi0/1 10,20
Port Vlans allowed and active in management domain
Gi0/1 10,20
What you must remember
- Trunk = a link that carries several VLANs.
- 802.1Q inserts a 4-byte tag; the VLAN ID uses 12 bits.
- Configure: switchport mode trunk.
- Use "allowed vlan add" so you do not wipe the existing list.
Check what you learned
4 exam-style questions. Some have one answer and others ask you to choose several. Answer them all to complete the lesson.