# Layer 2 Switching, VLAN, QinQ, 802.1X & MPLS Examples

> **FrameAssembly v3.2.2** · Anthology 01 (Layer 2 · 14 Recipes) · MIT License · Canonical URL: https://frameassembly-lang.dev/docs/examples/l2-switching-vlans-nac

Rootless Ethernet II switching captures with MAC-only endpoints, 802.1Q VLAN trunks, 802.1ad QinQ double tags, IEEE slow-protocol multicast MACs, 802.1X EAPOL onboarding, and MPLS shim labels.

## Key Wire & Syntax Takeaways

- Pure Layer 2 protocols (`arp`, `vlan`, `qinq`, `lldp`, `stp`, `lacp`, `eapol`, `mpls`) support MAC-only `host` blocks without IP addresses.
- IEEE group destination MACs (`01:80:c2:00:00:00`, `01:80:c2:00:00:02`, `01:80:c2:00:00:03`, `01:80:c2:00:00:0e`) and broadcast ARP `ff:ff:ff:ff:ff:ff` populate automatically.
- `vlan <vid>`, `qinq <svid> innervlan <cvid>`, and `mpls <label>` work both standalone and as cross-layer prefixes on any L3–L7 packet.

## 01.01 · MAC-Only Switch Control-Plane Bundle (LLDP + RSTP + LACP) (`switch_l2_control_plane.frasm`)

Pure Layer 2 switching protocols do not require IP addresses on endpoints. This capture declares Cisco dot-quad MAC-only hosts and emits IEEE group-MAC LLDP, Rapid STP, and LACP frames on a trunk.

- **Protocols:** `lldp`, `stp`, `lacp` (3 Ethernet frames)
- **Wire Behavior:** Automatically populates IEEE slow/bridge multicast destination MACs (01:80:c2:00:00:0e, 01:80:c2:00:00:00, and 01:80:c2:00:00:02).
- **Wireshark Filter:** `lldp || stp || slow`
- **CLI Build:** `frameassembly switch_l2_control_plane.frasm`

```frameassembly
host leaf_sw1  { mac 001c.73aa.0001 }
host spine_sw1 { mac 001c.73bb.0001 }

compile {
    leaf_sw1 -> spine_sw1 lldp chassisid "leaf-sw1" portid "Ethernet49/1" ttl 120 sysname "leaf-sw1.dc1" wait 2ms
    spine_sw1 -> leaf_sw1 stp rstp rootid "32768:00:1c:73:bb:00:01" bridgeid "32768:00:1c:73:bb:00:01" portid 0x8001 cost 2000 hellotime 2 wait 2ms
    leaf_sw1 -> spine_sw1 lacp actorsys 00:1c:73:aa:00:01 actorkey 10 actorport 49 partnersys 00:1c:73:bb:00:01 partnerkey 10 partnerport 1
}
```

## 01.02 · IEEE 802.1X Supplicant Onboarding (EAPOL-Start, Identity & Key) (`nac_8021x_eapol_exchange.frasm`)

Models a wired workstation authenticating to a NAC-enabled access switch over EtherType 0x888e before receiving an IP lease.

- **Protocols:** `eapol` (5 Ethernet frames)
- **Wire Behavior:** Targets PAE multicast MAC 01:80:c2:00:00:03 on supplicant frames and steps through EAP-Request/Response Identity (eapmethod 1) and EAP-Success (eapcode 3).
- **Wireshark Filter:** `eapol || eap`
- **CLI Build:** `frameassembly nac_8021x_eapol_exchange.frasm`

```frameassembly
host corp_laptop { mac 00:24:9b:11:22:33 }
host access_sw   { mac 00:1c:73:00:10:01 }

compile {
    corp_laptop -> access_sw eapol version 2 start wait 3ms
    corp_laptop <- access_sw eapol version 2 eappacket eapcode 1 eapid 1 eapmethod 1 wait 2ms
    corp_laptop -> access_sw eapol version 2 eappacket eapcode 2 eapid 1 eapmethod 1 identity "host/wkstn-42.corp.internal" wait 8ms
    corp_laptop <- access_sw eapol version 2 eappacket eapcode 3 eapid 1 wait 2ms
    corp_laptop <- access_sw eapol version 2 key
}
```

## 01.03 · MPLS L3VPN Shim Label with Traffic-Class QoS Marking (`mpls_l3vpn_exp5.frasm`)

Wraps an inter-site ICMP Echo exchange inside a 20-bit MPLS transport label (16040) with Traffic Class / EXP 5 for core voice-grade forwarding checks.

- **Protocols:** `mpls`, `icmp` (2 Ethernet frames)
- **Wire Behavior:** Prepends EtherType 0x8847 with label 16040, exp 5, bos 1, and decremented mplsttl on the return path.
- **Wireshark Filter:** `mpls.label == 16040`
- **CLI Build:** `frameassembly mpls_l3vpn_exp5.frasm`

```frameassembly
host pe_west { ip 10.254.0.1 mac 00:1c:73:10:00:01 }
host pe_east { ip 10.254.0.2 mac 00:1c:73:20:00:02 }

compile {
    pe_west -> pe_east mpls 16040 exp 5 bos 1 mplsttl 64 icmp echorequest id 0x0901 seq 1 wait 4ms
    pe_west <- pe_east mpls 24010 exp 5 bos 1 mplsttl 63 icmp echoreply id 0x0901 seq 1
}
```

## 01.04 · Local Subnet ARP Discovery Sweep (`scan_arp_lan_sweep.frasm`)

Broadcasts Layer 2 ARP Who-Has requests across three local subnet IPs, showing two online hosts answering with their MACs and one unused IP staying silent.

- **Protocols:** `arp` (5 Ethernet frames)
- **Wire Behavior:** arp request automatically sets the Ethernet destination MAC to ff:ff:ff:ff:ff:ff (broadcast), while <- arp reply sends a unicast response straight back to the scanner.
- **Wireshark Filter:** `arp`
- **CLI Build:** `frameassembly scan_arp_lan_sweep.frasm`

```frameassembly
// Technician laptop scanning three local /24 addresses on the same VLAN
host tech_laptop { ip 192.168.10.200 mac 00:1a:2b:00:00:aa }
host router_gw   { ip 192.168.10.1   mac 00:1c:73:00:00:01 }
host nas_box     { ip 192.168.10.50  mac 00:11:32:aa:bb:cc }
host unused_ip   { ip 192.168.10.51 }

compile {
    // Probe .1 -> Gateway answers with its MAC
    tech_laptop -> router_gw arp request senderip 192.168.10.200 targetip 192.168.10.1 wait 1ms
    tech_laptop <- router_gw arp reply senderip 192.168.10.1 targetip 192.168.10.200 wait 2ms

    // Probe .50 -> NAS answers with its MAC
    tech_laptop -> nas_box arp request senderip 192.168.10.200 targetip 192.168.10.50 wait 1ms
    tech_laptop <- nas_box arp reply senderip 192.168.10.50 targetip 192.168.10.200 wait 2ms

    // Probe .51 -> No host owns this IP, so no ARP reply comes back
    tech_laptop -> unused_ip arp request senderip 192.168.10.200 targetip 192.168.10.51
}
```

## 01.05 · 802.1ad QinQ Double-Tag VLAN Hopping Trunk Audit (`pentest_qinq_vlan_hop.frasm`)

Builds an 802.1ad/802.1Q double-tagged frame (outer S-VLAN 100 + inner C-VLAN 20) to verify access switch ports drop unexpected outer tags instead of forwarding into a protected VLAN.

- **Protocols:** `qinq`, `vlan`, `icmp` (2 Ethernet frames)
- **Wire Behavior:** qinq 100 innervlan 20 stacks outer EtherType 0x88a8 (VID 100) ahead of inner EtherType 0x8100 (VID 20) so you can audit trunk native-VLAN hardening.
- **Wireshark Filter:** `vlan.id == 100 || vlan.id == 20`
- **CLI Build:** `frameassembly pentest_qinq_vlan_hop.frasm`

```frameassembly
// Lab test host on VLAN 100 auditing switch isolation toward restricted VLAN 20
host audit_port { ip 10.20.0.99 mac 02:aa:bb:cc:dd:01 }
host restricted { ip 10.20.0.10 mac 00:1c:73:20:00:10 }

compile {
    // 1. Send double-tagged frame (outer S-Tag 100, inner C-Tag 20)
    audit_port -> restricted qinq 100 innervlan 20 icmp echorequest id 0x1337 seq 1 payload "vlan-hop-audit" wait 3ms

    // 2. Simulated misconfigured trunk stripping outer tag and delivering single-tagged VLAN 20 frame
    audit_port -> restricted vlan 20 icmp echorequest id 0x1337 seq 1 payload "vlan-hop-audit"
}
```

## 01.06 · Gratuitous ARP Spoof Test & Unauthorized Egress TLS SNI Audit (`pentest_garp_egress_tls.frasm`)

Tests switch Dynamic ARP Inspection (DAI) against an unauthorized Gratuitous ARP claim, followed by an egress TLS ClientHello to an unapproved external domain.

- **Protocols:** `arp`, `tcp`, `tls` (5 Ethernet frames)
- **Wire Behavior:** arp gratuitous broadcasts senderip == targetip to ff:ff:ff:ff:ff:ff—ideal for verifying DAI port-shutdown rules in a isolated lab.
- **Wireshark Filter:** `arp.isgratuitous || tls.handshake.extensions_server_name`
- **CLI Build:** `frameassembly pentest_garp_egress_tls.frasm`

```frameassembly
// Rogue lab device, default gateway IP, and external cloud endpoint
host rogue_box   { ip 10.20.5.99 mac 02:de:ad:be:ef:99 }
host vlan_gw     { ip 10.20.5.1  mac 00:1c:73:05:00:01 }
host ext_storage { ip 198.51.100.77 }

compile {
    // 1. Gratuitous ARP announcement claiming the gateway's 10.20.5.1 IP (tests switch DAI)
    rogue_box -> vlan_gw arp gratuitous senderip 10.20.5.1 sendermac 02:de:ad:be:ef:99 wait 5ms

    // 2. Outbound TCP 443 + TLS ClientHello to test egress SNI filtering / DLP alerts
    rogue_box -> ext_storage tcp syn srcport 54900 dstport 443 win 65535 mss 1460 wait 2ms
    rogue_box <- ext_storage tcp syn ack win 65535 mss 1460 wait 2ms
    rogue_box -> ext_storage tcp ack wait 1ms
    rogue_box -> ext_storage tls clienthello sni "unapproved-drop.example.net" alpn "h2"
}
```

## 01.07 · ARP / GARP (`arp`): VLAN-Tagged ARP Resolution Followed by Gratuitous ARP VIP Takeover (`arp_garp_failover.frasm`)

Simulates a workstation resolving its default gateway on VLAN 10, followed by a standby router broadcasting an RFC 5227 Gratuitous ARP announcement during a virtual IP takeover.

- **Protocols:** `arp`, `vlan` (3 Ethernet frames)
- **Wire Behavior:** Sets Ethernet II EtherType to `0x0806` and broadcasts `request` frames to destination MAC `ff:ff:ff:ff:ff:ff` unless `dstmac` is overridden. Populates Hardware Type `1` (Ethernet), Protocol Type `0x0800` (IPv4), `hlen=6`, `plen=4`, and `opcode=1` (`request`).
- **Wireshark Filter:** `arp`
- **CLI Build:** `frameassembly show arp_garp_failover.frasm`

```frameassembly
host workstation { ip 10.10.10.50 mac 00:1b:21:10:00:50 }
host rtr_active  { ip 10.10.10.1  mac 00:00:5e:00:01:01 }
host rtr_standby { ip 10.10.10.2  mac 00:1b:21:10:00:02 }

compile {
    // 1. Broadcast ARP Who-Has on VLAN 10
    workstation -> rtr_active arp request vlan 10 pcp 3 wait 1ms
    // 2. Unicast ARP Is-At reply from active gateway
    workstation <- rtr_active arp reply vlan 10 wait 5ms
    // 3. Standby router takes over VIP 10.10.10.1 and broadcasts GARP
    rtr_standby -> workstation arp gratuitous sendermac 00:00:5e:00:01:01 senderip 10.10.10.1 vlan 10
}
```

## 01.08 · 802.1Q VLAN (`vlan`): Multi-VLAN Trunk Capture Mixing Standalone L2 Probes & Voice/Routing CoS (`vlan_trunk_qos.frasm`)

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.

- **Protocols:** `vlan` (5 Ethernet frames)
- **Wire Behavior:** 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.
- **Wireshark Filter:** `vlan`
- **CLI Build:** `frameassembly show vlan_trunk_qos.frasm`

```frameassembly
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
}
```

## 01.09 · 802.1ad QinQ (`qinq`): Provider NNI Trunk Carrying Multiple Customer C-VLANs Inside S-VLAN 1200 (`qinq_metro_nni.frasm`)

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.

- **Protocols:** `qinq`, `tcp` (6 Ethernet frames)
- **Wire Behavior:** 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).
- **Wireshark Filter:** `vlan.etype == 0x88a8 || vlan`
- **CLI Build:** `frameassembly show qinq_metro_nni.frasm`

```frameassembly
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
}
```

## 01.10 · LLDP (`lldp`): Bidirectional Leaf-Spine LLDP Neighbor Exchange Plus Shutdown Frame (`lldp_leaf_spine.frasm`)

Captures mutual LLDP advertisements between an Arista-class spine and an access switch, followed by an IEEE 802.1AB `ttl 0` neighbor withdrawal frame.

- **Protocols:** `lldp` (3 Ethernet frames)
- **Wire Behavior:** Sets Ethernet II EtherType to `0x88cc` and defaults the destination MAC to IEEE nearest-bridge multicast `01:80:c2:00:00:0e`. Encodes TLV 1 (Chassis ID, subtype `4` MAC or `7` Locally Assigned), TLV 2 (Port ID, subtype `5` Interface Name), and TLV 3 (16-bit `ttl`, default `120` seconds) with exact 7-bit type + 9-bit length bitfields.
- **Wireshark Filter:** `lldp`
- **CLI Build:** `frameassembly show lldp_leaf_spine.frasm`

```frameassembly
host leaf_01  { mac 00:1c:73:11:22:01 }
host spine_01 { mac 00:1c:73:99:88:01 }

compile {
    leaf_01 -> spine_01 lldp chassisid "leaf-01.dc1" portid "Ethernet49/1" ttl 120 sysname "leaf-01.dc1.internal" sysdesc "EOS 4.32.1F" wait 5ms
    spine_01 -> leaf_01 lldp chassisid "spine-01.dc1" portid "Ethernet1/1" ttl 120 sysname "spine-01.dc1.internal" sysdesc "EOS 4.32.1F" wait 10ms
    // Graceful LLDP port shutdown advertisement (TTL = 0)
    leaf_01 -> spine_01 lldp chassisid "leaf-01.dc1" portid "Ethernet49/1" ttl 0
}
```

## 01.11 · STP / RSTP (`stp`): Normal Root RSTP Heartbeat Followed by Rogue Superior BPDU Attack (`stp_rogue_root_audit.frasm`)

Captures a legitimate distribution switch sending RSTP BPDUs (`priority 32768`), followed by a rogue access device advertising priority `4096` (`cost 0`) to trigger Root Guard / BPDU Guard.

- **Protocols:** `stp` (3 Ethernet frames)
- **Wire Behavior:** Addresses Ethernet destination to IEEE Bridge Group multicast `01:80:c2:00:00:00` and writes the exact IEEE 802.3 Payload Length field instead of an Ethernet II EtherType. Prepends the 3-byte LLC header (`0x42 0x42 0x03`) and Protocol Identifier `0x0000` ahead of the Configuration or RSTP BPDU.
- **Wireshark Filter:** `stp`
- **CLI Build:** `frameassembly show stp_rogue_root_audit.frasm`

```frameassembly
host dist_root  { mac 00:1c:73:01:00:01 }
host access_sw  { mac 00:1c:73:02:00:10 }
host rogue_port { mac 00:50:56:99:99:99 }

compile {
    // Legitimate RSTP Proposal/Learning-Forwarding BPDU from distribution root
    dist_root -> access_sw stp rstp rootid "32768:00:1c:73:01:00:01" bridgeid "32768:00:1c:73:01:00:01" portid 0x8001 cost 0 flags 0x3c wait 2s
    // Downstream access switch relaying root path cost 20000
    access_sw -> rogue_port stp rstp rootid "32768:00:1c:73:01:00:01" bridgeid "32768:00:1c:73:02:00:10" portid 0x8018 cost 20000 flags 0x3c wait 500ms
    // Rogue device injecting a superior Root ID (priority 4096, cost 0)
    rogue_port -> access_sw stp rstp rootid "4096:00:50:56:99:99:99" bridgeid "4096:00:50:56:99:99:99" portid 0x8001 cost 0 flags 0x0e
}
```

## 01.12 · LACP (`lacp`): LACP Port-Channel Bring-Up From Unsynced Defaulted to Active Distributing (`lacp_negotiation.frasm`)

Models a Linux bond interface and Top-of-Rack switch negotiating Port-Channel 10 (`key 10`) from initial unsynced discovery (`actorstate 0x45`) to full `0x3f` Fast-LACP Collecting/Distributing sync.

- **Protocols:** `lacp` (4 Ethernet frames)
- **Wire Behavior:** Sets Ethernet II EtherType to Slow Protocols `0x8809`, destination MAC to `01:80:c2:00:00:02`, Subtype `0x01` (LACP), and Version `0x01`. Builds the exact 110-byte LACPDU body: Actor TLV (`0x01`, 20B), Partner TLV (`0x02`, 20B), Collector TLV (`0x03`, 16B, MaxDelay `0x8000`), Terminator TLV (`0x00`), and 50 zero-pad octets.
- **Wireshark Filter:** `lacp`
- **CLI Build:** `frameassembly show lacp_negotiation.frasm`

```frameassembly
host srv_bond0 { mac 00:1b:21:44:55:01 }
host tor_leaf1 { mac 00:1c:73:88:99:01 }

compile {
    // 1. Initial server LACPDU: Active + ShortTimeout + Aggregatable + Defaulted (0x47)
    srv_bond0 -> tor_leaf1 lacp actorkey 10 actorport 1 actorstate 0x47 partnerkey 0 partnerport 0 partnerstate 0x00 wait 5ms
    // 2. Switch replies recognizing server Actor as Partner and setting In-Sync (0x0f)
    tor_leaf1 -> srv_bond0 lacp actorkey 10 actorport 49 actorstate 0x0f partnersys 00:1b:21:44:55:01 partnerkey 10 partnerport 1 partnerstate 0x47 wait 5ms
    // 3. Both sides enter Active + Fast + Aggregatable + Sync + Collecting + Distributing (0x3f)
    srv_bond0 -> tor_leaf1 lacp actorkey 10 actorport 1 actorstate 0x3f partnersys 00:1c:73:88:99:01 partnerkey 10 partnerport 49 partnerstate 0x0f wait 2ms
    tor_leaf1 -> srv_bond0 lacp actorkey 10 actorport 49 actorstate 0x3f partnersys 00:1b:21:44:55:01 partnerkey 10 partnerport 1 partnerstate 0x3f
}
```

## 01.13 · 802.1X EAPOL (`eapol`): Full IEEE 802.1X Supplicant Onboarding With Upstream RADIUS Verification (`eapol_8021x_nac.frasm`)

Traces a workstation sending `EAPOL-Start`, answering an `EAP-Request/Identity` challenge, triggering an upstream `RADIUS Access-Request/Accept` on the switch, and receiving `EAP-Success`.

- **Protocols:** `eapol` (6 Ethernet frames)
- **Wire Behavior:** Sets Ethernet II EtherType to `0x888e` and defaults destination MAC to the IEEE 802.1X PAE group address `01:80:c2:00:00:03`. Writes the 4-byte EAPOL header (`Protocol Version` default `2`, `Packet Type`, and exact 16-bit `Packet Body Length`).
- **Wireshark Filter:** `eapol || eap`
- **CLI Build:** `frameassembly show eapol_8021x_nac.frasm`

```frameassembly
host laptop    { mac 00:1b:21:55:66:77 }
host access_sw { ip 10.20.0.2  mac 00:1c:73:00:01:02 }
host radius_srv { ip 10.20.0.50 mac 00:50:56:00:00:50 }

compile {
    // 1. Supplicant initiates 802.1X on physical switch port
    laptop -> access_sw eapol start version 2 wait 2ms
    // 2. Switch Authenticator requests EAP Identity (eapcode 1 = Request, eapmethod 1 = Identity)
    access_sw -> laptop eapol eappacket version 2 eapcode 1 eapid 1 eapmethod 1 dstmac 00:1b:21:55:66:77 wait 3ms
    // 3. Supplicant responds with corporate identity
    laptop -> access_sw eapol eappacket version 2 eapcode 2 eapid 1 eapmethod 1 identity "corp\\jdoe" wait 2ms
    // 4. Switch forwards authentication upstream to RADIUS AAA server
    access_sw -> radius_srv radius accessrequest id 10 user "corp\\jdoe" nasip 10.20.0.2 wait 4ms
    access_sw <- radius_srv radius accessaccept id 10 framedip 10.20.100.45 wait 2ms
    // 5. Switch grants port access with EAP-Success (eapcode 3)
    access_sw -> laptop eapol eappacket version 2 eapcode 3 eapid 1 dstmac 00:1b:21:55:66:77
}
```

## 01.14 · MPLS (`mpls`): SR-MPLS L3VPN Core Transit Over 802.1Q Sub-Interfaces (`mpls_sr_l3vpn.frasm`)

Models two Provider Edge routers exchanging MPLS-labeled BGP control traffic, VoIP EF traffic (`exp 5`), and dual-stack IPv6 customer probes across VLAN 400.

- **Protocols:** `mpls`, `vlan`, `tcp` (6 Ethernet frames)
- **Wire Behavior:** Sets Ethernet II (or inner VLAN/QinQ) EtherType to `0x8847` (MPLS Unicast). Bit-packs the 20-bit `label` (`default 16`), 3-bit `exp`/`tc` (`default 0`), 1-bit `bos` (`default 1`), and 8-bit `mplsttl` (`default 64`) into the big-endian 32-bit RFC 3032 shim.
- **Wireshark Filter:** `mpls`
- **CLI Build:** `frameassembly show mpls_sr_l3vpn.frasm`

```frameassembly
host pe1_v4 { ip 10.100.1.10 mac 00:1c:73:10:01:01 }
host pe2_v4 { ip 10.100.2.20 mac 00:1c:73:20:02:02 }
host ce1_v6 { ip 2001:db8:50::10 mac 00:1c:73:10:01:01 }
host ce2_v6 { ip 2001:db8:60::20 mac 00:1c:73:20:02:02 }

compile {
    // 1. Standalone MPLS OAM probe over VLAN 400
    pe1_v4 -> pe2_v4 mpls 16001 exp 6 bos 1 mplsttl 64 vlan 400 payload "sr-oam-ping" wait 2ms
    // 2. L3VPN IPv4 HTTPS TLS ClientHello inside MPLS label 24010
    pe1_v4 -> pe2_v4 tcp syn srcport 52443 dstport 443 win 65535 mss 1440 vlan 400 mpls 24010 exp 4 bos 1 mplsttl 63 wait 1ms
    pe1_v4 <- pe2_v4 tcp syn ack win 65535 mss 1440 vlan 400 mpls 24020 exp 4 bos 1 mplsttl 63 wait 1ms
    pe1_v4 -> pe2_v4 tcp ack vlan 400 mpls 24010 exp 4 bos 1 mplsttl 63 wait 1ms
    pe1_v4 -> pe2_v4 tls clienthello sni "erp.vrf-prod.internal" alpn "h2" vlan 400 mpls 24010 exp 4 bos 1 mplsttl 63 wait 2ms
    // 3. 6VPE IPv6 ICMPv6 Echo inside MPLS label 24055
    ce1_v6 -> ce2_v6 icmp echorequest id 9 seq 1 vlan 400 mpls 24055 tc 5 bos 1 mplsttl 62
}
```
