Lessons · Network switches · trunk or access
Trunk or access: the decision, not the command
What is on the other end decides it. Another switch or a device that understands VLANs gets a trunk; anything else gets an access port.
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
Both commands are one line, so the skill is not typing them, it is knowing which. Getting it wrong produces a port that half works, which is much harder to diagnose than one that does not work at all.
How to think about it
Ask what is plugged in. One PC or one printer: access, in the VLAN that device belongs to. Another switch, a router, a virtualisation host: trunk, carrying the VLANs the far end needs.
Worked example
enableThe # prompt.
configure terminalInto configuration mode.
interface gi0/2A wall port with a PC behind it.
description Desk 14Say what is on it, so the decision is checkable later.
switchport mode accessOne VLAN, untagged, because a PC does not understand tags.
switchport access vlan 10The office VLAN.
exitOut of that port.
interface gi0/8The cable to the switch in the next room.
description Uplink to IDF2Labelled.
switchport mode trunkEvery VLAN, tagged, because the far end is a switch and can read the tags.
endOut.
show interfaces statusGi0/2 shows 10 and Gi0/8 shows trunk. The two lines say the two decisions.
Your turn
Set the port that reaches the next switch.
switchport mode
Console into a switch
The trap
Trunking a wall port because it is easier than deciding. The PC sees only the native VLAN, so it half works, and the fault report will be about something else entirely.