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
enableThe # prompt.
configure terminalInto configuration mode.
interface gi0/1The uplink.
switchport mode trunkA trunk, currently carrying every VLAN.
switchport trunk allowed vlan 10,20,999Three, and nothing else. Commas, no spaces.
endOut.
show running-configThe 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
Console into a switch
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.