📡 4G/5G Networks

Deep dive into modern cellular network technologies: 4G LTE and 5G architecture, protocols, authentication, and practical applications.


Table of Contents


Big Picture: What Mobile Networks Do

A cellular network provides the UE (phone/device) the following critical services:

  1. Connectivity: Get internet access to external networks
  2. Identity & Authentication: Verify subscriber is legitimate before granting service
  3. Mobility: Move between cells/towers without session drop or authentication restart
  4. Services: Support voice calls, SMS, real-time apps with QoS guarantees

Types of Traffic


4G LTE Architecture {#4g-lte-architecture}

High-Level Overview

UE (Device) ↔ eNodeB ↔ EPC (Core) ↔ Internet/IMS

4G LTE Basics

Key Features

EPC Components

1. UE (User Equipment)

2. E-UTRAN (Radio Network)

eNodeB (eNB) - 4G Base Station/Tower

Responsibilities:

3. MME (Mobility Management Entity) — Control Plane

Functions:

Interfaces: S1-MME (to eNB), S6a (to HSS), S10 (to other MMEs)

4. SGW (Serving Gateway) — User Plane Anchor

Functions:

Interfaces: S1-U (to eNB), S5 (to PGW)

5. PGW (Packet Gateway) — Internet Exit

Functions:

Interfaces: S5 (to SGW), S2a/S2b (to external networks/PDN)

6. HSS (Home Subscriber Server) — Subscriber Database

Stores:

Interfaces: S6a (to MME), Cx (to IMS)

7. PCRF (Policy and Charging Rules Function)

Functions:

Interfaces: Rx (to IMS/App servers), Gx (to PGW)

4G Architecture Diagram

4G LTE Architecture

Complete 4G architecture showing E-UTRAN, EPC components, IMS, and external networks with all interfaces (S1-MME, S1-U, S5/S8, S6a, Gx, SGi).

4G Architecture Class Diagram

4G LTE Class Architecture

Complete 4G architecture class-diagram showing E-UTRAN, EPC components, IMS, and external networks with all interfaces (S1-MME, S1-U, S5/S8, S6a, Gx, SGi).


How 4G Works (Practical Example)

Scenario: Opening YouTube on LTE

Step 1: Attachment

Step 2: Bearer Setup

Step 3: Data Flow User plane path:

UE ↔ eNB ↔ SGW ↔ PGW ↔ Internet

Data is tunneled using GTP-U (GPRS Tunneling Protocol - User Plane):

Step 4: QoS Enforcement

Attach & Bearer Setup Flow

4G Attach and Bearer Setup

Sequence diagram showing complete 4G attach procedure: RRC connection, NAS authentication with HSS, bearer setup via MME/SGW/PGW, and QoS policy from PCRF.


4G Voice (VoLTE) {#4g-voice-volte}

What is VoLTE?

VoLTE = Voice over LTE

LTE is packet-based, so voice is also carried as IP packets (not circuit-switched):

VoLTE Architecture

VoLTE leverages the IMS (IP Multimedia Subsystem) core:

IMS Elements:

VoLTE Call Flow (High-Level)

  1. UE registers with IMS using SIP
    • Sends REGISTER message via P-CSCF
    • S-CSCF authenticates and stores registration
  2. Outgoing call:
    • UE sends INVITE (SIP) via P-CSCF
    • S-CSCF routes to callee
    • Media path (voice RTP) established
  3. LTE QoS Bearer:
    • SMF/PCRF allocates high-priority bearer (e.g., QCI=1)
    • Voice traffic gets low-latency, low-jitter handling

VoLTE Call Flow Diagram

VoLTE Call Flow

Complete VoLTE call flow showing IMS registration, SIP INVITE/200 OK signaling via P-CSCF/S-CSCF, and RTP media establishment with QoS bearer (QCI=1).


Real-Time Traffic in 4G

Real-time applications need:

EPS Bearers (QoS mechanism)

LTE uses EPS Bearers with QCI (QoS Class Identifier):

QCI Traffic Type Latency Loss Rate Example
1 Conversational <50ms 10^-2 VoLTE
2 Streaming <150ms 10^-3 Video call
3 Interactive <150ms 10^-3 Gaming
4 Background <300ms 10^-6 Downloads

Voice bearer (QCI=1) has highest priority in:


5G Architecture {#5g-architecture}

High-Level Overview

UE (Device) ↔ gNB ↔ 5GC (Core) ↔ Internet/IMS

5G NR Basics

Improvements over 4G

Key Change: Service-Based Architecture (SBA)

4G: Fixed network topology with dedicated interfaces (S1, S11, S5, etc.)

5G: Microservices-based architecture

NG-RAN (Radio Side)

gNB = 5G base station (next-generation Node B)

5G Core NFs (Network Functions)

1. AMF (Access & Mobility Management Function) — Control Plane

Replaces: MME (from 4G)

Functions:

Interfaces:

2. SMF (Session Management Function) — Control Plane

Replaces: Parts of MME + PGW (from 4G)

Functions:

Interfaces:

3. UPF (User Plane Function) — User Plane Anchor

Replaces: SGW + PGW (from 4G, now unified)

Functions:

Interfaces:

4. UDM (Unified Data Management) — Subscriber DB

Replaces: HSS (from 4G)

Functions:

Interfaces: N13 (to AMF), N10 (to SMF)

5. AUSF (Authentication Server Function) — Auth Validation

New in 5G

Functions:

Interfaces: N12 (to AMF), N13 (to UDM)

6. PCF (Policy Control Function) — Policy

Replaces: PCRF (from 4G)

Functions:

Interfaces: N7 (to SMF), Rx (to IMS)

7. NRF (NF Repository Function) — Service Registry

New in 5G

Functions:

Interfaces: N27 (to all NFs)

8. NSSF (Network Slice Selection Function)

New in 5G

Functions:

5G Architecture Diagram

5G Architecture

5G architecture with NG-RAN (gNB), 5GC network functions (AMF, SMF, UPF, AUSF, UDM, PCF, NRF, NSSF), IMS, and external networks showing service-based architecture (SBA) with N1-N6 interfaces.

5G Architecture Class Diagram

5G Architecture Class

5G architecture Class Diagram with NG-RAN (gNB), 5GC network functions (AMF, SMF, UPF, AUSF, UDM, PCF, NRF, NSSF), IMS, and external networks showing service-based architecture (SBA) with N1-N6 interfaces.


How 5G Works (Practical Example)

Scenario: Opening YouTube on 5G

In 5G, an internet session = PDU Session (Protocol Data Unit Session)

Step 1: Registration

Step 2: PDU Session Setup

Step 3: Data Flow

User plane path (much simpler than 4G):

UE ↔ gNB ↔ UPF ↔ Internet

Tunneling:

Step 4: QoS Enforcement

Step 5: Mobility

Complete 5G Flow Diagram

5G Registration + 5G-AKA + PDU Session

End-to-end sequence diagram showing: UE registration via gNB → AMF, NF discovery through NRF, 5G-AKA authentication with AUSF/UDM, PDU session establishment via SMF, and UPF configuration for data flow.


AS vs NAS (Critical Concept)

Telecom networks split control signaling into two logical layers:

Access Stratum (AS)

Definition: Radio access layer protocols

Scope: UE ↔ Base Station (eNB/gNB) over radio

Protocols:

Example Message: RRC measurement report, RRC reconfiguration

Layman’s Analogy: “How your phone talks to the tower over the radio waves”

Non-Access Stratum (NAS)

Definition: Core network control signaling

Scope: UE ↔ Core Network (MME/AMF) logically

Protocols:

Functions:

Example Message: Registration Request, PDU Session Establishment Request

Layman’s Analogy: “How your phone talks to the operator’s brain (core network)”

Key Difference: Security

If radio encryption broken, NAS is still protected!

AS vs NAS Signaling Flow

5G AS vs NAS

Sequence diagram showing the separation between Access Stratum (AS) signaling (UE ↔ gNB: RRC, PDCP, RLC, MAC) and Non-Access Stratum (NAS) signaling (UE ↔ AMF: Registration, Authentication, Session) with NAS messages encapsulated through AS.


Control Plane vs User Plane

Control Plane (CP)

Purpose: Setup, manage, tear down sessions

Functions:

In 4G (CP path):

UE ↔ eNB ↔ MME ↔ HSS/PCRF

In 5G (CP path, SBA):

UE ↔ gNB ↔ AMF ↔ AUSF/UDM/SMF/PCF (all via service APIs)

Typical message: “Set up a bearer with 50 Mbps guarantee”


User Plane (UP)

Purpose: Carry actual user traffic (data, voice, video)

Flow: Real YouTube video stream, WhatsApp call audio

In 4G (UP path):

UE ↔ eNB ↔ SGW ↔ PGW ↔ Internet

In 5G (UP path):

UE ↔ gNB ↔ UPF ↔ Internet

Typical message: “IP packet: 1.2.3.4 → YouTube server”


Key Separation (N2/N3 split)

5G explicitly separates CP and UP interfaces:

Benefit:

Control Plane vs User Plane Diagram

5G Control vs User Plane

Sequence diagram illustrating the separation of Control Plane (N2: gNB ↔ AMF, setup/signaling) and User Plane (N3: gNB ↔ UPF, data traffic) with N4 interface (SMF ↔ UPF) for forwarding rule configuration.


5G Interfaces (N2, N3, N4, N6) {#5g-interfaces}

N2: gNB ↔ AMF (Control Plane)

N3: gNB ↔ UPF (User Plane)

N4: SMF ↔ UPF (Management Interface)

N6: UPF ↔ Data Network (External Interface)


5G-AKA Authentication {#5g-aka-authentication}

What is 5G-AKA?

5G-AKA = Authentication and Key Agreement

It’s the “login mechanism” of 5G networks:

Why It Exists

Threats it prevents:

Key Entities

  1. UE/USIM
    • Stores secret key K (128-256 bits)
    • Derived keys are also computed on SIM
  2. AMF (Access & Mobility Management)
    • Orchestrates 5G-AKA
    • Requests auth from AUSF
    • No access to secret K
  3. AUSF (Authentication Server Function)
    • Validates UE’s response
    • Derives session keys
    • No direct access to K either
  4. UDM/ARPF (Authentication & Repository Function)
    • Stores secret K (in HSS equivalent)
    • Generates authentication vectors
    • Can only be accessed by AUSF

5G-AKA Flow (Story)

Scene: User powers on 5G phone

  1. UE → AMF: Registration Request (with SUPI: subscription ID)

  2. AMF → AUSF: Authentication request for this user

  3. AUSF → UDM/ARPF: “Generate auth vector for this user”

  4. UDM/ARPF → AUSF: Returns:
    • RAND: Random challenge (128 bits)
    • AUTN: Authentication token (network authenticity proof)
    • XRES*: Expected response (hashed)
    • K_AUSF: Key material for session
  5. AUSF → AMF: Sends RAND, AUTN

  6. AMF → UE: Authentication Request with RAND, AUTN

  7. UE/USIM computes:
    • Verifies AUTN (checks network authenticity)
      • Extracts AK (Anonymity Key) = f5(K, RAND)
      • Extracts SQN (sequence number)
      • Verifies SQN is fresh (not replayed)
    • Computes RES* = f2*(K, RAND) → (hashed and bound to serving network)
  8. UE → AMF: Authentication Response with RES*

  9. AMF → AUSF: Sends received RES*

  10. AUSF validates: Does RES* == XRES*?
    • If yes: Authentication success
    • Derives session keys:
      • K_SEAF (network anchor key)
      • K_AMF (encryption key for NAS)
      • K_NASint (integrity key for NAS)
  11. AMF → UE: Authentication success
    • UE also derives same keys locally
    • Registration completes

Where Secret K Lives

Why 5G uses RES/XRES (Not Simple RES/XRES)

4G problem: Response could be replayed or used in different network

5G fix: RES* binds response to serving network identity:

RES* = KDF(RES, RAND, SN_name)

Where SN_name = Serving Network Identity

Result:


5G Voice (VoNR) {#5g-voice-vonr}

What is VoNR?

VoNR = Voice over New Radio

Similar concept to VoLTE:

VoNR vs VoLTE

Aspect VoLTE VoNR
Radio LTE 5G NR
Latency ~100ms ~1ms
Voice Quality HD Voice Ultra HD Voice
Bandwidth 12 kHz 16+ kHz
IMS Yes Yes
Fallback To 3G/2G To LTE (VoLTE)

VoNR Fallback

If VoNR unavailable (no 5G coverage):

VoNR Call Flow Diagram

VoNR Call Flow

VoNR call flow showing IMS registration on 5G SA, SIP signaling via P-CSCF/S-CSCF, and RTP media with 5G QoS flow (5QI) - demonstrating ultra-low latency voice over 5G NR.


NGFW/SASE Alignment

Where Does Security Enforcement Fit?

In 5G, UPF is the primary data plane gateway:

5G + NGFW/SASE Integration

Typical deployment:

UE → gNB → UPF → Security/SASE → Internet

Or selective routing:

UE → gNB → UPF → [ normal traffic ] → Internet
              ↓
              [ suspicious/policy traffic ] → SASE/NGFW → Internet

Security Services at UPF

Integration Points

5G Security Steering: SMF→UPF Rules + Data Path

5G Security Steering: SMF→UPF Rules + Data Path

Sequence diagram showing 5G Security Steering: SMF→UPF Rules + Data Path (N4 + N6): PCF policy decision → SMF configures UPF via N4 → UPF forwards traffic through security chain (DPI, URL filter, threat prevention) at N6 interface before reaching Internet/DN.

5G NGFW/SASE Integration Flow Diagram

5G NGFW/SASE Architecture Flow

Sequence diagram showing runtime traffic steering to NGFW/SASE: PCF policy decision → SMF configures UPF via N4 → UPF forwards traffic through security chain (DPI, URL filter, threat prevention) at N6 interface before reaching Internet/DN.


Key Takeaways

  1. Big Picture:
    • Mobile networks provide connectivity, authentication, mobility, services
    • Fundamentally different from enterprise networks
  2. 4G Architecture:
    • EPC is element-based (MME, SGW, PGW, HSS)
    • All-IP but with dedicated interfaces
    • Voice via IMS (VoLTE)
  3. 5G Architecture:
    • 5GC is service-based (AMF, SMF, UPF, UDM, AUSF, etc.)
    • HTTP/2 REST APIs for NF communication
    • Microservices with NRF discovery
    • Simplified user plane (no SGW layer)
  4. NAS vs AS:
    • NAS: Core signaling (UE ↔ AMF, includes auth, registration, session setup)
    • AS: Radio signaling (UE ↔ gNB, includes RRC, PDCP, RLC, MAC, PHY)
    • NAS encrypted end-to-end, AS encrypted at radio layer
  5. Control Plane vs User Plane:
    • CP: Setup sessions (registration, bearer allocation)
    • UP: Carry traffic (YouTube, voice, emails)
    • 5G explicitly splits N2 (CP) and N3 (UP)
  6. 5G Interfaces:
    • N2: Control messages gNB ↔ AMF
    • N3: User traffic gNB ↔ UPF (GTP-U)
    • N4: Forwarding rules SMF ↔ UPF (PFCP)
    • N6: UPF ↔ Internet
  7. 5G-AKA:
    • Mutual authentication with secret key K (on USIM + UDM)
    • RES/XRES binding prevents replay/roaming attacks
    • Session keys (K_SEAF, K_AMF) derived for NAS encryption
  8. Voice:
    • VoLTE: 4G voice via IMS, QCI=1 bearer
    • VoNR: 5G voice via IMS, ultra-low latency
  9. Security & NGFW/SASE:
    • UPF is key point for data plane security insertion
    • N6 interface (UPF to Internet) is best point for DPI, URL filtering
    • SMF policies can steer traffic through SASE chain
    • Edge UPF deployment enables local security (zero trust)
  10. Key Architectural Differences (4G vs 5G):
Aspect 4G LTE 5G NR
Core Architecture Element-based (MME/SGW/PGW) Service-based microservices (AMF/SMF/UPF)
Gateway Separate SGW, PGW Unified UPF
Latency ~100ms ~1ms
Data Rate 300 Mbps 10 Gbps
Spectrum Sub-6 GHz Sub-6 GHz + mmWave
NF Communication Dedicated interfaces REST APIs, service discovery
MIMO Limited (4-8 antennas) Massive MIMO (64+ antennas)
Network Slicing No Yes (create virtual networks)
Authentication KASME key derivation 5G-AKA with RES* binding
Voice VoLTE VoNR

← Back to 4G/5G Learning Hub 🏠