Hone

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

enable
The # prompt.
configure terminal
Into configuration mode.
vlan 4094
The highest VLAN there is. Accepted.
name TOP
Named, to show it is a VLAN like any other.
exit
Out.
vlan 4095
Refused, with an invalid-input error: the standard reserves it, so the switch will not create it.
end
Out.
show vlan brief
4094 is in the table. 4095 never got there.

Your turn

Create the highest VLAN the standard allows.

vlan 

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.

Practise the 1 to 4094 range on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.