Lessons · Network switches · what a VLAN is
One switch, several networks
A VLAN is a number that splits one physical switch into separate networks, and ports in different VLANs cannot talk to each other through the switch.
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
It is how one box serves reception, accounting and the CCTV cameras without any of them seeing each other's traffic, and without buying three switches.
How to think about it
Think of it as painting each port a colour. Same colour, same network. Different colours need a router between them, whatever cable is plugged in where.
Worked example
enableThe # prompt.
configure terminalInto configuration mode.
vlan 20Creates VLAN 20 and drops you into (config-vlan)#, its own small mode.
name ACCOUNTSA name for people, not for the switch. The switch only ever cares about the number.
exitBack to (config)#, VLAN 20 now exists.
endOut.
show vlan briefVLAN 1 (default) and VLAN 20 (ACCOUNTS). No port is in 20 yet, so its Ports column is empty.
Your turn
Create VLAN 30.
30
Console into a switch
The trap
Expecting two VLANs to reach each other because they are on the same switch. They cannot, by design. Getting between them needs a router or a layer 3 switch, and that is the point of them.