Protocol 3 of 81Layer 2FrameAssembly v3.1.2
llms-full.txt
qinqIEEE 802.1ad Provider Bridge Double VLAN Tagging (S-Tag + C-Tag)

Double-Tag Like an ISP (0x88a8 S-Tag -> 0x8100 C-Tag)

Default Port / Protocol
Outer 0x88a8 + Inner 0x8100
Host Endpoint Rule
MAC-Only or IP
Wireshark Display Filter
vlan.etype == 0x88a8 || vlan
Standards & Specs
IEEE 802.1ad, IEEE 802.1Q
Wire Stack:Ethernet II802.1ad S-Tag (0x88a8)802.1Q C-Tag (0x8100)

What It Does on the Wire

Because one VLAN tag was too mainstream for carriers: qinq 500 innervlan 20 stacks an outer 0x88a8 S-Tag -> inner 0x8100 C-Tag on any packet line.

IEEE 802.1ad Provider Bridging (qinq) encapsulates customer VLAN traffic inside a carrier Service VLAN tag, emitting two consecutive 4-byte VLAN headers on the wire: an outer IEEE 802.1ad S-Tag (TPID 0x88a8) followed by an inner IEEE 802.1Q C-Tag (TPID 0x8100).

Like vlan, qinq works both as a standalone Layer 2 protocol on MAC-only provider switches and as an inline cross-layer modifier on any L3, L4, or L7 packet statement—allowing carrier engineers and security teams to test double-tagged BGP, PPPoE/DHCP subscriber flows, or VLAN-hopping IDS signatures in one line.

Metro Ethernet UNI / NNI Service Multiplexing

Verify carrier edge switches push, swap, or pop outer S-VLAN tags (qinq 500) while preserving customer C-VLAN tags (innervlan 10..innervlan 20) intact.

Deep Packet Inspection & Suricata Double-Tag Parsing

Confirm NDR sensors, firewalls, and packet brokers properly strip both 0x88a8 and 0x8100 headers before inspecting inner TLS, DNS, or SMB payloads.

Carrier Peering BGP & BFD Session Validation

Synthesize sub-interface QinQ eBGP and BFD control captures to validate router sub-interface encapsulation dot1q <s-vid> second-dot1q <c-vid> stanzas.

Minimal Quickstart (qinq_quickstart.frasm)

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

qinq_quickstart.frasm6 lines
Open in Playground
host pe_nni_a { mac 00:25:90:aa:00:01 }
host pe_nni_b { mac 00:25:90:bb:00:02 }
compile {
pe_nni_a -> pe_nni_b qinq 500 innervlan 20
}

What the Compiler Calculates So You Don't Have To

  • Always writes two complete 4-byte VLAN tags: outer TPID 0x88a8 (S-VLAN, default 100) followed immediately by inner TPID 0x8100 (C-VLAN, default innervlan 1).
  • Applies pcp (0..7) and dei (0|1) cleanly to the tag control headers and preserves the inner payload EtherType (0x0800 IPv4, 0x86dd IPv6, 0x0806 ARP).
  • Validates both outer S-VLAN and innervlan C-VLAN bounds (0..=4095) during semantic validation.
Multi-Frame Lab · Ready to Compile

Provider NNI Trunk Carrying Multiple Customer C-VLANs Inside S-VLAN 1200

Models a Metro Ethernet provider trunk (S-VLAN 1200) carrying two distinct customer tenants: Tenant A (innervlan 100) running BGP peering and Tenant B (innervlan 200) running ICMPv6.

qinq_metro_nni.frasm15 lines
Open in Playground
host ce_v4_a { ip 172.20.0.1 mac 00:1b:21:c1:00:01 }
host ce_v4_b { ip 172.20.0.2 mac 00:1b:21:c1:00:02 }
host ce_v6_a { ip 2001:db8:200::1 mac 00:1b:21:c2:00:01 }
host ce_v6_b { ip 2001:db8:200::2 mac 00:1b:21:c2:00:02 }
compile {
// Tenant A: eBGP Keepalive inside S-VLAN 1200 / C-VLAN 100
ce_v4_a -> ce_v4_b tcp syn srcport 51179 dstport 179 win 65535 mss 1452 qinq 1200 innervlan 100 pcp 6 wait 1ms
ce_v4_a <- ce_v4_b tcp syn ack win 65535 mss 1452 qinq 1200 innervlan 100 pcp 6 wait 1ms
ce_v4_a -> ce_v4_b tcp ack qinq 1200 innervlan 100 pcp 6 wait 1ms
ce_v4_a -> ce_v4_b bgp keepalive qinq 1200 innervlan 100 pcp 6 wait 3ms
// Tenant B: IPv6 Echo inside S-VLAN 1200 / C-VLAN 200
ce_v6_a -> ce_v6_b icmp echorequest id 42 seq 1 qinq 1200 innervlan 200 pcp 3 wait 1ms
ce_v6_a <- ce_v6_b icmp echoreply id 42 seq 1 qinq 1200 innervlan 200 pcp 3
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show qinq_metro_nni.frasm

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

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

All qinq 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 qinq:

src_host -> dst_host qinq [<outer_svlan 0..4095>] [innervlan <inner_cvlan 0..4095>] [pcp <0..7>] [dei <0|1>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
qinq [<0..4095>]12-bit outer S-VLAN ID (0..4095)100Sets the 12-bit Service VLAN ID inside the outer IEEE 802.1ad (0x88a8) header.
innervlan <0..4095>12-bit inner C-VLAN ID (0..4095)1Sets the 12-bit Customer VLAN ID inside the inner IEEE 802.1Q (0x8100) header.
pcp <0..7>3-bit unsigned integer (0..7)0Sets the Priority Code Point bits on the VLAN tag header.
dei <0|1>1-bit flag (0 or 1)0Sets the Drop Eligible Indicator bit on the outer S-Tag.

Cross-Layer Wrappers Valid with qinq

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.
vlan <0..4095> [pcp <0..7>] [dei <0|1>]VLAN ID 0..4095, PCP 0..7, DEI 0..1UntaggedWraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority.
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

Always Spell innervlan Without Underscores

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

Legacy underscored spellings such as inner_vlan or c_vlan are rejected by the v3.1.2 lexer with a self-healing diagnostic suggesting innervlan.

Account for 8 Extra Header Bytes on Path MTU Tests

Avoid
Assuming 1500B Ethernet payload without baby-giant MTU
Valid v3.1.2 Syntax
a -> b tcp syn mss 1452 qinq 500 innervlan 20

QinQ adds 8 bytes (0x88a8 + 0x8100) to the Layer 2 header, increasing a standard 1514-byte Ethernet frame to 1522 bytes on carrier trunks.

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