Layer 2 Switching, VLAN/QinQ, 802.1X & MPLS Protocols
Operating-system raw sockets and consumer USB-Ethernet NIC drivers routinely strip or rewrite IEEE 802.1Q (0x8100) and IEEE 802.1ad QinQ (0x88a8) tags before user-space capture buffers ever see them. FrameAssembly synthesizes every Layer 2 Ethernet II and IEEE 802.3 LLC frame directly in user space—writing exact outer/inner TPIDs, 3-bit 802.1p PCP priorities, IEEE Slow Protocol subtypes, and 32-bit MPLS label shims straight to .pcap or .pcapng.
All 8 protocols in this group (arp, vlan, qinq, lldp, stp, lacp, eapol, and mpls) accept MAC-only host endpoints (host sw1 { mac 00:1c:73:aa:bb:01 }) as well as IP hosts. In addition, vlan, qinq, and mpls work as cross-layer L2 wrappers on any Layer 3, Layer 4, or Layer 7 packet statement.
Wire Framing & Endpoint Rules for Layer 2 Switching & VLANs
MAC-Only Endpoints Allowed
Only these 8 pure Layer 2 protocols compile with MAC-only host blocks (ip omitted); all 73 Layer 3–7 protocols require plain IPv4 or IPv6 addresses on both endpoints.
Automatic IEEE Group Destination MACs
When dstmac is omitted, arp request / garp broadcast to ff:ff:ff:ff:ff:ff, stp targets 01:80:c2:00:00:00, lacp targets 01:80:c2:00:00:02, eapol targets 01:80:c2:00:00:03, and lldp targets 01:80:c2:00:00:0e.
Flexible MAC Literals
Every mac, srcmac, dstmac, sendermac, and actorsys field accepts Linux colon (00:1c:73:00:01:02), Windows hyphen (00-1C-73-00-01-02), or Cisco dot-quad (001c.7300.0102) hex.
Standalone or Cross-Layer Shims
vlan <0..4095>, qinq <0..4095> innervlan <0..4095>, and mpls <0..1048575> work standalone or appended once onto any L3–L7 frame.
Campus Switch Trunk: LLDP, RSTP, LACP, 802.1X, GARP & QinQ
Emits a 6-frame switch-port bring-up sequence combining IEEE 802.1AB LLDP neighbor discovery, 802.1w RSTP BPDU, 802.3ad LACP negotiation, 802.1X EAPOL-Start, VLAN-tagged Gratuitous ARP failover, and double-tagged 802.1ad QinQ.
host dist_sw { ip 10.10.20.1 mac 00:1c:73:10:00:01 }
host edge_sw { ip 10.10.20.2 mac 00:1c:73:10:00:02 }
compile {
dist_sw -> edge_sw lldp chassisid "00:1c:73:10:00:01" portid "TenGigE1/0/1" ttl 120 sysname "dist-sw-01" wait 2ms
dist_sw -> edge_sw stp rstp rootid "32768:00:1c:73:10:00:01" bridgeid "32768:00:1c:73:10:00:01" portid 0x8001 cost 2000 wait 2ms
dist_sw -> edge_sw lacp actorsys 00:1c:73:10:00:01 actorkey 10 actorport 1 actorstate 0x3d partnersys 00:1c:73:10:00:02 partnerkey 10 partnerport 1 wait 2ms
edge_sw -> dist_sw eapol start version 2 wait 2ms
dist_sw -> edge_sw vlan 20 pcp 6 arp garp senderip 10.10.20.1 sendermac 00:1c:73:10:00:01 wait 2ms
dist_sw -> edge_sw qinq 500 innervlan 20 pcp 5 payload "metro-trunk-probe"
}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show l2_switch_trunk_suite.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly l2_switch_trunk_suite.frasm l2_switch_trunk_suite.pcap
frameassembly l2_switch_trunk_suite.frasm l2_switch_trunk_suite.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse l2_switch_trunk_suite.pcap l2_switch_trunk_suite_edited.frasm
# 4. Verify dissected protocol fields in tshark
tshark -r l2_switch_trunk_suite.pcap -Y "lldp || stp || lacp || eapol || arp || vlan"All 8 Native Protocols in Layer 2 Switching, VLAN/QinQ, 802.1X & MPLS
Select any lowercase protocol keyword below for its full RFC wire layout, modifier table, cross-layer wrappers, and runnable lab capture.
| # | Keyword | Protocol & Wire Summary | Default Port / Proto | Endpoint Rule | Wireshark Filter |
|---|---|---|---|---|---|
| 01 | arp | Address Resolution Protocol & Gratuitous ARP arp — Broadcast ARP Requests, Replies & GARP Failovers | EtherType 0x0806 | MAC-Only or IP | arp |
| 02 | vlan | IEEE 802.1Q Virtual LAN Tagging & 802.1p QoS vlan — 802.1Q Trunk Tags (0x8100) Without NIC Stripping | TPID 0x8100 (VID 1) | MAC-Only or IP | vlan |
| 03 | qinq | IEEE 802.1ad Provider Bridge Double VLAN Tagging (S-Tag + C-Tag) qinq — Double-Tagged 802.1ad S-Tag & 802.1Q C-Tag Frames | Outer 0x88a8 + Inner 0x8100 | MAC-Only or IP | vlan.etype == 0x88a8 || vlan |
| 04 | lldp | IEEE 802.1AB Link Layer Discovery Protocol lldp — IEEE 802.1AB Neighbor Discovery TLV Frames | EtherType 0x88cc | MAC-Only or IP | lldp |
| 05 | stp | IEEE 802.1D Spanning Tree & IEEE 802.1w Rapid Spanning Tree stp — IEEE 802.1D STP & 802.1w RSTP BPDU Captures | 802.3 LLC 0x4242 -> 01:80:c2:00:00:00 | MAC-Only or IP | stp |
| 06 | lacp | IEEE 802.3ad / 802.1AX Link Aggregation Control Protocol lacp — IEEE 802.3ad Actor/Partner Link Aggregation PDUs | EtherType 0x8809 (Slow Subtype 0x01) | MAC-Only or IP | lacp |
| 07 | eapol | IEEE 802.1X Port-Based Network Access Control (EAP over LAN) eapol — IEEE 802.1X Port Authentication & EAPOL Frames | EtherType 0x888e -> 01:80:c2:00:00:03 | MAC-Only or IP | eapol || eap |
| 08 | mpls | Multiprotocol Label Switching Unicast Shim mpls — 32-Bit RFC 3032 MPLS Label Shims (0x8847) | EtherType 0x8847 (Label 16) | MAC-Only or IP | mpls |