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

qinq — Double-Tagged 802.1ad S-Tag & 802.1Q C-Tag Frames

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)
L2 Tagging: Native 802.1Q / 802.1adHost Family: MAC-Only or IPL3 QoS & TTL: N/A (Pure L2)L4 State: L2 Ethernet

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.

01. Application

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.

02. Application

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.

03. Application

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.

Fig. 1 · RFC Octet & Bit Schematic

RFC Wire Header Layout (qinq)

Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.

0 ··············· 15 · 16 ··············· 31 bit
Selected Wire Segment
802.1ad QinQ Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
qinq qinq · innervlan · pcp · dei · payload · hexpayload
Compiler Default Behavior
RFC-compliant 802.1ad QinQ defaults (IEEE 802.1ad)
Wireshark Dissection Note · Verifying Outer 0x88a8 S-Tag + Inner 0x8100 C-Tag

Expand both IEEE 802.1ad (vlan.etype == 0x88a8) and inner IEEE 802.1Q layers in Wireshark; add vlan.id as a custom column to view stacked S-VLAN / C-VLAN tags side by side.

Minimal Quickstart (qinq_quickstart.frasm)

Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in 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
}

Handled Automatically on the Wire

  • 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 Example

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.2.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

# 4. Verify dissected protocol fields in tshark
tshark -r qinq_metro_nni.pcap -Y "vlan.etype == 0x88a8 || vlan"

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> | ethertype <0..65535>Colon/hyphen/Cisco MAC · EtherType u16 (e.g. 0x0800)Host MAC / RFC multicast MAC / auto EtherTypeOverrides the 14-byte Ethernet II source MAC, destination MAC, or 16-bit EtherType 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> [label <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

Rejected
a -> b qinq 500 inner_vlan 20
Valid v3.2.2 Syntax
a -> b qinq 500 innervlan 20

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

Account for 8 Extra Header Bytes on Path MTU Tests

Rejected
Assuming 1500B Ethernet payload without baby-giant MTU
Valid v3.2.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