Skip to content

NG Setup Procedure — What the gNB and AMF Exchange When Establishing N2

Difficulty: Advanced (deep dive) / Estimated study time: 30 min / Prerequisites: GUAMI / AMF Region / Set / Pointer, N2 / Main actors: gNB, AMF / Main interface: N2

Learning objectives

After reading this chapter, you will be able to:

  • Explain that NG Setup is a procedure between the gNB and the AMF (non-UE-associated), not a per-UE procedure
  • Explain the bring-up of N2 in layers: IP → SCTP → NG Setup → UE-associated NGAP
  • Explain the meaning of the main IEs of NG Setup Request / Response / Failure (Global RAN Node ID, Supported TA List, Served GUAMI List, Relative AMF Capacity, Cause, Time to Wait)
  • Isolate, layer by layer, the case "SCTP is ESTABLISHED but Registration does not reach the AMF"

Prerequisites

The focus of this chapter (Level ∞ Deep Dive)

The N2 page introduces NG Setup in one line as "the handshake that establishes N2." This chapter digs into what is exchanged in the handshake, what the AMF checks and what a failure looks like, at the IE level and from a trace-analysis perspective.


Why — why is a "handshake" needed before any UE?

Just connecting a cable and IP between the gNB and the AMF does not tell either of them anything about the other.

  • Unless the AMF knows "which PLMN and which Tracking Areas this gNB serves," it cannot decide where to send Paging.
  • Unless the gNB knows "which GUAMIs this AMF serves and how much capacity it has," it cannot decide which AMF to send a UE to (previous chapter).

So, before any UE signaling flows, the gNB and the AMF need a procedure to introduce themselves and exchange capabilities. That is NG Setup (TS 38.413 §8.7.1).

Analogy: NG Setup is "the activation procedure between a new branch (gNB) and the head office (AMF)." The branch says, "I am branch XX, and I cover this area and these services," and the head office replies, "I am counter YY at head office; these are my numbers, and this is roughly my capacity." Until activation is complete, customers' (UEs') paperwork cannot be processed.


What — where NG Setup fits

A non-UE-associated, Class 1 procedure

NGAP procedures are divided into UE-associated procedures, tied to a specific UE, and non-UE-associated procedures, which concern the nodes as a whole. NG Setup is the latter. It is also a Class 1 procedure, in which a request gets a response (success/failure) (TS 38.413 §8.1).

Category Examples
non-UE-associated NG Setup, RAN Configuration Update, AMF Configuration Update, NG Reset, AMF Status Indication
UE-associated Initial UE Message, Initial Context Setup, PDU Session Resource Setup, UE Context Release

N2 comes up in four layers

flowchart TD
    L1["① IP reachability
(routing / VRF / FW)"] --> L2["② SCTP Association
INIT → INIT ACK → COOKIE ECHO → COOKIE ACK"] L2 --> L3["③ NG Setup
NGAP non-UE-associated"] L3 --> L4["④ UE-associated NGAP
Initial UE Message, etc."] L4 --> L5["⑤ NAS procedures
Registration / Authentication / Security"]
Layer Specified in Sign of success
① IP — Both N2 addresses are reachable
② SCTP RFC 9260 (formerly RFC 4960); usage on N2 per TS 38.412 §7 Association is ESTABLISHED
③ NG Setup TS 38.413 §8.7.1 NG Setup Response received
④ UE-associated NGAP TS 38.413 §8.6.1 (Initial UE Message) Initial UE Message reaches the AMF

SCTP ESTABLISHED does not mean N2 is usable

SCTP is only the carrier. Only when NG Setup succeeds on top of it can UE signaling flow. TS 38.413 §8.7.1.1 specifies NG Setup as the first NGAP procedure triggered after the TNL association (SCTP) has become operational (sub-clause to be confirmed).

SCTP provisions for N2 (TS 38.412 §7)

Item Content
Who establishes SCTP The NG-RAN node (gNB) initiates establishment
Destination port 38412
Payload Protocol Identifier The value for NGAP (60)
Streams One pair of streams is reserved for non-UE-associated procedures. At least one pair is also reserved for UE-associated procedures
Multiple SCTP associations Multiple TNL associations are possible between the gNB and the AMF (the AMF can instruct additions/removals with AMF Configuration Update, TS 38.413 §8.7.3)

How — the information exchanged

Call Flow

sequenceDiagram
    participant gNB
    participant AMF
    gNB->>AMF: SCTP INIT
    AMF-->>gNB: SCTP INIT ACK
    gNB->>AMF: SCTP COOKIE ECHO
    AMF-->>gNB: SCTP COOKIE ACK
    Note over gNB,AMF: SCTP Association ESTABLISHED (N2 not yet established)
    gNB->>AMF: NG Setup Request
(Global RAN Node ID, RAN Node Name, Supported TA List, Default Paging DRX) AMF->>AMF: checks PLMN etc. against its own configuration alt success AMF-->>gNB: NG Setup Response
(AMF Name, Served GUAMI List, Relative AMF Capacity, PLMN Support List) Note over gNB,AMF: N2 Ready → UE-associated NGAP can flow else failure AMF-->>gNB: NG Setup Failure
(Cause, Time to Wait) Note over gNB: if Time to Wait is present, wait at least that long before retrying end

NG Setup Request — gNB → AMF (TS 38.413 §9.2.6.1)

The gNB tells the AMF "who I am and what I serve."

IE Mandatory/optional Meaning
Global RAN Node ID Mandatory Identifier of the gNB (PLMN + gNB ID). ng-eNB / N3IWF etc. are also distinguished here
RAN Node Name Optional Human-readable name. Handy for trace analysis
Supported TA List Mandatory The TAs served, and the PLMNs and S-NSSAIs per TA
Default Paging DRX Mandatory Paging cycle used when no UE-specific value is given
UE Retention Information Optional Used to agree on whether to re-exchange configuration while retaining UE contexts

This is an excerpt of the main IEs and not exhaustive (optional IEs are added depending on the Release).

Global RAN Node ID

Global RAN Node ID (CHOICE)
├─ Global gNB ID
│   ├─ PLMN Identity
│   └─ gNB ID        ← 22–32 bits (length chosen by the operator)
├─ Global ng-eNB ID
└─ Global N3IWF ID   (TNGF / TWIF / W-AGF etc. added depending on the Release)

The operator chooses the gNB ID length in the range 22–32 bits, and it forms the upper part of the NR Cell Identity (36 bits) (TS 38.413 §9.3.1.6, TS 38.300 §8.2; both clause numbers to be confirmed). It is the most important IE for identifying "which gNB this NG Setup came from" in a trace.

Supported TA List — the most important IE in this chapter

Supported TA List
└─ Supported TA Item (per TA)
    ├─ TAC
    └─ Broadcast PLMN List
        └─ Broadcast PLMN Item (per PLMN)
            ├─ PLMN Identity
            └─ TAI Slice Support List
                ├─ S-NSSAI #1  (SST, SD)
                └─ S-NSSAI #2

The gNB declares to the AMF: "In this TA, I can provide these S-NSSAIs of this PLMN."

Term Meaning Specified in
TAC (Tracking Area Code) Code identifying a Tracking Area. 24 bits in 5GS TS 23.003 §19.4.2.3 (to be confirmed)
TAI (Tracking Area Identity) PLMN ID + TAC TS 23.003 §19.4.2.3 (to be confirmed)
S-NSSAI Network slice identifier. SST (8 bits, mandatory) + SD (24 bits, optional) TS 23.003 §28.4.2, TS 23.501 §5.15.2.1

A Tracking Area is the unit that makes up a UE's Registration Area (TAI List). From this list the AMF learns "which gNB serves which TA," and sends Paging for a UE in CM-IDLE to the gNBs serving the TAs included in that UE's Registration Area (TS 38.413 §8.5 / TS 23.502 §4.2.3.3, to be confirmed).

What does the AMF check?

The rejection condition that is explicitly specified is when the AMF cannot identify any of the PLMNs (including SNPNs from Rel-16 onward) indicated by the gNB (TS 38.413 §8.7.1.4, to be confirmed). Anything else falls under the generic rule "if the AMF cannot accept the setup, it responds with NG Setup Failure" (§8.7.1.3) and depends on the AMF implementation.

flowchart TD
    R["NG Setup Request received"] --> P{"Can the AMF handle any of
the indicated PLMNs?"} P -- "No" --> F["NG Setup Failure
(Cause: Unknown PLMN /
Unknown PLMN or SNPN)"] P -- "Yes" --> O{"Are TAC / S-NSSAI etc.
consistent with the AMF configuration?"} O -- "decision depends on AMF implementation/configuration" --> S["NG Setup Response
or Failure"]

Handling of TAC and slice mismatches is implementation dependent

Whether the AMF rejects NG Setup or accepts it and deals with the issue in later procedures when "the TAC is not in the AMF's service area" or "the S-NSSAIs don't match" is not uniformly specified; it is AMF implementation/configuration dependent. Check the actual behavior in product documentation and traces.

NG Setup Response — AMF → gNB (TS 38.413 §9.2.6.2)

IE Mandatory/optional Meaning
AMF Name Mandatory Name of the AMF
Served GUAMI List Mandatory GUAMIs served by this AMF (optionally with a Backup AMF Name). See the previous chapter
Relative AMF Capacity Mandatory Capacity relative to other AMFs (0–255)
PLMN Support List Mandatory PLMNs handled by the AMF and the Slice Support List (S-NSSAIs) per PLMN
Criticality Diagnostics Optional Diagnostic information when there was a problem with IEs in the received message
UE Retention Information Optional Agreement on UE context retention (pairs with the Request side)

This is an excerpt of the main IEs and not exhaustive (optional IEs are added depending on the Release).

Relative AMF Capacity — not CPU utilization

Relative AMF Capacity is the weight (weight factor) NG-RAN uses when selecting an AMF (TS 23.501 §5.19.3; clause number to be confirmed). New UEs are distributed to the AMFs with probabilities proportional to this value.

AMF-1: Relative AMF Capacity = 255
AMF-2: Relative AMF Capacity = 128
→ new UEs are distributed roughly 2:1 (details of the distribution are gNB implementation dependent)
  • It is not a real-time value of CPU utilization or load. It is a relative value set by the operator according to the AMFs' capacity. It can be changed later with AMF Configuration Update (TS 38.413 §8.7.3).
  • It does not affect existing UEs, because UEs with a 5G-GUTI / 5G-S-TMSI are returned to their previous AMF by the GUAMI.

Treatment of Relative AMF Capacity = 0

An operational practice of setting the value to 0 during maintenance to "stop attracting new UEs" is sometimes mentioned. However, how far the specification requires NG-RAN to exclude such an AMF from selection is to be confirmed, and the actual behavior is gNB implementation dependent. Also, setting it to 0 does not immediately move existing UEs to another AMF. To move existing UEs, combine it with AMF Status Indication (Unavailable GUAMI) and load re-balancing mechanisms (see the previous chapter).

NG Setup Failure — AMF → gNB (TS 38.413 §9.2.6.3)

IE Mandatory/optional Meaning
Cause Mandatory Reason for failure (TS 38.413 §9.3.1.2; categories Radio Network / Transport / NAS / Protocol / Miscellaneous)
Time to Wait Optional Minimum time the gNB should wait before retrying
Criticality Diagnostics Optional Per-IE diagnostic information

If Time to Wait is included, the gNB must not resend NG Setup to the same AMF until that time has elapsed (TS 38.413 §8.7.1.3). This prevents many gNBs from retrying at once and overwhelming the AMF, for example right after an AMF restart.

Redoing NG Setup can erase UE contexts

NG Setup replaces the existing application-level configuration in both nodes with what is received. In addition, if the NG-RAN node and the AMF do not agree on retaining UE contexts (via the UE Retention Information IE), it erases the existing NGAP UE-related contexts and the related signaling connections, as an NG Reset would (TS 38.413 §8.7.1.1, sub-clause to be confirmed). Be aware that if NG Setup is redone during operation, the N2 contexts of the UEs under that gNB may be lost. The AMF overload state held by the NG-RAN node is also cleared (same clause).

Configuration changes after NG Setup

The information exchanged in NG Setup can be updated without re-establishing N2.

Procedure Direction Purpose Specified in
RAN Configuration Update gNB → AMF Changes to the Supported TA List, etc. TS 38.413 §8.7.2
AMF Configuration Update AMF → gNB Changes to the Served GUAMI List / Relative AMF Capacity / PLMN Support List / TNL associations TS 38.413 §8.7.3
AMF Status Indication AMF → gNB Notification of unavailable GUAMIs TS 38.413 §8.7.6
NG Reset Both directions Reset all or part of the UE-associated connections TS 38.413 §8.7.4

From NG Setup to UE Registration

sequenceDiagram
    participant UE
    participant gNB
    participant AMF
    Note over gNB,AMF: Step 1: SCTP Association
    Note over gNB,AMF: Step 2: NG Setup Request / Response
    UE->>gNB: RRC connection + Registration Request (NAS)
    gNB->>AMF: Initial UE Message (NAS-PDU)
    Note over AMF: Step 3: per-UE procedures begin
(Authentication / Security / Registration Accept)

Before the Initial UE Message, which is the first thing to appear in Registration, SCTP → NG Setup is always already done. The Served GUAMI List and Relative AMF Capacity that the gNB uses to select the AMF for a UE are also information received in this NG Setup.


Packet Analysis (Wireshark)

Display filters

Filter Purpose
sctp All SCTP
sctp.port == 38412 Narrow to SCTP on N2
sctp.chunk_type in {1 2 10 11} 4-way handshake (INIT / INIT ACK / COOKIE ECHO / COOKIE ACK; chunk type values per RFC 9260)
sctp.chunk_type == 6 ABORT (abnormal termination of the association)
sctp.data_payload_proto_id == 60 DATA chunks carrying NGAP (PPID=60; field name to be confirmed for your Wireshark version)
ngap All NGAP

The numeric NGAP procedureCode values may be displayed differently depending on the dissector and version, so this page does not assert them. Checking message names (NGSetupRequest, etc.) in the GUI's protocol hierarchy is the reliable approach.

Decode example (conceptual)

The following is a conceptual representation of the display structure; the values are a fictitious example with the test PLMN (001-01) (capture needed).

NGAP NGSetupRequest
 ├─ GlobalRANNodeID
 │   └─ globalGNB-ID
 │       ├─ pLMNIdentity: 001-01
 │       └─ gNB-ID: 0x000001 (22 bits)
 ├─ RANNodeName: gnb-lab-01
 ├─ SupportedTAList
 │   └─ SupportedTAItem
 │       ├─ tAC: 0x000001
 │       └─ broadcastPLMNList
 │           └─ BroadcastPLMNItem
 │               ├─ pLMNIdentity: 001-01
 │               └─ tAISliceSupportList
 │                   └─ s-NSSAI: sST=1, sD=0x010203
 └─ DefaultPagingDRX: v128

Order of checks

flowchart LR
    A["① IP
ping / routes"] --> B["② SCTP
4-way handshake
any ABORT/SHUTDOWN?"] B --> C["③ NG Setup
Request → Response / Failure"] C --> D["④ UE-associated NGAP
Initial UE Message"]

When "SCTP is ESTABLISHED but no Registration Request reaches the AMF," check ③ whether NG Setup succeeded before suspecting the UE.

Build a comparison table

When analyzing an NG Setup Failure, it is efficient to put the values sent by the gNB side by side with the AMF configuration.

Item gNB (NG Setup Request) AMF configuration Verdict
PLMN 001-01 001-01 OK
TAC 0x000001 0x000002 To be confirmed
S-NSSAI SST=1, SD=0x010203 SST=1 (no SD) To be confirmed (whether SD presence matches)

Trouble Shooting

Symptom Likely cause Check point Logs Packets Resolution
No response to SCTP INIT IP reachability / FW / port 38412 blocked Routes, ACLs, AMF SCTP listener gNB/AMF SCTP logs sctp Fix routing / FW settings
SCTP is established but no NG Setup Request is sent gNB-side NGAP configuration incomplete gNB AMF-connection settings gNB logs ngap Review gNB configuration
NG Setup Failure (Unknown PLMN family; Unknown PLMN or SNPN from Rel-16, to be confirmed) PLMN mismatch PLMN in the Request vs. AMF PLMN configuration AMF logs ngap (Cause) Align PLMN configuration
NG Setup Failure (other causes) TAC or slice mismatch, IE errors, etc. (which ones are rejected is implementation dependent) The comparison table above, Criticality Diagnostics AMF logs ngap Check configuration and software versions (to be verified)
UEs don't reach the AMF even after NG Setup succeeds gNB AMF selection (Relative AMF Capacity=0, etc.), distribution to another AMF Values in NG Setup Response / AMF Configuration Update gNB logs ngap Check capacity values and GUAMI configuration
NG Setup repeats and UEs are disconnected SCTP re-establishment loop (without UE Retention agreement, UE contexts are erased at every NG Setup) Any SCTP ABORT / HEARTBEAT failures SCTP logs on both sides sctp.chunk_type == 6 Check the transport path and multihoming configuration
Retry does not come immediately Waiting due to Time to Wait Time to Wait in the Failure gNB logs ngap Behaving as specified. Resolve the cause on the AMF side

Do not confuse the SCTP association with the NG connection

             IP-A ────────── IP-C
            /                    \
gNB ===== SCTP Association ====== AMF      ← one association can have multiple IP paths (multihoming)
            \                    /
             IP-B ────────── IP-D
  • SCTP multihoming lets one association have multiple IP paths; if one path goes down, the association is maintained (RFC 9260).
  • Multiple TNL associations means having multiple SCTP associations themselves between the gNB and the AMF (TS 38.412 §7, TS 38.413 §8.7.3).
  • Both are a different layer from the NGAP NG connection (the relationship established by NG Setup). In troubleshooting, separate the layers: "IP → SCTP → NGAP (NG Setup)."

Boundary between 3GPP specifications and vendor implementations

Defined by 3GPP Decided by vendors / operations
NG Setup Request / Response / Failure and their IEs CLIs such as show ngap peer / show n2 status
How SCTP is used (port 38412, PPID, gNB initiates establishment) N2 VIPs, Keepalived, LBs, N2 VRF configuration
Rejection on PLMN mismatch; meaning of Time to Wait Whether to reject on TAC or slice mismatch
Meaning of Relative AMF Capacity (a relative weight) How capacity values are chosen; the gNB's concrete selection algorithm
UE context erasure at NG Setup and the retention condition via UE Retention Information Redundancy of the pods/containers handling SCTP

When NG Setup fails, separate the question into a 3GPP signaling problem / a transport or SCTP problem / a vendor implementation problem.


Comparison with EPC (4G)

Item 4G EPC (S1 Setup) 5GC (NG Setup)
Procedure S1 Setup (TS 36.413 §8.7.3) NG Setup (TS 38.413 §8.7.1)
Interface / port S1-MME / SCTP 36412 N2 / SCTP 38412
RAN-side identifier Global eNB ID Global RAN Node ID (gNB / ng-eNB / N3IWF, etc.)
Served area Supported TAs (TAC + Broadcast PLMNs) Supported TA List (TAC + PLMN + S-NSSAI)
Core-side identifier Served GUMMEIs Served GUAMI List
Capacity value Relative MME Capacity Relative AMF Capacity
Slice information None TAI Slice Support List / PLMN Support List
On failure S1 Setup Failure (Cause, Time to wait) NG Setup Failure (Cause, Time to Wait)

The skeleton is almost the same as S1 Setup; the big differences in 5G are the addition of slice (S-NSSAI) information and non-3GPP access nodes (N3IWF, etc.).


3GPP Specification

Spec Clause Content
TS 38.413 §8.1 Classification of NGAP procedures (Class 1 / Class 2)
TS 38.413 §8.7.1 NG Setup (§8.7.1.1 General / §8.7.1.2 Successful operation / §8.7.1.3 Unsuccessful operation / §8.7.1.4 Abnormal conditions; sub-clauses to be confirmed)
TS 38.413 §8.7.2 / §8.7.3 / §8.7.4 / §8.7.6 RAN Configuration Update / AMF Configuration Update / NG Reset / AMF Status Indication
TS 38.413 §9.2.6.1 / §9.2.6.2 / §9.2.6.3 Message definitions of NG Setup Request / Response / Failure
TS 38.413 §9.3.1.2 Cause
TS 38.413 / TS 23.502 §8.5 / §4.2.3.3 Paging (where the Supported TA List is used; to be confirmed)
TS 38.412 §7 SCTP on N2 (port, PPID, streams, TNL associations)
TS 23.003 §19.4.2.3 / §28.4.2 Formats of TAI/TAC / S-NSSAI (including to be confirmed)
TS 23.501 §5.15.2.1 / §5.19.3 S-NSSAI / AMF Load Balancing (weight factor; including to be confirmed)
TS 36.413 §8.7.3 S1 Setup (for the EPC comparison)
RFC 9260 — SCTP (obsoletes RFC 4960)

Summary

  • NG Setup is a non-UE-associated procedure between the gNB and the AMF, and the first NGAP procedure performed after SCTP is established
  • N2 comes up as IP → SCTP → NG Setup → UE-associated NGAP. "SCTP ESTABLISHED," "NG Setup succeeded" and "Registration succeeded" are separate stages
  • The gNB introduces itself with the Global RAN Node ID / Supported TA List (TAC, PLMN, S-NSSAI)
  • The AMF returns the Served GUAMI List / Relative AMF Capacity / PLMN Support List, which the gNB uses for AMF selection
  • The rejection condition explicitly specified is a PLMN mismatch. Handling of TAC and slice mismatches is implementation dependent
  • On failure, look at the Cause and Time to Wait. Redoing NG Setup erases UE contexts unless UE Retention has been agreed

Comprehension check

Q1. The SCTP association between the gNB and the AMF is ESTABLISHED, but there is a serious mismatch between the PLMN/TAC in the NG Setup Request and the AMF's service-area configuration. Which statement is most appropriate? A. Because SCTP is ESTABLISHED, NG Setup always succeeds / B. The AMF always returns an NG Setup Response and first detects the mismatch at Registration / C. Even if the transport layer is fine, NG Setup at the NGAP layer can fail / D. PLMN/TAC are checked by the SMF and UPF over PFCP, so NG Setup is not affected

Answer: C. SCTP is only the carrier; configuration consistency is checked in NGAP on top of it. If none of the PLMNs match, the AMF returns NG Setup Failure (TS 38.413 §8.7.1). Whether a TAC mismatch leads to rejection is AMF implementation dependent, but "always succeeds" (A) and "always returns a Response" (B) are wrong. PFCP (D) is the N4 (SMF⇔UPF) protocol and unrelated to NG Setup.

Q2. You changed Relative AMF Capacity from 255 to 0. What happens to already registered UEs?

They do not immediately move to another AMF. Relative AMF Capacity mainly affects new UEs, for which the gNB selects an AMF without an existing identifier. UEs with a 5G-GUTI / 5G-S-TMSI are returned to their previous AMF by the GUAMI. To move existing UEs, combine it with AMF Status Indication (Unavailable GUAMI) and load re-balancing mechanisms. Also, the treatment of 0 is gNB implementation dependent.

Q3. An NG Setup Failure contained Time to Wait. How should the gNB behave, and what is the purpose?

It does not resend NG Setup to the same AMF until the time indicated by Time to Wait has elapsed (TS 38.413 §8.7.1.3). The purpose is to prevent many gNBs from retrying at once and overwhelming the AMF, for example right after an AMF restart.

Q4. NG Setup was redone between a gNB and an AMF during operation. What is the impact on the UEs under that gNB?

Unless the gNB and the AMF have agreed on retaining UE contexts via UE Retention Information, NG Setup erases the existing NGAP UE-related contexts and the related signaling connections, as an NG Reset would (TS 38.413 §8.7.1.1, sub-clause to be confirmed). In that case, the UEs' N2 contexts are lost and the UEs have to re-establish their signaling connections. If there is an SCTP re-establishment loop, this repeats.


Next Step