Lessons · Network switches · the 1 to 4094 range
1 to 4094, and not 4096
The tag has twelve bits for the VLAN id, so 0 through 4095 fit, but 0 means priority only and 4095 is reserved: the usable range is 1 to 4094.
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 the first thing an interviewer asks about VLANs, and on the job it is the difference between a number the switch takes and an invalid-input error you cannot explain.
How to think about it
Remember where the limit comes from rather than the number. Twelve bits, minus the two the standard keeps for itself.
Worked example
enableThe # prompt.
configure terminalInto configuration mode.
vlan 4094The highest VLAN there is. Accepted.
name TOPNamed, to show it is a VLAN like any other.
exitOut.
vlan 4095Refused, with an invalid-input error: the standard reserves it, so the switch will not create it.
endOut.
show vlan brief4094 is in the table. 4095 never got there.
Your turn
Create the highest VLAN the standard allows.
vlan
Console into a switch
The trap
Planning a network around VLAN 1000 to 1005 because they are round numbers, then meeting a switch whose extended range behaves differently. Check what the hardware supports before the design depends on it.