Protocol 8 of 81Layer 2FrameAssembly v3.1.2
llms-full.txt
mplsMultiprotocol Label Switching Unicast Shim

Push a 32-Bit Label Shim (0x8847 MPLS -> IPv4 / IPv6)

Default Port / Protocol
EtherType 0x8847 (Label 16)
Host Endpoint Rule
MAC-Only or IP
Wireshark Display Filter
mpls
Standards & Specs
RFC 3032, RFC 5462
Wire Stack:Ethernet IIMPLS Shim (0x8847)

What It Does on the Wire

No need to boot four virtual provider-edge routers just to get a 4-byte 0x8847 shim — tack mpls 16040 exp 6 bos 1 mplsttl 64 onto any packet line and call it a day.

Multiprotocol Label Switching (mpls) inserts a 32-bit shim header (EtherType 0x8847) between Layer 2 Ethernet/VLAN headers and the inner Layer 3 packet. The 4-byte shim packs a 20-bit Label (0..1048575), 3-bit Traffic Class / Experimental QoS field (exp or tc), 1-bit Bottom-of-Stack indicator (bos), and an 8-bit MPLS Time-To-Live (mplsttl).

In FrameAssembly v3.1.2, mpls works both as a standalone Layer 2 protocol (p1 -> p2 mpls 16000 exp 5 bos 1 mplsttl 64) between MAC-only Label Switch Routers (LSRs) and as a cross-layer modifier attached once to any IPv4 or IPv6 packet statement.

Service Provider L3VPN & Segment Routing (SR-MPLS) Captures

Wrap customer HTTP, DNS, BGP, or ICMPv6 traffic inside Nodal SIDs (16001..23999) with exp 5 / exp 6 QoS bits to test core P/PE packet dissectors and hardware taps.

MPLS TTL Expiration & Traceroute Simulation

Craft mplsttl 1 frames alongside icmp timeexceeded replies to verify MPLS traceroute visibility across label-switched paths.

VLAN + MPLS Carrier Interconnect Auditing

Combine 802.1Q vlan or 802.1ad qinq sub-interface tags with mpls shims on the same statement to reproduce PE handoff captures.

Minimal Quickstart (mpls_quickstart.frasm)

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

mpls_quickstart.frasm6 lines
Open in Playground
host pe_west { mac 00:1c:73:aa:00:01 }
host p_core { mac 00:1c:73:bb:00:02 }
compile {
pe_west -> p_core mpls 16000
}

What the Compiler Calculates So You Don't Have To

  • 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.
  • When attached as a cross-layer modifier on an IPv4 or IPv6 frame, places the complete checksummed IP + L4 + L7 packet immediately after the Bottom-of-Stack MPLS shim.
Multi-Frame Lab · Ready to Compile

SR-MPLS L3VPN Core Transit Over 802.1Q Sub-Interfaces

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.

mpls_sr_l3vpn.frasm16 lines
Open in Playground
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
}
Terminal Commands (FrameAssembly CLI v3.1.2)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show mpls_sr_l3vpn.frasm

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

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

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

src_host -> dst_host mpls [<0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
mpls [<0..1048575>] | label <0..1048575>20-bit unsigned integer (0..1048575)16Sets the 20-bit MPLS Label (0..15 reserved special-purpose labels such as 0 IPv4 Explicit Null / 3 Implicit Null; 16..1048575 general labels).
exp <0..7> | tc <0..7>3-bit unsigned integer (0..7)0Sets the 3-bit RFC 5462 Traffic Class (formerly Experimental EXP) QoS field (tc and exp are exact aliases).
bos <0|1>1-bit flag (0 or 1)1Sets the Bottom-of-Stack bit (1 marks the innermost label preceding the L3 payload).
mplsttl <0..255>Whole number (0..255) (0..255)64Sets the 8-bit MPLS shim TTL independently of the inner IPv4/IPv6 ttl modifier.

Cross-Layer Wrappers Valid with mpls

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

Gotchas & Quick Fixes

At Most One mpls (Or label) Clause Per Packet Line

Avoid
pe1 -> pe2 mpls label 16001 exp 6 bos 1
Valid v3.1.2 Syntax
pe1 -> pe2 mpls 16001 exp 6 bos 1

FrameAssembly supports one MPLS shim per packet, and label <0..1048575> is an alias for mpls <0..1048575> on L3/L7 packets. On a standalone mpls frame, pass the label number directly (mpls 16001) instead of combining mpls and label.

Use mplsttl for the Shim TTL vs ttl for Inner IP

Avoid
Assuming ttl 255 changes the MPLS shim TTL
Valid v3.1.2 Syntax
pe1 -> pe2 icmp ttl 64 mpls 16000 mplsttl 255

mplsttl controls the 8-bit TTL inside the MPLS shim (0x8847), whereas ttl controls the inner IPv4 Time-To-Live or IPv6 Hop Limit.

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