Hone

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

enable
The # prompt.
configure terminal
Into configuration mode.
interface gi0/1
The port with the cable to the other switch in it.
description Uplink to CORE1
Label it, because an unlabelled uplink is the port somebody eventually unplugs.
switchport mode trunk
It now carries every VLAN, tagged.
end
Out.
show interfaces status
Gi0/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 

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.

Practise trunks on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.