Lessons · Network switches · 802.1Q tagging
The four bytes that carry the VLAN
802.1Q inserts four bytes after the source address: 0x8100 to say a tag follows, then three bits of priority, one drop-eligible bit, and twelve bits of VLAN id.
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 why the VLAN range stops at 4094, why a tagged frame is four bytes longer, and why a device that does not speak 802.1Q throws the frame away instead of reading it.
How to think about it
When something works on an access port and fails on a trunk, ask whether the device on the end understands tags. Most end devices do not, and that is not a fault.
Worked example
enableThe # prompt.
configure terminalInto configuration mode.
vlan 10A VLAN whose number will end up in the tag.
name STAFFNamed.
exitOut.
interface gi0/1The uplink.
switchport mode trunkFrames for VLAN 10 leaving here now carry 0x8100 followed by a TCI whose low twelve bits read 10.
endOut.
show interfaces statusThe port reads trunk. What is on the wire is four bytes longer than what came in.
Your turn
Make the port that carries tagged frames.
switchport mode
Console into a switch
The trap
Assuming twelve bits means 4096 usable VLANs. VLAN 0 means priority only and 4095 is reserved, so what is left is 1 to 4094.