5G 会话建立(PDU session establishment in 5G)

此处PDU即Packet Data Unit, 是数据流的基本单位,即数据单元。下面我们分步骤讲解5G会话建立的过程,此过程发生在注册,安全认证(5G-AKA)之后。安全认证之后,所有信令消息都已被加密传输,所以下面步骤中传输的所有消息都是加密的。

UE -> AMF (PDU Session Establishment Request (5GSM))

UE initiates PDU Session establishment by sending a 5GSM message inside NAS. It specifies which network slice to use, which data network (DNN), IP type, and session parameters.

AMF -> SMF (AMF Selects SMF by Nnrf_NFDiscovery_Request (Find SMF))

AMF queries NRF (Network Repository Function) to discover the right SMF based on: DNN, S-NSSAI, UE location, and SMF capabilities. NRF returns a list of suitable SMF instances.

AMF -> SMF (Create SM Context by Nsmf_PDUSession_CreateSMContext Request)

AMF forwards PDU session request to the selected SMF. SMF will orchestrate the entire session: select UPF, get policies, allocate IP, configure data path, and setup radio bearers.

SMF -> UDM (Get SM Subscription Data by Nudm_SDM_Get (SM Subscription))

SMF retrieves session management subscription data: allowed DNNs, Session-AMBR limits, default 5QI, default SSC mode, and charging characteristics.

SMF -> PCF (Request Session Policies by Npcf_SMPolicyControl_Create)

SMF requests session policies from PCF. PCF decides: QoS rules, charging rules, traffic routing, and usage monitoring. PCF considers subscription tier, time of day, network congestion, and operator policies.

SMF -> UPF (Select UPF by Nnrf_NFDiscovery_Request (Find UPF))

SMF queries NRF to find the optimal UPF based on: UE location, DNN, required capabilities (e.g. edge computing), and load. The selected UPF should be close to the UE for low latency.

SMF -> UPF (IP Address Allocation (Internal)(DNS, IP))

SMF allocates an IP address for the UE from the DNN IP pool. This could be static (from subscription) or dynamic (DHCP-style). The UPF will use this IP to identify the UE’s traffic.

SMF -> UPF (Configure UPF Packet Rules by PFCP Session Establishment Request (N4))

SMF sends PFCP rules to UPF - THE MOST CRITICAL STEP! PDR (Packet Detection Rule) identifies packets, FAR (Forwarding Action Rule) defines what to do, QER (QoS Enforcement Rule) applies speed limits, URR (Usage Reporting Rule) tracks billing data.

UPf -> SMF (UPF Confirms Rules by PFCP Session Establishment Response (N4))

UPF confirms all rules are installed and provides its N3 interface details: IP address and TEID (Tunnel Endpoint ID) for receiving uplink GTP-U tunneled packets from gNB.

SMF -> AMF (SMF Responds to AMF by Nsmf_PDUSession_CreateSMContext Response)

SMF informs AMF that the core network side is ready. It provides: UPF tunnel info, QoS Flow parameters, Session-AMBR, and NAS message (PDU Session Accept with UE IP) to send to UE.

AMF -> RAN (Request Radio Bearer Setup by PDU Session Resource Setup Request (N2/NGAP))

AMF instructs gNB to setup radio resources for the PDU session. Message contains: UPF tunnel endpoint (where to send UL traffic), QoS parameters, Session-AMBR(UL, DL rate), and NAS PDU Session Accept.

RAN -> UE (Configure Data Radio Bearer by RRC Reconfiguration)

gNB configures Data Radio Bearer (DRB) - the “data highway” over the air. It also forwards the NAS PDU Session Accept containing the UE’s IP address!

UE -> RAN (UE Confirms DRB Setup by RRC Reconfiguration Complete)

UE confirms DRB is configured and ready. UE has also processed the NAS PDU Session Accept, so it knows its IP address (10.45.0.5). The air interface is ready for user data!

RAN -> AMF (PDU Session Resource Setup Response (N2/NGAP))

gNB confirms radio setup success and provides its N3 tunnel endpoint for downlink. This is the LAST piece of the puzzle - now we have both tunnel endpoints (UPF and gNB)!

SMF -> UPF (Update UPF with gNB Tunnel by PFCP Session Modification Request (N4))

SMF updates UPF with the gNB tunnel endpoint. Now UPF knows where to send downlink packets for this UE - encapsulate in GTP-U and send to gNB.

UPF -> SMF (PDU Session Complete by PFCP Session Modification Response (N4))

🎉 PDU SESSION COMPLETE! End-to-end data path is fully operational! ✅ UPLINK PATH: UE → DRB → gNB → GTP-U(192.168.200.100:ABCDEF01) → UPF → Internet ✅ DOWNLINK PATH: Internet → UPF → GTP-U(192.168.100.50:12345678) → gNB → DRB → UE User data can now flow bidirectionally! The UE can browse the internet, stream videos, and use any IP services! 🚀