Home Support Blog

802.1Q VLAN Tag: TPID, PRI, CFI and VID Explained

Release date:2026-09-30

Rayin (Shenzhen Rayin Technology) is a manufacturer of GPON OLTs and industrial Ethernet switches. A VLAN tag is the small piece of overhead that lets one physical cable carry many logical networks — and on an industrial switch it is the difference between a flat, noisy broadcast domain and a clean, segmented plant network.

The original Ethernet frame had no concept of VLANs: one switch was one broadcast domain. IEEE 802.1Q inserts a 4-byte tag so the switch can tell, at a glance, which VLAN a frame belongs to — isolating broadcast traffic and carving logical subnets without extra wiring.

image

Where the tag sits in the frame

The tag is inserted after the source MAC address and before the EtherType/Length field. Because of that insertion, a tagged frame is exactly 4 bytes longer than an untagged one. That extra 4 bytes is the entire VLAN mechanism.

The 4 bytes, field by field

FieldBitsValuePurpose
TPID16Fixed 0x8100Tag Protocol Identifier — tells the receiver "a VLAN tag follows"
PRI30–7User Priority, reused by QoS (maps to 802.1p)
CFI10Canonical Format Indicator, normally 0 on Ethernet
VID121–4094VLAN ID, locates the broadcast domain

TPID is the "ID card": when the receiver sees 0x8100 it knows VLAN information follows. VID is the "door number": any value in 1–4094 decides which VLAN owns the frame. PRI and CFI sit in the middle — one governs priority, the other is mostly a legacy compatibility bit.

How PRI is reused for QoS

The PRI field's 3 bits give 8 priority levels (0–7), mapping directly onto the 802.1p priority scheme. When a switch does queue scheduling, higher-PRI frames are forwarded first; under congestion, lower-PRI frames are dropped first. That is why voice and control traffic is often tagged with high PRI — it is a separate dimension from VID, both living in the same tag.

How QinQ stacks two layers

A single tag is not enough for carrier scenarios: the customer already has their own VLANs, and the carrier network needs another layer for metro transport. QinQ (IEEE 802.1ad) pushes a second 0x8100 tag on the outside:

  • Outer VID (S-VLAN): the carrier network identifier.

  • Inner VID (C-VLAN): the customer's original VLAN, passed through transparently.

So the customer's VLAN rides "encapsulated" through the carrier fabric without collision. When you see two consecutive 0x8100 markers in a packet capture, QinQ is at work.

image

How it lands on a Rayin industrial switch

Rayin industrial Ethernet switches recognize and can rewrite the 802.1Q tag on each port. You can map PRI to an 802.1p priority queue so critical traffic (PLC polling, ERPS control) gets the high queue, and you can carry a customer VLAN transparently across campus or carrier links with QinQ. The port mode you pick — Access, Trunk, or Hybrid — decides how tags are added, stripped, or passed. Pairing the switch with a Rayin PON solution covers the whole link from the field to the central office. See the company profile for background.

FAQ

Can VID 0 or 4095 be used?

No. The standard reserves them; the usable range is 1–4094. Configuring a reserved value is rejected or treated as illegal by the switch.

Which VLAN does an untagged frame belong to?

It lands on the receiving port's PVID (default VLAN ID). An Access port usually has PVID=1, so all untagged frames go there.

What is the relationship between PRI and Layer-3 DSCP?

PRI is the Layer-2 802.1p priority; DSCP is the Layer-3 IP priority. They can be mapped to each other. Edge devices often trust and re-mark between PRI and DSCP.

How do you tell outer from inner in QinQ?

The outer tag is parsed first (S-VLAN), the inner second (C-VLAN). The outer TPID is usually 0x8100, but strict 802.1ad may use 0x88a8.

Why does 802.1Q add exactly 4 bytes?

Because the tag field is 4 bytes (TPID 2 + PRI/CFI/VID 2). The frame simply grows by that overhead after the source MAC.

Key takeaways

  • The 802.1Q tag writes "which VLAN" and "how urgent" directly into the frame header: TPID identifies, PRI feeds QoS, VID locates the broadcast domain.

  • QinQ is just one more tag — same principle, one extra shell.

  • Rayin (Shenzhen Rayin Technology) is a manufacturer of GPON OLTs and industrial Ethernet switches, and its industrial switches implement 802.1Q tagging, 802.1p priority mapping, and QinQ for carrier-grade segmentation.


Related Reading


About Rayin → https://www.szrayin.com/Profile/

Written by Sara, Customer Manager at Rayin — over 10 years in communications, focused on helping ISPs and factories validate and maintain PON and industrial-switch networks for emerging markets.

Connect with Sara on LinkedIn

Get A Quote

You have agreed to this website’s《Privacy Policy》