Protocol 2 of 81Layer 2FrameAssembly v3.1.2
llms-full.txt
vlanIEEE 802.1Q Virtual LAN Tagging & 802.1p QoS

802.1Q Trunk Tags (0x8100) Without NIC Drivers Eating Your VLAN Header

Default Port / Protocol
TPID 0x8100 (VID 1)
Host Endpoint Rule
MAC-Only or IP
Wireshark Display Filter
vlan
Standards & Specs
IEEE 802.1Q, IEEE 802.1p
Wire Stack:Ethernet II802.1Q Tag (0x8100)

What It Does on the Wire

Laptop OSes love silently stripping 0x8100 tags before Wireshark ever sees them — writing vlan 120 pcp 5 bakes the exact 4-byte 802.1Q tag straight into your .pcap bytes.

IEEE 802.1Q (vlan) inserts a 4-byte tag header (TPID 0x8100 + 3-bit Priority Code Point pcp + 1-bit Drop Eligible Indicator dei + 12-bit VLAN Identifier vid) between the Ethernet source MAC and the encapsulated EtherType.

In FrameAssembly v3.1.2, vlan serves a dual role: you can emit standalone Layer 2 802.1Q frames between MAC-only switch ports (sw1 -> sw2 vlan 100 pcp 5 payload "keepalive"), or append vlan <0..4095> [pcp <0..7>] [dei <0|1>] as a cross-layer modifier onto any of the other 80 protocols.

Switch Trunk Allowed-VLAN & Native VLAN Audits

Generate captures spanning multiple VLAN IDs (1, 10, 100, 4094) and priority-tagged vlan 0 frames to verify 802.1Q trunk pruning and native-VLAN policies.

IEEE 802.1p CoS / DiffServ QoS Mapping Verification

Combine Layer 2 pcp 5 / pcp 6 markings with Layer 3 dscp 46 on VoIP (rtp/sip) or routing (ospf/bgp) frames to test trust boundaries.

VLAN-Aware IDS/IPS & Firewall Sub-Interface Testing

Replay tagged enterprise flows into Suricata, Zeek, or Next-Gen Firewall sub-interfaces to confirm inspection policies apply inside 802.1Q trunks.

Minimal Quickstart (vlan_quickstart.frasm)

Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.

vlan_quickstart.frasm6 lines
Open in Playground
host access_sw { mac 00:1b:21:aa:00:01 }
host core_sw { mac 00:1b:21:bb:00:02 }
compile {
access_sw -> core_sw vlan 100
}

What the Compiler Calculates So You Don't Have To

  • Inserts outer TPID 0x8100 and packs pcp (3 bits), dei (1 bit), and vid (12 bits) into the big-endian 16-bit Tag Control Information (TCI) word.
  • Emits default inner EtherType 0x0800 when used standalone (overridable via ethertype <0..65535>) or preserves the exact inner protocol EtherType (0x0806, 0x0800, 0x86dd, 0x8847) when used as a cross-layer modifier.
  • Validates vid (0..=4095), pcp (0..=7), and dei (0..=1) at compile time before writing .pcap or .pcapng bytes.
Multi-Frame Lab · Ready to Compile

Multi-VLAN Trunk Capture Mixing Standalone L2 Probes & Voice/Routing CoS

Demonstrates standalone MAC-only 802.1Q frames alongside VLAN-tagged ARP, VoIP RTP (pcp 5, dscp 46), and network-control OSPF (pcp 6) traffic on a single switch trunk.

vlan_trunk_qos.frasm15 lines
Open in Playground
host sw_leaf { mac 00:1c:73:10:00:01 }
host sw_spine { mac 00:1c:73:20:00:01 }
host phone_01 { ip 10.50.20.11 mac 00:1c:73:50:00:11 }
host pbx_core { ip 10.50.20.10 mac 00:1c:73:50:00:10 }
compile {
// Standalone L2 VLAN probe on management VLAN 99
sw_leaf -> sw_spine vlan 99 pcp 2 dei 0 ethertype 0x88b5 payload "trunk-health" wait 1ms
// Voice VLAN 20: ARP + CoS 5 / EF RTP media packet
phone_01 -> pbx_core arp request vlan 20 pcp 5 wait 1ms
phone_01 <- pbx_core arp reply vlan 20 pcp 5 wait 2ms
phone_01 -> pbx_core rtp pt 0 seq 1 timestamp 160 ssrc 0x10203040 vlan 20 pcp 5 dscp 46 payload "g711-ulaw-sample" wait 2ms
// Routing VLAN 30: Priority 6 OSPF Hello
phone_01 -> pbx_core ospf hello routerid 10.50.20.11 areaid 0 vlan 30 pcp 6
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show vlan_trunk_qos.frasm

# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly vlan_trunk_qos.frasm vlan_trunk_qos.pcap
frameassembly vlan_trunk_qos.frasm vlan_trunk_qos.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse vlan_trunk_qos.pcap vlan_trunk_qos_edited.frasm

All vlan Keywords & Header Options

Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after vlan:

src_host -> dst_host vlan [<vid 0..4095>] [pcp <0..7>] [dei <0|1>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
vlan [<0..4095>]12-bit unsigned integer (0..4095)1Sets the 12-bit 802.1Q VLAN Identifier (0 = 802.1p priority-tagged frame, 1..4094 = standard VLANs, 4095 = reserved).
pcp <0..7>3-bit unsigned integer (0..7)0Sets the IEEE 802.1p Priority Code Point (0 Best Effort, 5 Voice, 6 Internetwork Control, 7 Network Control).
dei <0|1>1-bit flag (0 or 1)0Sets the Drop Eligible Indicator bit (formerly CFI) marking frames eligible for discard under congestion.
ethertype <0..65535>Whole number (0..65535) (decimal or 0x hex)0x0800 (standalone) or inner protocol EtherTypeOverrides the 2-byte encapsulated EtherType immediately following the 802.1Q tag.

Cross-Layer Wrappers Valid with vlan

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

5 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac>Colon, hyphen, or Cisco dot MACHost MAC / RFC multicast MACOverrides the 14-byte Ethernet II source or destination MAC address for this single packet.
qinq <0..4095> [innervlan <0..4095>]Outer S-VLAN 0..4095, Inner C-VLAN 0..4095Untagged (innervlan 1 when qinq is set)Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100).
mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255Unlabeled (at most 1 mpls tag per packet)Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header.

Gotchas & Quick Fixes

Use qinq for Double VLAN Stacking Instead of Repeating vlan

Avoid
a -> b icmp vlan 500 vlan 20
Valid v3.1.2 Syntax
a -> b icmp qinq 500 innervlan 20

Repeating vlan overwrites the single 802.1Q tag field. To emit IEEE 802.1ad S-Tag (0x88a8) + C-Tag (0x8100) double-tagging, use qinq <svid> innervlan <cvid>.

12-Bit VID Range Enforcement

Avoid
a -> b vlan 5000
Valid v3.1.2 Syntax
a -> b vlan 4094 pcp 5

Semantic validation enforces 0..=4095 on vlan VIDs and 0..=7 on pcp, rejecting out-of-range tags at compile time.

Field Guide 05
VLANs, QinQ, MPLS, Tunnel Soup & Dual-Stack IPv6