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 — assign production traffic to a dedicated VLAN.
The previous section explained what VLANs do: VLANs create logical segments on a physical switch. This section explains how VLANs work at the wire level. The 802.1Q tag is the 4-byte field inserted into every Ethernet frame. The tag carries the VLAN ID and priority. Without understanding the tag, configuring QoS for PROFINET RT or diagnosing incorrect VLAN assignments is impractical.
Before 802.1Q, VLANs were vendor-proprietary. Cisco switches used ISL tagging. 3Com switches used a different scheme. Switches from different vendors had no way to exchange VLAN information.
IEEE 802.1Q, published in 1998, standardized VLAN tagging. The standard defines a 4-byte tag inserted into the Ethernet frame. The tag carries the VLAN ID and priority information. Any switch implementing 802.1Q exchanges VLAN-tagged frames with any other 802.1Q switch, regardless of vendor. The tag has a precise structure encoding 3 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 the frame as tagged |
| 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 3 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 the frame as 802.1Q tagged.The 4-byte tag increases the maximum frame size from 1518 to 1522 bytes. Configure trunk ports to accept frames up to 1522 bytes. Otherwise, the switch discards tagged frames as giants. The PCP field controls which frames the switch processes 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 processes PCP 6 frames first. This behavior helps maintain PROFINET RT cycle times. After configuring priority marking, verify the marking on live traffic.
After configuring QoS on a switch, verify that frames carry the correct priority. The following script captures frames on a ring port and reports PROFINET RT frames 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, the switch delays or drops these frames, causing cycle time violations. If PROFINET RT frames show PCP 0, fix the QoS configuration on the switch.
| 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 — assign production traffic to a dedicated VLAN.
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.