When a 5G standalone UE first attaches to a cell, it runs the general registration procedure in 3GPP TS 23.502 §4.2.2.2. The NAS messages themselves are defined in TS 24.501: a Registration Request, authentication, a Security Mode Command, a Registration Accept and a Registration Complete. If the UE sets the Follow-On Request bit, a PDU Session Establishment can follow in the same signalling exchange (TS 23.502 §4.3.2.2).

This article walks through that sequence in a small capture: one subscriber, 11 packets, N2 NGAP carrying N1 NAS. The file was generated with the Web Community edition of Mobile Core (scenario ngap-5g-registration), so you can reproduce it in the browser and open the same packets in Wireshark.

Try it yourself in the browser Download the PCAP

What is in the file, and what is not

The PCAP contains only the N2 interface: SCTP between the gNB (192.0.2.10, port 9487) and the AMF (192.0.2.20, port 38412, PPID 60). N1 NAS sits inside the NGAP NAS-PDU information element. There are no Uu/RRC frames.

TS 23.502 §4.2.2.2 also describes AUSF (N12) and UDM (N8/N10) during authentication and subscription retrieval, and §4.3.2.2 describes SMF (N11), PCF (N7) and UPF (N4) for PDU session establishment. Those service-based and N4 messages are not in this file. The generator writes a compact N2/N1 trace and fills the authentication parameters, the 5G-GUTI, the Allowed NSSAI and the UPF N3 F-TEID itself. N3 GTP-U G-PDUs are also absent; the N3 addresses and TEIDs appear only as information elements in the PDU Session Resource Setup messages (frames 10 and 11).

The web catalog also has 5gc-e2e, which keeps the same registration and then adds N11, N7 and N4. It still does not include AUSF or UDM. The short scenario is the better starting point for reading registration.

Generate the same capture in the browser

These steps match the public page at packetbuilder.net/mobile-core-web/ (Web Community 1.19.5, up to 100 subscribers).

  1. Open the page and wait until the core shows as ready.
  2. Leave the Subscribers tab at the built-in defaults (Start IMSI 123450100000001, MCC 123, MNCs 450 and 451, UE IPv4 10.10.0.1, outer A/B 192.0.2.10 / 192.0.2.20, TAC 100, Cell ID 1000, gNodeB ID 1000). The 5G demo button does not apply the TAC database, even if that box stays ticked.
  3. Open the Session Scenarios tab.
  4. Set 5G demo subscribers to 1 (the default on the page is 3).
  5. Click Create 5G demo sessions (RAT NR). That runs generate-bulk with RAT NR, protocol PFCP and no GTP-U, and writes 5g_sessions.json.
  6. Select scenario ngap-5g-registration (“5G NGAP registration + PDU Session Resource Setup (N2, N1)”).
  7. Click Generate and download the PCAP. You should get 11 packets.

The same commands, with a schema-1 job equivalent to that button, are:

gtpcore -scenario generate-bulk -job-json job.json
gtpcore run-scenario -scenario ngap-5g-registration -input 5g_sessions.json -output 5g-registration.pcap -overwrite

The call flow

The diagram follows the captured order. Solid arrows are the N1 NAS (relayed by the gNB) and the N2 NGAP procedures. The AUSF/UDM and SMF/UPF lifelines are drawn for orientation only: this PCAP has no frames on N12, N8, N11 or N4. Frame numbers f1–f11 match the packet list.

Sequence diagram of a 5G SA initial registration: UE, gNB 192.0.2.10, AMF 192.0.2.20, with empty AUSF/UDM and SMF/UPF lifelines. Eleven N2 frames carry Registration Request through PDU Session Resource Setup Response.

Wireshark-style packet list of the eleven-frame 5G registration capture, from InitialUEMessage / Registration request to PDUSessionResourceSetupResponse.

Message list

No. Time (s) Direction NGAP procedure NAS message
10.000gNB → AMFInitialUEMessage (15)Registration request (0x41)
20.001AMF → gNBDownlinkNASTransport (4)Authentication request (0x56)
30.002gNB → AMFUplinkNASTransport (46)Authentication response (0x57)
40.003AMF → gNBDownlinkNASTransport (4)Security mode command (0x5d)
50.004gNB → AMFUplinkNASTransport (46)Security mode complete (0x5e)
60.005AMF → gNBInitialContextSetupRequest (14)Registration accept (0x42)
70.006gNB → AMFInitialContextSetupResponse (14)—
80.007gNB → AMFUplinkNASTransport (46)Registration complete (0x43)
90.008gNB → AMFUplinkNASTransport (46)UL NAS transport (0x67), PDU session establishment request (0xc1)
100.009AMF → gNBPDUSessionResourceSetupRequest (29)DL NAS transport (0x68), PDU session establishment accept (0xc2)
110.010gNB → AMFPDUSessionResourceSetupResponse (29)—

From frame 2 onward, RAN-UE-NGAP-ID and AMF-UE-NGAP-ID are both 1. Spacing is 1 ms. tshark 4.4 reports no expert warnings on this file.

Step by step

1. Registration Request (frame 1)

The gNB forwards the UE’s first NAS message in an NGAP Initial UE Message (TS 38.413), with RRC Establishment Cause mo-Signalling and UE Context Request set to requested. The NAS Registration Request (TS 24.501) is an initial registration. The Follow-On Request bit is pending, which is why a PDU session request appears after Registration Complete.

The mobile identity is a SUCI in IMSI format with the null protection scheme (TS 24.501 / TS 33.501): MCC 123, MNC 450, routing indicator 0, MSIN 100000001. The corresponding SUPI is IMSI 123450100000001. In a live network the MSIN would usually be concealed; the null scheme is used here so the identity is readable in Wireshark. ngKSI is 7 (no security context yet). The UE advertises 5G-EA0–EA3 and 5G-IA0–IA3.

Wireshark-style decode of frame 1: NGAP InitialUEMessage carrying a plain NAS Registration request, with SUCI null scheme, IMSI format, MCC 123, MNC 450, MSIN 100000001, and RRC cause mo-Signalling highlighted.

The NGAP User Location is NR: TAC 100, NR Cell Identity 1000 (0x3e8). NGAP writes the PLMN digits in plain order (TS 38.413), so MCC 123 / MNC 450 is 21 43 05 here, while the NAS SUCI uses the TS 24.008 layout 21 03 54. Wireshark decodes both as MNC 450.

2–3. Authentication Request and Response (frames 2–3)

The AMF allocates AMF-UE-NGAP-ID 1 and sends an Authentication Request in Downlink NAS Transport: ngKSI 0, ABBA 0000, plus RAND and AUTN. The UE returns RES in an Authentication Response. These IEs are present and decode cleanly, but they are generated for the trace; there is no N12 exchange with AUSF in the file, and the values are not a live 5G-AKA run against a USIM.

4–5. Security Mode Command and Complete (frames 4–5)

The Security Mode Command selects 5G-EA0 (null ciphering) and 128-5G-IA2 for integrity, replays the UE security capabilities, and requests IMEISV. The UE answers with Security Mode Complete and IMEISV 3569380300000101.

Important for reading the rest of the file: later NAS messages stay plain (security header type 0). The core does not apply a NAS integrity MAC or a ciphering header after this point, so Wireshark can decode Registration Accept, Registration Complete and the session-management messages without a key log. That is intentional, and it is why every NAS PDU in this capture is readable.

6–8. Initial Context Setup, Registration Accept and Complete (frames 6–8)

Registration Accept is delivered together with NGAP Initial Context Setup Request, which is the usual pairing on N2: the AMF both accepts the registration and asks the gNB to set up the UE context (GUAMI, Allowed NSSAI, UE security capabilities, and a 256-bit Security Key).

The NAS Accept reports a 5GS registration result of 3GPP access and assigns a 5G-GUTI: MCC 123, MNC 450, AMF Region ID 1, AMF Set ID 1, AMF Pointer 1, 5G-TMSI 0xd5d045f2. Allowed NSSAI is a single S-NSSAI with SST 1 (eMBB) and no slice differentiator. The gNB replies with Initial Context Setup Response (IDs only in this file). The UE then sends Registration Complete.

Wireshark-style decode of frame 6: NGAP InitialContextSetupRequest carrying a plain NAS Registration accept, with 5G-GUTI, AMF Region/Set/Pointer 1, 5G-TMSI 0xd5d045f2, and Allowed NSSAI SST 1 (eMBB) highlighted.

9–11. PDU Session Establishment (frames 9–11)

Because FOR was set, the UE continues with UL NAS Transport carrying a PDU Session Establishment Request: PDU Session ID 1, request type initial, type IPv4, S-NSSAI SST 1, DNN internet.

The AMF answers with NGAP PDU Session Resource Setup Request, which carries DL NAS Transport with the Establishment Accept (SSC mode 1, PDU address 10.10.0.1, default QoS rule QFI 1, Session-AMBR 1000 Mbps in each direction) and the N2 Setup Request Transfer. The uplink N3 tunnel in that transfer is 192.0.2.20, TEID 0x00300000, 5QI 9, QFI 1 (in this file the AMF address is reused as the UPF N3 address). The gNB returns PDU Session Resource Setup Response with the downlink N3 tunnel 192.0.2.10, TEID 0x00400000, QFI 1.

There are no GTP-U G-PDUs after that. A follow-on -scenario gtpu on this NR session is rejected (“NR GTP-U requires a PDU Session Container with QFI”), so user-plane packets are not added by the same Community path that created this file.

Wireshark display filters

A useful starting filter for this capture:

ngap || nas-5gs || gtp

gtp matches nothing here (no G-PDUs); it is listed so the same filter still works if you later merge an N3 user-plane file. Narrower filters:

nas-5gs.mm.message_type == 0x41    /* Registration request */
nas-5gs.mm.message_type == 0x42    /* Registration accept */
nas-5gs.sm.message_type            /* PDU session establishment */
ngap.procedureCode == 14           /* Initial Context Setup */
ngap.procedureCode == 29           /* PDU Session Resource Setup */
sctp.port == 38412

References

  • 3GPP TS 23.502, §4.2.2.2 General Registration; §4.3.2.2 UE-requested PDU Session Establishment.
  • 3GPP TS 24.501, 5GS NAS: Registration Request/Accept/Complete, authentication, security mode control, UL/DL NAS transport, and 5GSM PDU Session Establishment.
  • 3GPP TS 38.413, NGAP: Initial UE Message, Downlink/Uplink NAS Transport, Initial Context Setup, PDU Session Resource Setup.
  • 3GPP TS 33.501, SUCI concealment schemes (null scheme used in this lab file).

Try it yourself in the browser Download the PCAP PCAPNG