Skip to content

2.2 IEEE 802.1Q Tagging

The previous section explained what VLANs do: they create logical segments on a physical switch. This section explains how they do it at the wire level. The 802.1Q tag is the 4-byte field inserted into every Ethernet frame that carries the VLAN ID and priority. Without understanding this tag, you cannot configure QoS for PROFINET RT or diagnose why frames end up in the wrong VLAN.

Before 802.1Q, VLANs were vendor-proprietary. A Cisco switch used ISL tagging. A 3Com switch used a different scheme. Two switches from different vendors could not exchange VLAN information.

IEEE 802.1Q, published in 1998, standardized VLAN tagging. It defines a 4-byte tag inserted into the Ethernet frame that carries the VLAN ID and priority information. Any switch implementing 802.1Q can exchange VLAN-tagged frames with any other 802.1Q switch, regardless of vendor. The tag itself has a precise structure that encodes three pieces of information.

802.1Q inserts a 4-byte tag between the Source MAC address and the EtherType field:

FieldSizeValue / Notes
Destination MAC6 bytesTarget device
Source MAC6 bytesSender
TPID2 bytes0x8100 — marks this as a tagged frame
TCI2 bytesPCP + DEI + VID (see below)
EtherType2 bytesInner payload protocol
Payload46 to 1500 bytesData

The TCI (Tag Control Information) field is 16 bits with three sub-fields:

BitsFieldSizeValues
15 to 13PCP3 bitsPriority 0 (lowest) to 7 (highest)
12DEI1 bit0 = not drop-eligible, 1 = drop-eligible
11 to 0VID12 bitsVLAN ID 1 to 4094

Key terms:

  • TPID (Tag Protocol Identifier) — always 0x8100; identifies this as an 802.1Q tagged frame
  • PCP (Priority Code Point) — 3-bit IEEE 802.1p QoS priority, values 0 to 7
  • DEI (Drop Eligible Indicator) — marks the frame as eligible for dropping under congestion
  • VID (VLAN Identifier) — 12-bit VLAN ID, range 1 to 4094

The 4-byte tag increases the maximum frame size from 1518 to 1522 bytes. Configure trunk ports to accept frames up to 1522 bytes, or tagged frames will be discarded as giants. The PCP field is particularly important for industrial networks because it controls which frames get processed first during congestion.

The 3-bit PCP field prioritizes frames at Layer 2. Switches process higher-priority frames first when queues are congested.

PCPPriorityIndustrial Use
7HighestNetwork control: STP BPDUs, MRP frames
6HighPROFINET RT frames
2DefaultBest effort
0LowestBackground

Mark PROFINET RT frames with PCP 6 and MRP control frames with PCP 7. A switch with a congested output queue that processes PCP 6 frames first prevents PROFINET RT cycle time violations. After configuring priority marking, you need to verify it is actually working.

After configuring QoS on a switch, verify that frames are actually being tagged with the correct priority. The following script captures frames on a ring port and reports any PROFINET RT frames that are missing PCP 6:

from scapy.all import sniff, Ether, Dot1Q
issues = []
def check_priority(pkt):
if not pkt.haslayer(Ether):
return
eth = pkt[Ether]
if eth.type == 0x8892: # PROFINET RT
if pkt.haslayer(Dot1Q):
pcp = pkt[Dot1Q].prio
if pcp != 6:
issues.append(f"PROFINET RT from {eth.src}: PCP={pcp} (expected 6)")
else:
issues.append(f"PROFINET RT from {eth.src}: no 802.1Q tag")
elif eth.type == 0x88E3: # MRP
if pkt.haslayer(Dot1Q) and pkt[Dot1Q].prio != 7:
issues.append(f"MRP from {eth.src}: PCP={pkt[Dot1Q].prio} (expected 7)")
sniff(iface="eth0", prn=check_priority, timeout=30, store=False)
if issues:
print(f"Priority marking issues ({len(issues)} found):")
for issue in issues:
print(f" {issue}")
else:
print("All PROFINET RT and MRP frames have correct priority marking.")

PROFINET RT frames without PCP 6 compete equally with best-effort traffic. During congestion, they may be delayed or dropped, causing cycle time violations. Fix the QoS configuration on the switch if you see PCP 0 on PROFINET RT frames.

EtherTypeProtocol
0x0800IPv4
0x0806ARP
0x8100802.1Q VLAN tag
0x8892PROFINET RT
0x88CCLLDP
0x88E3MRP

VID is 12 bits, values 1 to 4094

The VLAN ID occupies bits 11 to 0 of the TCI field. VLAN 0 and 4095 are reserved. VLAN 1 is the default — avoid it for production traffic.

PCP 6 for PROFINET RT, PCP 7 for MRP

Mark PROFINET RT frames with PCP 6 and MRP control frames with PCP 7. Verify the marking with Scapy after configuring QoS on the switch.

The 802.1Q tag carries the VLAN ID. The next section covers trunk and access ports — how switches apply and strip these tags at each port type, and the most common misconfiguration mistakes.

  • IEEE 802.1Q-2022 — Bridges and Bridged Networks
  • PROFIBUS and PROFINET International. (2022). PROFINET System Description.