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.
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:
| Field | Size | Value / Notes |
|---|---|---|
| Destination MAC | 6 bytes | Target device |
| Source MAC | 6 bytes | Sender |
| TPID | 2 bytes | 0x8100 — marks this as a tagged frame |
| TCI | 2 bytes | PCP + DEI + VID (see below) |
| EtherType | 2 bytes | Inner payload protocol |
| Payload | 46 to 1500 bytes | Data |
The TCI (Tag Control Information) field is 16 bits with three sub-fields:
| Bits | Field | Size | Values |
|---|---|---|---|
| 15 to 13 | PCP | 3 bits | Priority 0 (lowest) to 7 (highest) |
| 12 | DEI | 1 bit | 0 = not drop-eligible, 1 = drop-eligible |
| 11 to 0 | VID | 12 bits | VLAN ID 1 to 4094 |
Key terms:
0x8100; identifies this as an 802.1Q tagged frameThe 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.
| PCP | Priority | Industrial Use |
|---|---|---|
| 7 | Highest | Network control: STP BPDUs, MRP frames |
| 6 | High | PROFINET RT frames |
| 2 | Default | Best effort |
| 0 | Lowest | Background |
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.
| EtherType | Protocol |
|---|---|
0x0800 | IPv4 |
0x0806 | ARP |
0x8100 | 802.1Q VLAN tag |
0x8892 | PROFINET RT |
0x88CC | LLDP |
0x88E3 | MRP |
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.