Hone

Lessons · Network switches · the allowed VLAN list

Let across only what belongs

`switchport trunk allowed vlan` lists the VLANs a trunk carries; without it, a trunk carries all of them.

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

A trunk that carries everything hands every broadcast in the building to every switch, and gives anybody who reaches one link a way into every VLAN.

How to think about it

List what the far end actually needs. Then read it back, because the allowed list is one of the few places where adding a VLAN later means editing the line rather than typing it again.

Worked example

enable
The # prompt.
configure terminal
Into configuration mode.
interface gi0/1
The uplink.
switchport mode trunk
A trunk, currently carrying every VLAN.
switchport trunk allowed vlan 10,20,999
Three, and nothing else. Commas, no spaces.
end
Out.
show running-config
The allowed list is under the interface. Anything not on it does not cross this cable.

Your turn

Carry only VLANs 10, 20 and 999 across this trunk.

switchport trunk  vlan 10,20,999

The trap

Typing `switchport trunk allowed vlan 30` later to add a VLAN. That REPLACES the list with 30 alone. The word for adding is `add`, and forgetting it takes the other VLANs down instantly.

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