Protocol 47 of 81Layer 3FrameAssembly v3.3.0
Raw .mdllms-full.txt
l2tpLayer Two Tunneling Protocol v2 & v3

l2tp — UDP 1701 Broadband L2TPv2 & IP Proto 115 L2TPv3 Tunnels

Default Port / Protocol
UDP 1701 (v2) / IP Proto 115 or transport udp (v3)
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
l2tp
Standards & Specs
RFC 2661, RFC 3931
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6L2TPv2 & L2TPv3 (UDP 1701 (v2) / IP Proto 115 or transport udp (v3))
L2 Tagging: vlan · qinq · repeatable mpls · fcsHost Family: Dual-Stack IPv4/IPv6L3 QoS & TTL: ttl · dscp · ecnL4 State: UDP (+ transport udp)

What It Does on the Wire

Whether you are debugging an ISP LAC <-> LNS sccrq/sccrp/scccn tunnel on UDP 1701 (v2) or a carrier L2TPv3 Ethernet pseudowire on IP Protocol 115 (v3 or transport udp), l2tp builds both cleanly.

Layer Two Tunneling Protocol (l2tp, RFC 2661 L2TPv2 / RFC 3931 L2TPv3) powers ISP broadband subscriber wholesale handoffs (PPPoE LAC <-> LNS over UDP 1701), L2TP/IPsec remote-access VPNs, and carrier Layer 2 Ethernet pseudowires (L2TPv3 directly over IP Protocol 115 or over UDP 1701 when transport udp is added).

FrameAssembly encodes both L2TPv2 (v2, default) with 16-bit Tunnel ID / Session ID headers on UDP 1701 and L2TPv3 (v3) with 32-bit Control Connection ID / Session ID headers on IP Protocol 115 (or UDP 1701 via transport udp), packing mandatory AVP TLVs (Message Type AVP 0, Protocol Version, Host Name, Assigned Tunnel ID) on sccrq, sccrp, scccn, hello, and stopccn control frames.

01. Application

Broadband BNG / LAC <-> LNS Wholesale Tunnel Bring-Up

Script the 3-way L2TPv2 control handshake (sccrq -> sccrp -> scccn) with sequence tracking (ns / nr) followed by data PPP payload frames on UDP 1701.

02. Application

Carrier L2TPv3 Ethernet Pseudowire (IP Proto 115 vs transport udp)

Test WAN core ACLs and firewall passthrough for native IP Protocol 115 (l2tp v3) and NAT-friendly UDP-encapsulated L2TPv3 (l2tp v3 ... transport udp).

03. Application

L2TP/IPsec Remote-Access VPN Split-Stack Troubleshooting

Pair ikev2 + esp outer tunnel negotiations with inner l2tp v2 UDP 1701 control/session captures for TAC packet comparison.

Fig. 1 · RFC Octet & Bit Schematic

RFC Wire Header Layout (l2tp)

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
L2TPv2 & L2TPv3 Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
l2tp v2 · sccrq · tunnelid · ns · flags · payload · hexpayload
Compiler Default Behavior
RFC-compliant L2TPv2 & L2TPv3 defaults (RFC 2661)

Minimal Quickstart (l2tp_quickstart.frasm)

Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.

l2tp_quickstart.frasm8 lines
Open in Playground
host lac_bng { ip 172.16.50.10 }
host lns_isp { ip 172.16.50.20 }
compile {
lac_bng -> lns_isp l2tp v2 sccrq tunnelid 0 ns 0 nr 0 wait 2ms
lac_bng <- lns_isp l2tp v2 sccrp tunnelid 100 ns 0 nr 1 wait 2ms
lac_bng -> lns_isp l2tp v2 scccn tunnelid 100 ns 1 nr 1
}

Handled Automatically on the Wire

  • Uses UDP 1701 automatically for v2 (RFC 2661, 16-bit IDs) and switches to raw IP Protocol 115 for v3 (RFC 3931, 32-bit IDs) unless transport udp is specified.
  • Sets the T=1, L=1, S=1 control bits and appends mandatory M=1 IETF AVP 0 (Message Type: 1=SCCRQ, 2=SCCRP, 3=SCCCN, 4=StopCCN, 6=Hello) on control packets, or T=0 header framing on data packets.
  • Computes exact L2TP header Length and AVP 10-bit length fields across both v2 and v3.
Multi-Frame Example

ISP LAC <-> LNS L2TPv2 Control Handshake + L2TPv3 IP Proto 115 Pseudowire

Establishes an L2TPv2 tunnel (tunnelid 500, sessionid 1) over UDP 1701, transmits subscriber data, and sends an L2TPv3 pseudowire frame over raw IP Protocol 115.

l2tp_v2_and_v3_pseudowire.frasm14 lines
Open in Playground
host access_lac { ip 10.80.1.10 }
host core_lns { ip 10.80.1.20 }
compile {
// 1. L2TPv2 3-way control connection setup on UDP 1701
access_lac -> core_lns l2tp v2 sccrq tunnelid 0 sessionid 0 ns 0 nr 0 wait 1ms
access_lac <- core_lns l2tp v2 sccrp tunnelid 500 sessionid 0 ns 0 nr 1 wait 1ms
access_lac -> core_lns l2tp v2 scccn tunnelid 500 sessionid 0 ns 1 nr 1 wait 2ms
// 2. Subscriber PPP session data frame + tunnel Hello keepalive
access_lac -> core_lns l2tp v2 data tunnelid 500 sessionid 1 payload "ppp-lcp-echo" wait 2ms
access_lac <- core_lns l2tp v2 hello tunnelid 500 sessionid 0 ns 1 nr 2 wait 2ms
// 3. L2TPv3 pseudowire data frame directly over IP Protocol 115 (32-bit sessionid)
access_lac -> core_lns l2tp v3 data sessionid 0x00010055 payload "l2tpv3-eth-pw"
}
Terminal Commands (FrameAssembly CLI v3.3.0)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show l2tp_v2_and_v3_pseudowire.frasm

# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly l2tp_v2_and_v3_pseudowire.frasm l2tp_v2_and_v3_pseudowire.pcap
frameassembly l2tp_v2_and_v3_pseudowire.frasm l2tp_v2_and_v3_pseudowire.pcapng

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

# 4. Verify dissected protocol fields in tshark
tshark -r l2tp_v2_and_v3_pseudowire.pcap -Y "l2tp"

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

src_host -> dst_host l2tp [v2 | v3 | version <2|3>] [hello | sccrq | sccrp | scccn | stopccn | data | msgtype "<text>" | msgtype <0..65535>] [tunnelid <number>] [sessionid <number>] [ns <0..65535>] [nr <0..65535>] [flags <0..65535>] [transport udp]
Keyword / OptionAccepted ValueDefaultEffect on Packet
v2 | v3 | version <2|3>L2TP protocol version (2 or 3)v2 (RFC 2661, UDP 1701)v2 emits 16-bit Tunnel/Session IDs over UDP 1701; v3 emits 32-bit Connection/Session IDs over IP Protocol 115 (or UDP 1701 with transport udp).
sccrq | sccrp | scccn | stopccn | hello | data | msgtype <0..65535|"<text>">Control AVP message type or data modesccrq (Control Type 1) or dataSelects L2TP control AVP 0 (1=SCCRQ, 2=SCCRP, 3=SCCCN, 4=StopCCN, 6=Hello) or T=0 data encapsulation.
tunnelid <number> | sessionid <number>16-bit (v2) or 32-bit (v3) identifierstunnelid 1, sessionid 1Sets the Tunnel / Control Connection ID and Session ID in the L2TP header.
ns <0..65535> | nr <0..65535>16-bit Send (Ns) and Next Expected (Nr) sequence countersns 0, nr 0Writes the 16-bit Ns and Nr reliable control-channel sequence numbers.
flags <0..65535>16-bit L2TP header flags/version word overrideAuto (0xc802 control / 0x4002 data on v2)Explicitly overrides the 16-bit T/L/S/O/P/Ver flags bitmask.
transport udpOptional UDP encapsulation override for L2TPv3UDP 1701 on v2; IP Proto 115 on v3Encapsulates l2tp v3 frames inside UDP port 1701 instead of raw IP Protocol 115 (RFC 3931 UDP mode).

Cross-Layer Wrappers Valid with l2tp

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

14 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).
comment "<text>"Quoted UTF-8 annotationOmittedAttaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac> | ethertype <0..65535>Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800)Host MAC / RFC multicast MAC / auto EtherTypeOverrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType.
fcs | badfcsEthernet CRC-32 trailer flags (choose one)Omittedfcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests.
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).
mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255)Unlabeled (auto bos=0 on outer labels, bos=1 on bottom)Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads.
ttl <0..255> [dscp <0..63>] [ecn <0..3>]TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3ttl 64, dscp 0, ecn 0Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings.
ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum]IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum faultipid 1, flags 0, fragoffset 0, valid RFC 1071 checksumSets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (20 04 00 00), or corrupts the 16-bit IPv4 header checksum (badipchecksum).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only).
srcport <0..65535> | dstport <0..65535>Port number 0..65535srcport 49152 (remembered), UDP 1701 (v2) / IP Proto 115 or transport udp (v3)Overrides source or destination port and remembers the port pair automatically on <- replies.
transport udpOptional UDP encapsulation overrideL2TPv2 UDP 1701 / L2TPv3 IP Proto 115 (UDP 1701 when transport udp is set)Wraps the protocol frame inside an IPv4/IPv6 + UDP header instead of raw Ethernet or raw IP encapsulation.
badchecksum | nochecksumL4 checksum fault or UDP zero-checksum flagValid RFC checksum / CRC-32cbadchecksum corrupts the L4 checksum for negative firewall/NIC offload tests; nochecksum writes 0x0000 in UDP headers.

Gotchas & Quick Fixes

L2TPv3 Defaults to IP Protocol 115 Unless You Add transport udp

Rejected
pe1 -> pe2 l2tp v3 data sessionid 100 dstport 1701
Valid v3.3.0 Syntax
pe1 -> pe2 l2tp v3 data sessionid 100 transport udp dstport 1701

Raw l2tp v3 runs directly over IP Protocol 115 (no UDP header); add transport udp whenever you want UDP-encapsulated L2TPv3 or custom UDP ports.

TCP Transport Is Invalid on L2TP

Rejected
lac -> lns l2tp v2 sccrq transport tcp
Valid v3.3.0 Syntax
lac -> lns l2tp v2 sccrq

L2TP runs strictly over UDP (1701) or IP Protocol 115—never TCP.

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