Hone

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

enable
The # prompt.
configure terminal
Into configuration mode.
vlan 10
A VLAN whose number will end up in the tag.
name STAFF
Named.
exit
Out.
interface gi0/1
The uplink.
switchport mode trunk
Frames for VLAN 10 leaving here now carry 0x8100 followed by a TCI whose low twelve bits read 10.
end
Out.
show interfaces status
The 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 

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.

Practise 802.1Q tagging on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.