VLAN (802.1Q)
IEEE 802.1Q splits one physical switch network into separate layer-2 networks by adding a 4-byte tag to Ethernet frames on trunk links.
- OSI layer
- 2 Data link
- Carried in
- Ethernet
- Identified by
- TPID 0x8100 (QinQ outer: 0x88A8)
- Specs
- IEEE 802.1Q, IEEE 802.1ad
- Wireshark filter
vlan- Encrypted
- no
Packet structure
Select a field to see what it does.
In the frame: Destination MAC | Source MAC | 802.1Q tag | EtherType | Payload | FCS. The tag makes the frame 4 bytes longer (maximum 1522).
How it works
| Port type | Frames on the wire | Typical use |
|---|---|---|
| Access port | Untagged; the switch adds/removes the tag internally | End devices |
| Trunk port | Tagged with the VLAN ID, except the native VLAN, which is untagged | Switch-to-switch, switch-to-router, hypervisors |
Traffic between VLANs must be routed (router on a stick, layer-3 switch, firewall), which is where it can be filtered.
QinQ (802.1ad) puts a provider tag (TPID 0x88a8) in front of the customer tag, so a carrier can transport customer VLANs unchanged.
Capturing tags: many NICs and drivers strip VLAN tags before the capture sees them. To see tags, capture on a trunk with tag offloading disabled or on a mirror (SPAN) port configured to keep them.
In Wireshark
| Filter | Shows |
|---|---|
vlan | Tagged frames |
vlan.id == 20 | One VLAN |
vlan.priority >= 5 | Voice / high-priority traffic |
vlan.etype == 0x8100 | A tag inside a tag (QinQ or double tagging attack) |
eth.type == 0x88a8 | 802.1ad outer tags |
What normal looks like: tags only on trunk links, every frame with one tag (two on provider QinQ links). A frame with two 0x8100 tags arriving on an access port is an attack.
Security notes
- Switch spoofing: a host negotiates a trunk with DTP (Cisco) and then reaches every VLAN. Fix: set access ports to
switchport mode accessand disable DTP (switchport nonegotiate). - Double tagging: the attacker, in the native VLAN of a trunk, sends a frame with two tags; the first switch strips the outer (native) tag and the next switch forwards it into the victim VLAN. One-way only. Fix: native VLAN unused by hosts, or tag the native VLAN too.
- VLANs are not a security boundary on their own: they separate broadcast domains, but a misconfigured trunk or a compromised switch joins them again. Filtering belongs on the router or firewall between VLANs.
- VLAN 1: default for everything and often for management. Move users and management off it.
Versions and related
- Ethernet: the frame the tag lives in.
- 802.1ad (QinQ): stacked tags for providers.
- VXLAN / EVPN: VLAN-like segments over IP (UDP 4789) with 24-bit IDs, used in data centres.
- Spanning Tree: PVST+ and MSTP run per VLAN or per group of VLANs.
References
- IEEE 802.1Q: Bridges and Bridged Networks
- Wireshark wiki: VLAN capture setup