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.

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.
| Field | Bits | Value | Purpose |
|---|---|---|---|
| TPID | 16 | Fixed 0x8100 | Tag Protocol Identifier — tells the receiver "a VLAN tag follows" |
| PRI | 3 | 0–7 | User Priority, reused by QoS (maps to 802.1p) |
| CFI | 1 | 0 | Canonical Format Indicator, normally 0 on Ethernet |
| VID | 12 | 1–4094 | VLAN 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.
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.
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.

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.
No. The standard reserves them; the usable range is 1–4094. Configuring a reserved value is rejected or treated as illegal by the switch.
It lands on the receiving port's PVID (default VLAN ID). An Access port usually has PVID=1, so all untagged frames go there.
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.
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.
Because the tag field is 4 bytes (TPID 2 + PRI/CFI/VID 2). The frame simply grows by that overhead after the source MAC.
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.
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.