Hone

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

enable
The # prompt.
configure terminal
Into configuration mode.
interface gi0/2
A wall port with a PC behind it.
description Desk 14
Say what is on it, so the decision is checkable later.
switchport mode access
One VLAN, untagged, because a PC does not understand tags.
switchport access vlan 10
The office VLAN.
exit
Out of that port.
interface gi0/8
The cable to the switch in the next room.
description Uplink to IDF2
Labelled.
switchport mode trunk
Every VLAN, tagged, because the far end is a switch and can read the tags.
end
Out.
show interfaces status
Gi0/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 

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.

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