XnAP (Xn — gNB ↔ gNB) in 5G NR
Inter-gNB signalling — Xn setup, handover preparation and dual connectivity.
Xn is the interface that connects two NG-RAN nodes directly — gNB to gNB (or gNB to ng-eNB) — and XnAP is the application protocol that runs on it. It is the RAN's own private wiring: the path a source gNB uses to hand a UE to a neighbour, to fetch a suspended context from another cell, or to recruit a second node for dual connectivity, all without dragging the 5G core into every step. The signalling is defined in TS 38.423, the general interface principles in TS 38.420.
Introduction
Xn is the horizontal interface of the 5G RAN: it runs between peer NG-RAN nodes rather than up toward the core. Where NG (N2/N3) connects a gNB to the 5G Core, Xn connects a gNB to its neighbours, and XnAP (TS 38.423) is the control protocol spoken across it, carried over SCTP over IP. A parallel user plane, Xn-U, carries forwarded data over GTP-U only while a handover is in flight.
You meet Xn throughout a connected UE's mobility and multi-connectivity life: when a UE moves from one gNB to another (Xn handover), when a suspended UE resumes under a different gNB (context retrieval), when an inactive UE must be paged across several cells (RAN paging), and when a second node is added to boost throughput (dual connectivity). In every case the intent is the same — keep the operation inside the RAN, where it is fast, and only involve the core at the very last step.
It matters because RAN-local mobility is what makes 5G handovers cheap and low-latency. Routing every handover decision up to the AMF and back would add core round-trips to a time-critical operation; Xn removes them. Understanding Xn is really understanding how neighbouring gNBs cooperate directly, and how the RAN keeps a UE's data flowing while it moves.
On this page
Why Xn is needed
In plain words: imagine two adjacent shop managers who each have a direct phone line between their back offices. When a customer walks from one shop to the next, the first manager just phones ahead — "this customer is coming, here's their order, get the counter ready" — and even couriers over the half-packed bag so nothing is dropped. They only file paperwork with head office after the handover is done. Xn is that back-office phone line and courier service between neighbouring gNBs; the AMF is head office, told only at the end.
Concretely, Xn earns its place by removing the core from operations that are inherently RAN-local. A handover decision comes from the UE's radio measurements, which only the RAN sees; the target's admission control and radio configuration are RAN state; and the in-flight packets that must be preserved during the handover gap live in the source gNB's PDCP buffers. Mediating all of that through the AMF over NG would add core signalling round-trips to a latency-sensitive procedure and load the core with events it does not need to arbitrate. Xn lets the two gNBs prepare the move, transfer PDCP state, and forward buffered data directly, so the core is touched exactly once — a single NG PATH SWITCH REQUEST at the end to redirect the downlink from the UPF.
A direct control-and-forwarding interface between two NG-RAN nodes. Control runs XnAP (TS 38.423) over SCTP on Xn-C; forwarded user data runs over GTP-U on Xn-U. It handles interface management, mobility, context retrieval, RAN paging and dual-connectivity coordination.
Doing mobility inside the RAN is faster and cheaper than mediating everything through the AMF. A UE handed between two gNBs with a direct Xn never involves the core until a single path-switch at the end.
Non-UE-associated procedures (XN SETUP, NG-RAN NODE CONFIGURATION UPDATE) establish and maintain the link; UE-associated procedures (handover preparation, SN STATUS TRANSFER, RETRIEVE UE CONTEXT, S-Node procedures) act per UE.
What Xn Is
Two neighbouring NG-RAN nodes that expect to exchange UEs set up an Xn interface between them. Once it is up, they speak XnAP over SCTP for control, and forward user data over GTP-U when a handover is in flight. The whole point is locality: preparing a handover or pulling a stored context directly between neighbours is far cheaper in latency than routing every decision through the AMF over NG. Xn is the low-latency, RAN-internal shortcut that the core never has to see until the very end.
XnAP procedures split cleanly into two families, and the distinction runs through everything that follows. Non-UE-associated procedures manage the interface itself — they carry no subscriber identity and are about the relationship between two nodes. UE-associated procedures act on one specific UE's context, and each side references that UE with its own NG-RAN node UE XnAP ID — an INTEGER (0..232−1) handle. The initiator allocates its identifier first; the responder allocates a second and echoes both back, so from then on either node can point unambiguously at the same context. This is the identical addressing pattern used across NG-RAN control interfaces.
Rule of thumb: if a direct Xn exists between source and target gNB, mobility uses Xn handover — the RAN prepares the target itself. If it does not, the source falls back to NG (N2) handover, where the AMF relays preparation. See Xn Handover and NG Handover.
Xn-C and Xn-U: Two Planes on One Interface
Xn is not a single pipe. It carries a control plane and a user plane that use completely different transport stacks, and knowing which is which explains most of what the interface does. The control plane, Xn-C, carries all XnAP signalling and rides on SCTP over IP — the same reliable, message-oriented transport used on NG and F1. The user plane, Xn-U, carries only forwarded user data during mobility, tunnelled in GTP-U over UDP/IP. Crucially, Xn-U is not a steady-state data path; it exists to move in-flight packets from the source to the target for the brief window of a handover, then it is torn down.
| Aspect | Xn-C (control plane) | Xn-U (user plane) |
|---|---|---|
| Protocol | XnAP (TS 38.423) signalling | GTP-U tunnels carrying user PDUs |
| Transport | SCTP over IP (reliable, ordered, multi-stream) | GTP-U over UDP over IP |
| Carries | Interface management, handover prep, context retrieval, RAN paging, S-Node procedures | Downlink (and optionally uplink) data forwarding during handover |
| Lifetime | Persistent while the Xn link is configured | Per-UE, per-DRB; set up for a handover, released after |
| Endpoints identified by | NG-RAN node UE XnAP ID pair (UE-associated) or none (non-UE) | GTP-U TEID (32-bit) + transport-layer address exchanged in HANDOVER REQUEST ACKNOWLEDGE |
Why SCTP for control: SCTP gives reliable, in-order delivery with multi-streaming (so head-of-line blocking on one UE's signalling does not stall another's) and multi-homing for path resilience. XnAP relies on that reliability — it has no message-level retransmission of its own. The standardised SCTP destination port for Xn-C is 38422 and the SCTP Payload Protocol Identifier (PPID) for XnAP is 61. Per TS 33.501 the transport is protected with IPsec (or DTLS over SCTP). GTP-U on Xn-U, by contrast, deliberately runs over connectionless UDP because forwarded packets are already sequenced by PDCP.
Interface Management (Non-UE-Associated)
Before any UE can be handed over, the two nodes must agree on who each other is and which cells they serve. That is the job of the non-UE-associated procedures. They run once when the Xn link is first configured and then again whenever a node's served cells, tracking areas or slice support change. Everything downstream depends on each node holding an accurate picture of its neighbour — a stale served-cell list means handovers prepared toward cells that no longer exist.
| Procedure | Purpose |
|---|---|
XN SETUP | Establishes the Xn interface. Each node advertises its identity (Global NG-RAN Node ID), its served cells (NR CGI, PCI, TAC, PLMN and slice support) and TNL information. The peer answers with XN SETUP RESPONSE, or XN SETUP FAILURE with a cause and possible time-to-wait. |
NG-RAN NODE CONFIGURATION UPDATE | Reports changes after setup — served cells added, modified or removed, updated TAC, or changed slice support — so the neighbour keeps its view current. Acknowledged by NG-RAN NODE CONFIGURATION UPDATE ACKNOWLEDGE. |
XN REMOVAL | Gracefully tears the interface down, releasing signalling associations at both ends. |
RESET | Returns both nodes to a known state after a failure, clearing UE-associated contexts referenced over Xn. |
ERROR INDICATION | Reports protocol or logical errors that do not have a dedicated failure message of their own. |
Notice that XN SETUP can be initiated by either node — there is no fixed client and server, unlike the strictly gNB-initiated NG SETUP toward the AMF. Whichever node decides the link should exist sends the request; the other responds. After that the two are peers, and either can push a NG-RAN NODE CONFIGURATION UPDATE at any time. Each served cell is named by its NR CGI (the 36-bit NR Cell Identity under the PLMN), its physical-layer PCI, its TAC and its supported S-NSSAI list — exactly the fields a neighbour needs to decide whether, and how, to prepare a handover toward it.
Mobility: Handover and Data Forwarding
Mobility is what Xn is really for. When a source gNB decides, from the UE's measurement reports, that a neighbour cell is better, it prepares a handover directly over Xn-C and then forwards the UE's in-flight downlink data over Xn-U so nothing is lost in the gap. The four UE-associated procedures below make up the full flow.
| Procedure | What it does |
|---|---|
HANDOVER REQUEST / HANDOVER REQUEST ACKNOWLEDGE | Handover preparation. The source asks the target to admit a RRC_CONNECTED UE and reserve resources, sending the UE context (security keys, PDU-session and DRB info, UE capabilities). The target admits what it can and returns a transparent container — an RRCReconfiguration with reconfigurationWithSync — plus the GTP-U forwarding endpoints (TEID + address) to use on Xn-U. |
SN STATUS TRANSFER | The source conveys per-DRB PDCP state — the UL COUNT value and DL COUNT value (HFN + PDCP SN) and receiveStatusOfUL-PDCP-SDUs — so the target continues PDCP numbering exactly where the source left off. This is the basis of lossless handover. |
| Data forwarding (Xn-U) | Using the endpoints from the acknowledge, the source tunnels undelivered downlink PDCP SDUs (and, for lossless bearers, unacknowledged ones) to the target over GTP-U. The target buffers them and delivers them to the UE after the UE synchronises to the new cell. |
UE CONTEXT RELEASE | Once the UE has successfully accessed the target and the path is switched, the target tells the source the handover succeeded. The source then frees the UE's radio and control resources and tears down the Xn-U forwarding tunnels. |
Two things are worth stressing. First, the AMF is not involved in preparation at all — it learns of the move only when the target runs the NG PATH SWITCH REQUEST to redirect the downlink from the UPF, after which the source is released. Second, data forwarding is what makes an Xn handover feel seamless: the source keeps feeding the target the packets that were in flight during the handover interruption, so the UE's TCP flows do not stall or reset. The full step-by-step walk-through lives in Xn Handover.
Dual Connectivity and RRC Transfer
Xn also coordinates multi-connectivity, where a UE is served by two nodes at once. In NR-DC (and the broader MR-DC family) a master node (MN) keeps the control-plane anchor and recruits a secondary node (SN) to add radio resources — typically extra throughput on a second carrier. All of that recruitment happens over Xn with the S-Node procedures.
| Procedure | Purpose |
|---|---|
S-NODE ADDITION / S-NODE ADDITION REQUEST ACKNOWLEDGE | The MN asks a candidate SN to allocate resources for the UE and provide its own RRCReconfiguration for the SCG (secondary cell group). The SN admits and returns the SCG configuration and its user-plane endpoints. |
S-NODE MODIFICATION | Either node changes an existing SN configuration — adding or releasing SCG bearers, changing SCells, updating security — whether MN-initiated or SN-initiated. |
S-NODE RELEASE | Releases the secondary node, whether the MN decides to drop it or the SN requests release. |
RRC TRANSFER | Carries SCG-related RRC messages between MN and SN inside XnAP — for example an RRCReconfigurationComplete the UE returned for the SCG, or SCG measurement reports — so the SN sees the RRC it needs without its own direct RRC connection to the UE. |
The role of RRC TRANSFER is easy to miss but essential: in MR-DC the UE has one RRC connection, anchored at the MN, yet the SN needs to configure and monitor its own cell group. Xn's RRC TRANSFER is the courier that shuttles the SN's RRC container to the UE via the MN and shuttles the UE's SCG responses back to the SN. Without it the secondary node would be blind to the radio conditions on its own carrier.
MN vs SN, in one line: the master node owns the signalling-radio-bearer anchor and the NG control connection to the AMF; the secondary node lends radio resources for user data. Xn is the only interface between them, carrying both the S-Node control procedures and the tunnelled SCG user data.
RRC-INACTIVE: RAN Paging and Context Retrieval
A UE in RRC_INACTIVE is suspended but not released: its AS context (security state, bearers, PDU sessions) stays stored in the last-serving gNB — the anchor — and the NG connection to the core is kept alive. Two XnAP procedures make this state work across a RAN Notification Area that spans several gNBs.
The first is RAN paging. When downlink data arrives for an inactive UE, the anchor must page it — but the UE may have moved to a cell served by a different gNB within the notification area. So the anchor sends XN-U ADDRESS INDICATION and issues the RAN PAGING procedure to its neighbours over Xn, and each neighbour transmits the paging message on its own air interface. This is distinct from core-network (CN) paging over NG: RAN paging stays inside the RAN and targets only the notification area.
The second is context retrieval. If the inactive UE decides to resume — or is reached by RAN paging — and does so at a gNB that is not its anchor, the new gNB has nothing stored locally. It uses the I-RNTI the UE presents in RRCResumeRequest to identify the anchor, then pulls the stored context over Xn with RETRIEVE UE CONTEXT REQUEST / RESPONSE. This avoids a full re-establishment through the core. The I-RNTI comes in two sizes — a full I-RNTI (40 bits) and a short I-RNTI (24 bits) — and it encodes both the anchor's identity and the UE's context reference there, which is exactly how the new gNB knows which neighbour to ask.
Why RETRIEVE UE CONTEXT matters: the whole promise of RRC_INACTIVE is a fast, cheap resume. If resuming under a neighbour forced a full setup through the AMF and UPF, the state would be pointless. Pulling the AS context directly over Xn keeps resume a RAN-local operation. See RRC States.
Key XnAP Procedures at a Glance
| Procedure | Class | Initiator | Use |
|---|---|---|---|
XN SETUP | Non-UE | either NG-RAN node | Establish the interface, exchange served-cell info. |
NG-RAN NODE CONFIGURATION UPDATE | Non-UE | either | Report served-cell / capability changes. |
HANDOVER REQUEST / ACKNOWLEDGE | UE | source gNB | Prepare Xn handover; admit UE at target, return forwarding endpoints. |
SN STATUS TRANSFER | UE | source gNB | Transfer PDCP COUNT state for lossless HO. |
UE CONTEXT RELEASE | UE | target gNB | Release source resources after successful HO. |
RETRIEVE UE CONTEXT | UE | new gNB | Fetch stored context on RRC_INACTIVE resume. |
RAN PAGING | UE | anchor gNB | Page an inactive UE across the RAN notification area. |
S-NODE ADDITION / MODIFICATION | UE | master node | Set up / change a secondary node in DC. |
RRC TRANSFER | UE | MN or SN | Shuttle SCG RRC messages between MN and SN. |
Note: TS 38.423 groups these as Elementary Procedures and defines each message's IEs; TS 38.420 gives the general Xn principles and the split into radio-network, transport-network and control planes. Cite the TS number when unsure of the exact clause.
LTE ↔ NR: Xn is the NR successor to LTE's X2 (X2AP, TS 36.423) — both are the horizontal, node-to-node RAN interface, and both split into a control plane (over SCTP) and a data-forwarding user plane (GTP-U). The differences follow from the state model NR added: Xn carries RETRIEVE UE CONTEXT and RAN PAGING for RRC_INACTIVE, a state LTE did not have; its secondary-node procedures are named S-NODE ADDITION/MODIFICATION/RELEASE (for NR-DC / NGEN-DC on the 5GC) rather than X2's SgNB ADDITION family (for EN-DC on the EPC); and the peer path switch runs to the AMF over NG rather than to the MME over S1. The rule of thumb: on the 5G Core you are on Xn; on the EPC you are on X2. See X2AP.
Summary
Xn is the RAN's horizontal interface — the direct link between two NG-RAN nodes that keeps mobility and multi-connectivity local to the RAN. Hold on to the two-plane split: Xn-C runs XnAP over SCTP for all control, and Xn-U carries GTP-U data forwarding only during the brief handover window. Everything XnAP does then sorts into two families — non-UE-associated procedures (XN SETUP, NG-RAN NODE CONFIGURATION UPDATE) that manage the link, and UE-associated procedures that act on one subscriber under a paired NG-RAN node UE XnAP ID.
The four things Xn is really for: handover (prepare the target, transfer PDCP COUNT state, forward in-flight data, release the source), context retrieval (pull a suspended UE's AS context from its anchor using the I-RNTI on RRC_INACTIVE resume), RAN paging (reach an inactive UE across the notification area), and dual connectivity (add and steer a secondary node, shuttling its RRC over RRC TRANSFER). In all of them the AMF is touched only at the end, in a single NG path switch — which is the whole reason Xn exists.
Quick Q&A
⚠ Common pitfalls / gotchas
- Stale served-cell / neighbour data. If a node changes cells but the
NG-RAN NODE CONFIGURATION UPDATEis missed, handovers get prepared towardNR CGIs that no longer exist — failures that look like radio problems but are really configuration drift. - Treating Xn-U as a steady-state path. Xn-U tunnels are per-UE, per-DRB and torn down after the handover. Persistent user traffic never rides Xn; if you see it, something is wrong with path switch.
- Missing or late
SN STATUS TRANSFER. Without the PDCPCOUNThandoff the target restarts numbering, breaking reordering and duplicate detection — the handover completes but data is lost or duplicated. - No Xn where you assumed one. If a direct Xn does not exist (or its
XN SETUPfailed), mobility silently falls back to NG/N2 handover via the AMF — slower, and a different trace entirely. - I-RNTI pointing at the wrong anchor. On resume, a misconfigured or reused
I-RNTIsendsRETRIEVE UE CONTEXT REQUESTto a node that has no such context, forcing a fallback to full setup through the core.
Q. What is the difference between Xn-C and Xn-U?
A. Xn-C is the control plane: it carries all XnAP signalling over SCTP/IP. Xn-U is the user plane: it carries forwarded user data during handover, tunnelled in GTP-U over UDP/IP. Xn-C is persistent while the link is configured; Xn-U tunnels are per-UE, per-DRB and torn down once the handover completes.
Q. In an Xn handover, when does the AMF get involved, and what is data forwarding for?
A. The AMF is not involved in preparation at all — the source prepares the target directly over Xn-C. The core learns of the move only when the target runs the NG PATH SWITCH REQUEST to redirect the downlink from the UPF. Data forwarding over Xn-U carries the UE's in-flight downlink PDCP SDUs from source to target during the interruption, so flows are not lost, giving a lossless handover.
Q. What does SN STATUS TRANSFER carry, and why?
A. It carries per-DRB PDCP state — the uplink and downlink COUNT values (HFN + PDCP SN) and receiveStatusOfUL-PDCP-SDUs. The target uses it to continue PDCP numbering exactly where the source stopped, which is what makes the handover lossless and duplicate-free.
Q. When is RETRIEVE UE CONTEXT used, and how does the new gNB find the anchor?
A. When a UE in RRC_INACTIVE sends RRCResumeRequest at a gNB that is not its anchor. The I-RNTI the UE presents encodes the anchor's identity, so the new gNB locates the anchor and pulls the stored AS context over Xn-C, avoiding a full re-establishment via the core.
Q. What are the S-Node procedures and RRC TRANSFER for?
A. Dual connectivity (NR-DC / MR-DC). The master node uses S-NODE ADDITION, S-NODE MODIFICATION and S-NODE RELEASE over Xn to add, change or release a secondary node that provides extra radio resources. RRC TRANSFER shuttles SCG-related RRC messages between MN and SN, since the UE has only one RRC connection (anchored at the MN).
Q. Xn handover vs NG handover — how do you choose?
A. If a direct Xn interface exists between source and target gNB, use Xn handover (the RAN prepares the target itself, AMF involved only at path switch). Without Xn, fall back to NG/N2 handover, where the AMF relays preparation between source and target. See NG Handover.
Where to go next
Xn is the plumbing under RAN mobility and dual connectivity. Walk the full handover flow it carries step by step, revisit the state that makes context retrieval necessary, and contrast it with the core-mediated alternative.