Protocol 85 of 81Layer 7FrameAssembly v3.3.0
Raw .mdllms-full.txt
diameterDiameter Base, Credit-Control & 3GPP S6a/Gx/Gy AAA Signaling

diameter — 4G EPC S6a/Gx/Gy AVPs over TCP or SCTP 3868

Default Port / Protocol
TCP 3868 (or SCTP 3868 / PPID 46 via transport sctp)
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
diameter
Standards & Specs
RFC 6733, RFC 8506, 3GPP TS 29.272
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6TCP 3868 (or SCTP 3868 / PPID 46 via transport sctp)Diameter (RFC 6733)
L2 Tagging: vlan · qinq · repeatable mpls · fcsHost Family: Dual-Stack IPv4/IPv6L3 QoS & TTL: ttl · dscp · ecnL4 State: Auto 4-tuple seq / acknum

What It Does on the Wire

4G LTE HSS and PCRF billing diameter peers are notoriously picky about 32-bit AVP padding — diameter aligns Origin-Host, Origin-Realm, Session-Id, and Result-Code AVPs over TCP 3868 or transport sctp (PPID 46).

Diameter (diameter, RFC 6733 / RFC 8506 / 3GPP TS 29.272) is the telecom AAA, HSS subscriber authentication (S6a), policy control (Gx PCRF), online charging (Gy OCS), and IMS (Cx/Sh) signaling backbone on TCP or SCTP port 3868. Every Diameter message starts with a 20-byte header (Version = 1, 24-bit Message Length, Command Flags R/P/E/T, 24-bit Command-Code, 32-bit Application-ID, Hop-by-Hop ID, and End-to-End ID) followed by 32-bit word-aligned Attribute-Value Pairs (AVPs).

FrameAssembly aligns and zero-pads every AVP (Origin-Host 264, Origin-Realm 296, Destination-Host 293, Destination-Realm 283, Session-Id 263, Result-Code 268, User-Name 1) to 4-byte boundaries automatically and sets SCTP Payload Protocol Identifier 46 (Diameter) whenever transport sctp is appended.

01. Application

4G LTE S6a MME <-> HSS & IMS Cx Peer Capabilities Exchange (CER/CEA)

Generate diameter cer and cea (resultcode 2001 DIAMETER_SUCCESS) over SCTP 3868 (transport sctp) or stateful TCP 3868 to test Diameter Routing Agents (DRAs) and DEA roaming firewalls.

02. Application

Gx / Gy Real-Time Policy & Online Charging (ccr <-> cca)

Craft RFC 8506 Credit-Control (cmd 272, appid 4 Gy or appid 16777238 3GPP Gx) requests and answers with sessionid, user, originhost, and dstrealm AVPs.

03. Application

Watchdog Failover Timers (dwr / dwa RFC 3539)

Emit Device-Watchdog-Request (280) and Answer PDUs with matching hopid / endid identifiers to verify DRA connection-failover timers.

Fig. 1 · RFC Octet & Bit Schematic

RFC Wire Header Layout (diameter)

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
Diameter (RFC 6733) Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
diameter cer · appid · flags · hopid · originhost · payload · hexpayload
Compiler Default Behavior
RFC-compliant Diameter (RFC 6733) defaults (RFC 6733)
Wireshark Dissection Note · Inspecting Diameter AVP Padding over TCP or SCTP 3868

Filter with diameter on port 3868 (TCP or SCTP PPID 46) to verify 20-byte Command Headers, Hop-by-Hop / End-to-End IDs, and 32-bit padded Origin-Host, Origin-Realm, and Result-Code AVPs.

Minimal Quickstart (diameter_quickstart.frasm)

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

diameter_quickstart.frasm7 lines
Open in Playground
host mme_s6a { ip 10.88.6.10 }
host hss_s6a { ip 10.88.6.20 }
compile {
mme_s6a -> hss_s6a diameter cer hopid 0x1001 endid 0x2001 originhost "mme01.epc.internal" realm "epc.internal" transport sctp wait 3ms
mme_s6a <- hss_s6a diameter cea hopid 0x1001 endid 0x2001 originhost "hss01.epc.internal" realm "epc.internal" resultcode 2001 transport sctp
}

Handled Automatically on the Wire

  • Defaults to stateful TCP port 3868, or switches to SCTP port 3868 (DATA chunk PPID = 46, Castagnoli CRC-32c) when transport sctp is added.
  • Computes the exact 24-bit Message Length in bytes 1..3 and pads every variable-length UTF-8/DiameterIdentity AVP to 4-octet boundaries while recording unpadded length in the 24-bit AVP Length field.
  • Sets the R (0x80 Request) flag automatically on cer/dwr/ccr/request and clears R while appending Result-Code (2001 DIAMETER_SUCCESS) on cea/dwa/cca/response.
Multi-Frame Example

SCTP 3868 Diameter Peer Bring-Up (CER/CEA), Credit-Control (CCR/CCA) & Watchdog

Establishes an SCTP Diameter association between a PGW/SMF and Online Charging System (OCS), exchanges CER/CEA, authorizes subscriber quota via CCR/CCA (appid 4), and verifies liveness via DWR/DWA.

diameter_gy_charging_sctp.frasm14 lines
Open in Playground
host pgw_gy { ip 172.28.10.15 }
host ocs_gy { ip 172.28.10.80 }
compile {
// 1. Capabilities-Exchange (Code 257, AppID 0) over SCTP 3868 (PPID 46)
pgw_gy -> ocs_gy diameter cer hopid 0x00010001 endid 0x99000001 originhost "pgw01.epc.internal" realm "epc.internal" transport sctp wait 2ms
pgw_gy <- ocs_gy diameter cea hopid 0x00010001 endid 0x99000001 originhost "ocs01.epc.internal" realm "epc.internal" resultcode 2001 transport sctp wait 5ms
// 2. RFC 8506 Credit-Control Request / Answer (Code 272, AppID 4 = Diameter Credit Control)
pgw_gy -> ocs_gy diameter ccr appid 4 hopid 0x00010002 endid 0x99000002 sessionid "pgw01.epc.internal;170001;1" originhost "pgw01.epc.internal" realm "epc.internal" dstrealm "epc.internal" user "001010123456789" transport sctp wait 4ms
pgw_gy <- ocs_gy diameter cca appid 4 hopid 0x00010002 endid 0x99000002 sessionid "pgw01.epc.internal;170001;1" originhost "ocs01.epc.internal" realm "epc.internal" resultcode 2001 transport sctp wait 15ms
// 3. Device-Watchdog Heartbeat (Code 280)
pgw_gy -> ocs_gy diameter dwr hopid 0x00010003 endid 0x99000003 originhost "pgw01.epc.internal" realm "epc.internal" transport sctp wait 2ms
pgw_gy <- ocs_gy diameter dwa hopid 0x00010003 endid 0x99000003 originhost "ocs01.epc.internal" realm "epc.internal" resultcode 2001 transport sctp
}
Terminal Commands (FrameAssembly CLI v3.3.0)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show diameter_gy_charging_sctp.frasm

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

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

# 4. Verify dissected protocol fields in tshark
tshark -r diameter_gy_charging_sctp.pcap -Y "diameter"

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

src_host -> dst_host diameter [cer | cea | dwr | dwa | ccr | cca] [request | response] [cmd|command "<text_or_num>"] [flags <0..255>] [appid <number>] [hopid <number>] [endid <number>] [originhost "<text>"] [realm "<text>"] [dsthost "<text>"] [dstrealm "<text>"] [sessionid "<text>"] [resultcode <number>] [user "<text>"] [transport sctp]
Keyword / OptionAccepted ValueDefaultEffect on Packet
cer | cea | dwr | dwa | ccr | cca | request | response | cmd|command "<text_or_num>"Diameter Command shorthand or 24-bit Command-Code (e.g. 318 ULR/ULA)cer (257 Request)Selects 257 Capabilities-Exchange (cer/cea), 280 Device-Watchdog (dwr/dwa), 272 Credit-Control (ccr/cca), or any custom 3GPP Command-Code (e.g. cmd 316 S6a ULR, cmd 318 AIA).
appid <number>32-bit Diameter Application-ID0 (Base) or 4 (on CCR/CCA)Writes bytes 8..11 (0 Common, 4 Credit-Control, 16777251 3GPP S6a, 16777238 3GPP Gx).
flags <0..255>8-bit Command Flags bitmask (0x80 R, 0x40 P, 0x20 E, 0x10 T)0x80 on Request, 0x00 on AnswerOverrides byte 4 of the Diameter header.
hopid <number> | endid <number>32-bit Hop-by-Hop and End-to-End IdentifiersAuto-populated non-zero IDsWrites bytes 12..19 used by peers and DRAs to match Answers to Requests.
originhost "<text>" | realm "<text>"DiameterIdentity strings (AVPs 264 & 296)"client.example.com" / "example.com"Encodes mandatory Origin-Host (AVP 264, M-bit 0x40) and Origin-Realm (AVP 296, M-bit 0x40).
dsthost "<text>" | dstrealm "<text>"DiameterIdentity strings (AVPs 293 & 283)OmittedAppends Destination-Host (AVP 293) and Destination-Realm (AVP 283) for DRA realm routing.
sessionid "<text>" | user "<text>"UTF8String AVPs (AVP 263 Session-Id & AVP 1 User-Name)OmittedAppends Session-Id (263) and User-Name (1, IMSI/NAI) AVPs.
resultcode <number>32-bit Unsigned32 Result-Code (AVP 268)2001 (DIAMETER_SUCCESS) on AnswersAppends AVP 268 (2001 Success, 3002 Unable to Deliver, 5001 AVP Unsupported, 5030 User Unknown).
transport sctpOptional SCTP transport selectorTCP 3868Encapsulates the Diameter PDU inside SCTP port 3868 with PPID = 46 instead of TCP.

Cross-Layer Wrappers Valid with diameter

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

15 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), TCP 3868 (or SCTP 3868 / PPID 46 via transport sctp)Overrides source or destination port and remembers the port pair automatically on <- replies.
transport sctpOptional SCTP association transport (IP Proto 132)TCP (TCP 3868 (or SCTP 3868 / PPID 46 via transport sctp))Carries this Layer 7 PDU inside a stateful RFC 9260 SCTP DATA chunk with automatic Verification Tag, TSN tracking, and CRC-32c.
badchecksumL4/ICMP/SCTP checksum fault injection flagValid RFC checksum / CRC-32cDeliberately corrupts the TCP, SCTP CRC-32c, ICMP, or ICMPv6 checksum for negative IDS/firewall testing.
seq <number> | acknum <number> | win|window <0..65535> | urgent <0..65535> | syn | ack | psh | fin | rst | urg | ece | cwrTCP sequence/ack numbers, window, flags, SACK, TCP-MD5 & TFO optionspsh ack, win 65535, automatic TCP seq/acknumOverrides automatic TCP sequence tracking, flags, or RFC 7323/2018/2385/7413 options (mss, wscale, sackperm, sackblock, tsval, tsecr, tcpmd5, tfo).

Gotchas & Quick Fixes

Diameter Uses TCP or SCTP Only (Never transport udp)

Rejected
mme -> hss diameter cer originhost "mme.epc" realm "epc" transport udp
Valid v3.3.0 Syntax
mme -> hss diameter cer originhost "mme.epc" realm "epc" transport sctp

RFC 6733 specifies reliable stream/message transports (TCP default or transport sctp, never connectionless UDP like legacy RADIUS).

Preserve Matching hopid and endid on Answer Frames

Valid v3.3.0 Syntax
c -> s diameter dwr hopid 101 endid 501 c <- s diameter dwa hopid 101 endid 501 resultcode 2001

Wireshark’s diameter response-time analyzer pairs CEA/DWA/CCA answers with requests using matching Hop-by-Hop and End-to-End IDs.

Field Guide 03
Poke Stateful Firewalls, Suricata, Zeek & OT Conduits