Lessons · Network switches · trunks
One cable, every VLAN
A trunk port carries traffic for many VLANs down one cable, by writing the VLAN number into each frame as it leaves.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
Two switches with six VLANs between them would otherwise need six cables. A trunk is how every building with more than one switch in it actually works.
How to think about it
Trunks go between switches and to devices that understand VLANs. Everything with a PC on the end of it is an access port. Get that division right and most of switching follows.
Worked example
enableThe # prompt.
configure terminalInto configuration mode.
interface gi0/1The port with the cable to the other switch in it.
description Uplink to CORE1Label it, because an unlabelled uplink is the port somebody eventually unplugs.
switchport mode trunkIt now carries every VLAN, tagged.
endOut.
show interfaces statusGi0/1 says trunk in the Vlan column instead of a number, because it is not in one VLAN.
Your turn
Make this port carry every VLAN to the next switch.
switchport mode
Console into a switch
The trap
Trunking a port with a PC on the end. The PC does not understand tags, so it sees only the native VLAN and behaves as though half the network has vanished.