Protocol 49 of 81Layer 3FrameAssembly v3.3.0
Raw .mdllms-full.txt
gtpuGPRS Tunneling Protocol User Plane (4G S1-U & 5G N3/N9)

gtpu — UDP 2152 4G S1-U & 5G N3 User-Plane Tunnels (TEID + QFI)

Default Port / Protocol
UDP 2152
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
gtp
Standards & Specs
3GPP TS 29.281, 3GPP TS 38.415
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6GTPv1-U (UDP 2152) (UDP 2152)
L2 Tagging: vlan · qinq · repeatable mpls · fcsHost Family: Dual-Stack IPv4/IPv6L3 QoS & TTL: ttl · dscp · ecnL4 State: UDP

What It Does on the Wire

Every byte your phone downloads over 4G LTE (S1-U) or 5G NR (N3) rides inside UDP 2152 gtpu: pass qfi 9 on gtpu gpdu and the compiler automatically attaches the 0x85 5G NR PDU Session Container extension header!

GPRS Tunneling Protocol User Plane (gtpu, UDP 2152, 3GPP TS 29.281 / TS 38.415) carries subscriber user-plane IP packets across 4G LTE S1-U / S5 / S8 (eNB <-> SGW <-> PGW) and 5G NR N3 / N9 (gNB <-> I-UPF <-> PSA-UPF) mobile core interfaces. Every GTPv1-U packet starts with an 8-byte mandatory header (Version = 1, PT = 1, E/S/PN extension flags, Message Type, Length, and 32-bit Tunnel Endpoint Identifier teid), optionally followed by Sequence Number (seqnum), N-PDU (npdu), and the 5G NR PDU Session Container Extension Header (0x85) carrying the 6-bit QoS Flow Identifier (qfi 0..63).

FrameAssembly automatically sets the E (0x04) Next Extension Header bit and builds the 3GPP TS 38.415 0x85 PDU Session Container whenever qfi is specified, sets S (0x02) when seqnum is present (or on echorequest / echoreply), and encapsulates a clean inner subscriber IPv4/IPv6 packet on gpdu (Message Type 0xff).

01. Application

5G Standalone N3 (gNB <-> UPF) QFI QoS Slicing & SmartNIC Offload Tests

Emit gtpu gpdu teid 0x00010002 qfi 9 (5QI=9 Default Bearer) and qfi 1 (5QI=1 VoNR conversational voice with dscp 46) to validate UPF eBPF/DPDK/P4 pipelines and Wireshark gtp dissection.

02. Application

GTP-U Path Management (echorequest / echoreply) & Handover endmarker

Script teid 0 path liveness probes (echorequest <-> echoreply) and inter-gNB Xn/N2 handover endmarker (0xfe) packets.

03. Application

Mobile Core N6 / Gi-LAN & Roaming IPX GTP Firewall Audits

Test carrier GTP inspection firewalls against errorindication (0x1a) teardown messages, unexpected TEIDs, or GTP-in-GTP spoofing.

Fig. 1 · RFC Octet & Bit Schematic

RFC Wire Header Layout (gtpu)

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
GTPv1-U (UDP 2152) Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
gtpu gpdu · teid · qfi · seqnum · flags · payload · hexpayload
Compiler Default Behavior
RFC-compliant GTPv1-U (UDP 2152) defaults (3GPP TS 29.281)
Wireshark Dissection Note · Inspecting 5G NR QFI Inside GTPv1-U Extension Header 0x85

Filter with gtp on UDP 2152 and expand Next Extension Header Type: PDU Session Container (0x85) to verify the 6-bit QoS Flow Identifier (qfi 0..63) alongside the 32-bit TEID.

Minimal Quickstart (gtpu_quickstart.frasm)

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

gtpu_quickstart.frasm8 lines
Open in Playground
host gnb_du { ip 172.22.10.11 }
host core_upf { ip 172.22.20.50 }
compile {
gnb_du -> core_upf gtpu echorequest teid 0 seqnum 1 wait 1ms
gnb_du <- core_upf gtpu echoreply teid 0 seqnum 1 wait 1ms
gnb_du -> core_upf gtpu gpdu teid 0x10002001 qfi 9 payload "ue-uplink-pdu"
}

Handled Automatically on the Wire

  • Defaults UDP dstport to 2152 and computes the 16-bit GTPv1-U Length field (bytes following the mandatory 8-byte header, including extension headers and inner G-PDU payload).
  • Automatically sets E=1 (0x34 header flags) and appends the 4-byte aligned PDU Session Container (0x85) Extension Header whenever qfi <0..63> is provided.
  • Validates at compile time that qfi fits in 6 bits (0..63) per 3GPP TS 38.415.
Multi-Frame Example

5G N3 gNB <-> UPF Path Liveness, VoNR QFI=1 + Data QFI=9 Bearers & Xn Handover End-Marker

Simulates GTP-U Echo path verification (teid 0), uplink/downlink 5G NR gpdu frames carrying qfi 9 (data) and qfi 1 (VoNR voice), and an inter-gNB handover endmarker.

gtpu_5g_n3_upf.frasm14 lines
Open in Playground
host gnb_cell_01 { ip 10.45.1.11 mac 00:1c:73:45:01:11 }
host upf_psa_01 { ip 10.45.9.50 mac 00:1c:73:45:09:50 }
compile {
// 1. 3GPP TS 29.281 Path Management Echo Request / Reply (TEID must be 0)
gnb_cell_01 -> upf_psa_01 gtpu echorequest teid 0 seqnum 100 wait 1ms
gnb_cell_01 <- upf_psa_01 gtpu echoreply teid 0 seqnum 100 wait 2ms
// 2. 5G N3 Uplink & Downlink G-PDUs with PDU Session Container (0x85) QFI=9 & VoNR QFI=1
gnb_cell_01 -> upf_psa_01 gtpu gpdu teid 0x20000101 qfi 9 dscp 18 payload "ue-https-uplink" wait 1ms
gnb_cell_01 <- upf_psa_01 gtpu gpdu teid 0x10000101 qfi 9 dscp 18 payload "ue-https-downlink" wait 1ms
gnb_cell_01 -> upf_psa_01 gtpu gpdu teid 0x20000101 qfi 1 seqnum 101 dscp 46 payload "ue-vonr-rtp-frame" wait 2ms
// 3. UPF sends End Marker (0xfe) toward source gNB during Xn handover
gnb_cell_01 <- upf_psa_01 gtpu endmarker teid 0x10000101
}
Terminal Commands (FrameAssembly CLI v3.3.0)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show gtpu_5g_n3_upf.frasm

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

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

# 4. Verify dissected protocol fields in tshark
tshark -r gtpu_5g_n3_upf.pcap -Y "gtp"

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

src_host -> dst_host gtpu [gpdu | echorequest | echoreply | errorindication | endmarker] [teid <number>] [flags <0..255>] [seqnum <0..65535>] [npdu <0..255>] [qfi <0..63>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
gpdu | echorequest | echoreply | errorindication | endmarkerGTPv1-U message type keywordgpdu (0xff)Selects 3GPP TS 29.281 Message Type (1=Echo Request, 2=Echo Response, 26=Error Indication, 254=End Marker, 255=T-PDU / G-PDU).
teid <number>32-bit Tunnel Endpoint Identifier0 on echo, 1 on gpduWrites the big-endian 32-bit TEID in bytes 4..7 of the GTPv1-U header.
qfi <0..63>6-bit 5G QoS Flow Identifier (0..63)Omitted (4G S1-U mode)Sets E=1 and appends Next Extension Header 0x85 (5G NR PDU Session Container) carrying the 6-bit QFI.
seqnum <0..65535> | npdu <0..255>16-bit GTP-U Sequence Number & 8-bit N-PDU NumberOmitted on gpdu (seqnum 1 on echo)Enables the 4-byte optional GTPv1-U header extension (S=1 / PN=1) and writes Sequence / N-PDU fields.
flags <0..255>8-bit GTPv1-U header byte 0 override0x30 (or 0x32/0x34 with seqnum/qfi)Overrides Version (1), Protocol Type (PT=1), and E/S/PN flag bits.

Cross-Layer Wrappers Valid with gtpu

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

13 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 2152Overrides source or destination port and remembers the port pair automatically on <- replies.
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

qfi Is a 6-Bit 5G QoS Flow ID (0..63)

Rejected
gnb -> upf gtpu gpdu teid 0x1001 qfi 64
Valid v3.3.0 Syntax
gnb -> upf gtpu gpdu teid 0x1001 qfi 9

3GPP TS 38.415 allocates 6 bits (0..63) for QoS Flow Identifier inside the PDU Session Container; qfi > 63 fails compile-time validation.

GTPv1-U Runs on UDP 2152 (GTPv2-C Control Signaling Uses gtpc on UDP 2123)

Rejected
gnb -> mme gtpu createsessionrequest teid 0
Valid v3.3.0 Syntax
gnb -> upf gtpu gpdu teid 0x10002001 qfi 9

Use gtpu (UDP 2152) for user-plane gpdu, echorequest, echoreply, errorindication, and endmarker; session creation signaling belongs to control-plane GTPv2-C.

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