Skip to main content

SGSN (Packet Domain)

OmniMSC includes an integrated S4-SGSN that serves the packet-switched (PS) domain for 3G (UTRAN) subscribers over Iu-PS, anchoring their data sessions on the same S-GW/P-GW as LTE. A single node serves both the CS domain (voice, SMS) and the PS domain (packet data) for a subscriber; combined attach is handled in-process between the SGSN and the VLR.

The SGSN is disabled by default and enabled per the configuration below. Most external dependencies are opt-in so a lab can run the packet core with a static peer and injected credentials before a full HLR/DNS estate exists.


Architecture​

Direct Tunnel is used: the GTP-U user plane runs directly between the RNC and the S-GW-U. The SGSN brokers the tunnel endpoints during bearer setup but never carries user-plane packets. When the UE goes idle (PMM-IDLE) the SGSN re-anchors the downlink endpoint back on itself so the S-GW buffers and raises a Downlink Data Notification instead of sending to a released RNC (TS 23.060 §15.6).


Interfaces​

InterfacePeerProtocolPurposeReference
Iu-PSRNCRANAP over SCCP/M3UANAS transport, RAB assignment, relocationTS 25.413
GrHLR / AuCMAP over TCAP/SCCPLocation update, auth vectors, subscriptionTS 29.002
S4S-GW (SGW-C)GTPv2-CCreate / Modify / Delete Session, pagingTS 29.274
S3MMEGTPv2-C3G-PS to LTE inter-RAT mobilityTS 29.274 §7.3
Gn/Gp (CAP)gsmSCFCAP over TCAP/SCCPCAMEL GPRS online charging / controlTS 29.078
GTP-URNC to S-GW-UGTP-U (Direct Tunnel)User plane (not through the SGSN)TS 29.281

Iu-PS, Gr, S3 and CAP reuse the SS7 and GTPv2-C stacks the CS side already runs. S3 and Sv share the GTPv2-C server; the SRVCC Sv interface remains on its own socket.


Configuration​

The SGSN reads config :omnimsc, :sgsn and, for the GTPv2-C interfaces, the shared config :gtpc, :service block.

config :omnimsc, :sgsn,
enabled: true,
# Routing area this SGSN serves (advertised to UEs)
rai: %{mcc: "001", mnc: "01", lac: 1, rac: 1},
# NRI width for P-TMSI allocation in a pool (0 = no pool)
nri_bits: 6,
# This SGSN's S4/S3 control-plane F-TEIDs advertised to the S-GW / MME
s4_f_teid: %{teid: "0a0a0a0a", ipv4: "10.0.0.10"},
s3_f_teid: %{teid: "0b0b0b0b", ipv4: "10.0.0.10"},
# GTP-C recovery restart counter (TS 23.007 §18)
recovery: 1,
# Static packet-core peers (used unless DNS selection is enabled)
sgw: %{ip: "10.179.1.25", port: 2123},
pgw_c: "10.179.1.21",
# Default APN-AMBR sent in Create Session when the subscription carries none
default_apn_ambr: %{ul: 0, dl: 0},
# APN-based P-GW/S-GW selection via DNS S-NAPTR (opt-in; default off)
pgw_dns: false,
sgw_dns: false,
# Iu-release guard timer (ms) after an Iu Release Command
iu_release_guard_ms: 5000,
# GMM / SM retransmission timer overrides (ms)
gmm_timers: %{t3350: 6000, t3360: 6000, t3370: 6000, t3312: 3_240_000},
sm_timers: %{t3395: 8000},
# Subscription fallback when Gr Insert Subscriber Data is not wired
subscribed_apns: ["internet"],
default_apn: "internet",
wildcard_apn: false

config :gtpc,
service: %{
name: :s3,
listen_ip: "10.0.0.10",
listen_port: 2123,
control_module: Omnimsc.Gtpc.Router,
t3: 5000,
n3: 3
}

Core Parameters​

ParameterTypeRequiredDefaultDescription
enabledBooleanNofalseMaster switch for the SGSN process tree and interfaces.
raiMapYes-Routing Area Identity (mcc/mnc/lac/rac) advertised to UEs and used as the serving network.
nri_bitsIntegerNo0NRI field width in the P-TMSI; align with the MSC pool. 0 disables pooling.
s4_f_teidMapYes-SGSN S4 control F-TEID (teid hex, ipv4) the S-GW addresses for bearer signalling.
s3_f_teidMapNo-SGSN S3 control F-TEID advertised to the MME for inter-RAT mobility.
recoveryIntegerNo0GTP-C Recovery restart counter (TS 23.007 §18). Increment on SGSN restart.
sgwMapNo%{ip: "10.179.1.25", port: 2123}Static S-GW GTP-C peer used when sgw_dns is off.
pgw_cStringNo"10.179.1.21"Static P-GW GTP-C address used when pgw_dns is off.
default_apn_ambrMapNo%{ul: 0, dl: 0}APN-AMBR (kbps) placed in Create Session when the subscription supplies none. 0/0 avoids lab S-GWs that reject a non-zero value.
pgw_dnsBooleanNofalseResolve the P-GW per requested APN via DNS S-NAPTR (TS 29.303). Falls back to pgw_c on any DNS miss.
sgw_dnsBooleanNofalseResolve the S-GW per requested APN via DNS S-NAPTR. Falls back to sgw on any DNS miss.
iu_release_guard_msIntegerNo5000Time to wait for RANAP Iu Release Complete before force-freeing the connection (TS 25.413 §8.5).

Timer Parameters​

ParameterTypeDefault (ms)Description
gmm_timers.t3350Integer6000Retransmit of Attach Accept / RAU Accept / P-TMSI Reallocation awaiting Complete (TS 24.008 §11.2.2).
gmm_timers.t3360Integer6000Retransmit of Authentication & Ciphering Request awaiting Response.
gmm_timers.t3370Integer6000Retransmit of Identity Request awaiting Identity Response.
gmm_timers.t3312Integer3240000Mobile-reachable / periodic-RAU timer; on expiry (plus grace) the MM and PDP contexts are implicitly detached (TS 24.008 §4.7.2.2).
sm_timers.t3395Integer8000Retransmit of a network-requested Deactivate PDP Context Request awaiting Accept (TS 24.008 §6.1.3.4.2).

All retransmission timers cap at 5 attempts before the procedure is abandoned.

Subscription and APN Parameters​

Used to validate the requested APN when Gr Insert Subscriber Data has not populated a live subscription (see Gr MAP). When a real subscription is present it takes precedence over these static values.

ParameterTypeDefaultDescription
subscribed_apnsList[]Allowed APN names. A requested APN outside this list is rejected with SM cause 33 (TS 24.008 §10.5.6.6). Empty disables enforcement (accept any).
default_apnString-APN used when the UE requests none. Falls back to the sole subscribed APN if unset.
wildcard_apnBooleanfalseWhen true, any requested APN is permitted (wildcard subscription).

Lab Injection Seams​

These keys inject a function (or {module, function}) so the packet core can run before the SS7/HLR estate is complete. They are optional; when unset the SGSN skips the corresponding external round-trip and the procedure still completes.

ParameterTypeDescription
quintet_sourceFunction/{m,f}Supplies a UMTS AKA quintet (imsi, resync) for the authentication challenge instead of a live Gr SendAuthenticationInfo.
gr_sourceFunction/{m,f}Supplies the HLR UpdateGprsLocation / Insert Subscriber Data result at attach. When unset, attach proceeds without Gr registration.
purge_ms_sinkFunction/{m,f}Receives a Purge MS notification when the SGSN drops a subscriber.

GTP-C Service Parameters​

ParameterTypeRequiredDefaultDescription
nameAtomYes-Service name; :s3 for the SGSN mobility server.
listen_ipStringYes-Bind address for the GTPv2-C server.
listen_portIntegerNo2123GTP-C UDP port (TS 29.274).
control_moduleModuleYes-Omnimsc.Gtpc.Router routes peer-initiated S3/S4 messages into the SGSN.
t3IntegerNo5000GTP-C request retransmission timer (ms).
n3IntegerNo3GTP-C maximum retransmission attempts.

When both Sv (SRVCC) and the SGSN's GTPv2-C interfaces run on one host, bind them to distinct IP/port endpoints.


Mobility Management (GMM)​

The SGSN runs a per-UE GMM state machine (TS 24.008 §4.7).

Implemented GMM behaviour:

  • Attach / RAU / Detach / Service Request, with combined (PS+CS) attach handled in-process with the VLR.
  • UMTS AKA authentication with RES validation against XRES, including AUTS resynchronisation.
  • P-TMSI allocation and a P-TMSI signature authenticated on a later attach/RAU (TS 24.008 §10.5.5.8).
  • Retransmission timers T3350/T3360/T3370 and the mobile-reachable timer T3312 driving implicit detach.
  • RANAP Common ID sent to the RNC after Security Mode Complete (TS 25.413 §8.24).
  • Identity procedure requesting IMEISV during attach.
  • GMM STATUS on an unknown or erroneous GMM message, and per-procedure reject causes (not a single generic cause).
  • Network-initiated (MT) Detach Request so the network can detach a UE and prompt re-attach.
  • PDP Context Status handling on RAU / Service Request so the MS and SGSN PDP state cannot diverge.
  • Iu release after a signalling-only procedure completes, with the guard timer above.

Session Management (SM / PDP)​

Implemented SM behaviour:

  • PDP context activation with APN, QoS and PDN address negotiation.
  • NSAPI multiplexing / secondary PDP contexts: a UE holds multiple concurrent contexts keyed by NSAPI (5-15); an NSAPI-in-use collision is resolved by locally deactivating the colliding context per TS 24.008 §6.1.3.1.4.
  • QoS negotiation from requested and subscribed QoS into the S4 Bearer QoS and the NAS QoS IE.
  • PDP types IPv4, IPv6 and IPv4v6 end-to-end.
  • Network-requested deactivation with retransmission timer T3395.
  • APN selection and subscription enforcement: validate the requested APN against the subscription, resolve wildcard and default APNs, and reject a non-subscribed APN with the correct SM cause.
  • SM STATUS and NSAPI validation on protocol errors, with GTP-C cause mapped to the NAS SM cause.

Iu-PS and RANAP​

The Iu-PS handler owns the SCCP connection-oriented section per UE and bridges NAS both ways over RANAP DirectTransfer.

  • InitialUE / DirectTransfer bridge carrying GMM/SM NAS in each direction.
  • RAB Assignment with parameters derived from the bearer/subscribed QoS, and reaction to the RAB Assignment Response FailedList (mapping the RANAP cause to an SM reject) and TEID-only modifications (relayed to the S-GW).
  • Iu Release after signalling procedures, and on inbound SCCP release for a PS connection, with the guard timer.
  • RANAP RESET from an RNC purging that RNC's stale Iu-PS connections and acknowledging.
  • RANAP Error Indication emitted on a malformed / undecodable RANAP PDU (TS 25.413 §8.27).
  • SRNS relocation signalling (TS 25.413 §8.6-8.9): all six Relocation PDUs, driving intra-SGSN relocation and re-anchoring Direct Tunnel on the target RNC on completion. Inter-SGSN relocation over S3 is tracked as future work (see Limitations).

S4 and GTP-C​

  • Create / Modify / Delete Session toward the S-GW, with RAT type UTRAN and the S4-SGSN F-TEIDs.
  • Direct Tunnel endpoint brokering, and downlink switch-back to the SGSN on PMM-IDLE so the S-GW buffers and triggers paging instead of sending to a released RNC.
  • Peer-initiated Delete / Update Bearer Request from the S-GW/P-GW: acknowledged and relayed to the UE.
  • GTP-C path management: Echo Request/Response and Recovery restart-counter detection to invalidate stale sessions (TS 23.007 §18).
  • DNS S-NAPTR P-GW/S-GW selection per APN when enabled, with static fallback.
  • MT-data paging: an S4 Downlink Data Notification triggers RANAP Paging and is acknowledged (TS 29.274 §7.2.11).

S3 Mobility (to the MME)​

  • Idle-mode context transfer: Context Request / Response / Acknowledge (TS 29.274 §7.3.7).
  • MM Context security mode encoded as EPS (value 4) when carrying a KASME context (TS 29.274 §8.38).
  • Forward Relocation transparent containers (Source-to-Target / Target-to-Source RAN containers) carried end-to-end so the target radio can be set up (TS 29.274 §7.3.1).

Gr MAP (HLR Interface)​

  • UpdateGprsLocation registering the SGSN in the HLR at GPRS Attach (TS 23.060 §6.5.3).
  • Insert Subscriber Data consumed into the subscriber context (allowed APNs, subscribed QoS, APN-AMBR, charging), feeding APN enforcement and QoS negotiation.
  • Cancel Location purging the local MM and PDP contexts and tearing down the S4 session; Purge MS sent when the SGSN drops a subscriber.

The Gr round-trip is gated on gr_source; when unset, attach proceeds without Gr registration so the lab keeps working with an injected quintet.


Charging (PS CDRs)​

The SGSN produces PS-domain call detail records routed to the shared CDR collector (TS 32.251, TS 32.298):

  • S-CDR (SGSNPDPRecord) opened on PDP activation and closed on deactivation.
  • M-CDR (SGSNMMRecord) opened on Attach Complete and closed on Detach, with a change-of-location container on RAU.
  • Change-of-charging-condition containers (QoS / RAT / tariff-time / Direct-Tunnel change) and partial records with an incrementing sequence number.

See CDR documentation for the collector and output format. Volume counting under Direct Tunnel depends on an S4 usage-report feed (see Limitations).


CAMEL GPRS (Online Charging and Control)​

An opt-in gprsSSF drives CAMEL phase-3 GPRS control (TS 23.078, TS 29.078). It is armed only when the subscription carries GPRS-CSI; without it, attach and PDP activation are unchanged.

  • gprsSSF state models for Attach/Detach and PDP Context, with detection-point arming and event reporting.
  • InitialDPGPRS triggered at the Attach and PDP-Context-Establishment detection points.
  • ApplyChargingGPRS / ApplyChargingReportGPRS online-charging loop.
  • Control operations Connect/Continue/Release/Cancel/ActivityTest GPRS, the Tssf timer and default GPRS handling on gsmSCF error or timeout.
  • FurnishChargingInformationGPRS merged into the S-CDR and SendChargingInformationGPRS captured toward the SM layer.

Reference Tables​

Common GMM Reject Causes (TS 24.008 §10.5.5.14)​

CauseNameTypical trigger
2IMSI unknown in HLRSubscriber not provisioned
7GPRS services not allowedSubscription bars packet service
9MS identity cannot be derivedRAU/Service Request P-TMSI not resolvable
11PLMN not allowedRoaming / PLMN restriction
17Network failureNo authentication vectors from the HLR

Common SM (PDP) Reject Causes (TS 24.008 §10.5.6.6)​

CauseNameTypical trigger
26Insufficient resourcesS-GW refused Create Session, or no RAB could be assigned
27Missing or unknown APNRequested APN cannot be resolved
31Activation rejected, unspecifiedRNC RAB setup failed
33Requested service option not subscribedAPN not in the subscription

Metrics​

Metric: omnimsc_sgsn_attach_count Type: Counter Description: GPRS attach outcomes. Labels:

  • result - Attach result (for example accepted, rejected).

Metric: omnimsc_sgsn_pdp_count Type: Counter Description: PDP context activation outcomes. Labels:

  • result - active or rejected.

Example queries:

# Attach acceptance rate
sum(rate(omnimsc_sgsn_attach_count{result="accepted"}[5m]))
/ sum(rate(omnimsc_sgsn_attach_count[5m]))

# PDP rejection rate
sum(rate(omnimsc_sgsn_pdp_count{result="rejected"}[5m]))

Troubleshooting​

Attach rejected with cause 17 (network failure)​

Symptoms: UE cannot attach to the packet domain; GMM Attach Reject cause 17.

Possible causes:

  • No authentication vectors returned from the HLR over Gr.
  • quintet_source unset in a lab with no live Gr.

Resolution:

  1. Confirm the HLR returns vectors for the IMSI (SendAuthenticationInfo).
  2. In a lab, set quintet_source to inject a known UMTS quintet.

PDP activation rejected with cause 26 (insufficient resources)​

Symptoms: Activate PDP Context Reject cause 26.

Possible causes:

  • The S-GW refused Create Session (for example a ULI or non-zero APN-AMBR it rejects).
  • No RAB could be assigned by the RNC.

Resolution:

  1. Check the S-GW accepts the Create Session; set default_apn_ambr to %{ul: 0, dl: 0} for S-GWs that reject a non-zero value.
  2. Review the RAB Assignment Response for a FailedList entry.

PDP activation rejected with cause 33 (service option not subscribed)​

Symptoms: Activate PDP Context Reject cause 33.

Possible causes:

  • The requested APN is not in the subscription or in subscribed_apns.

Resolution:

  1. Add the APN to the HLR subscription (Insert Subscriber Data) or to subscribed_apns.
  2. Set wildcard_apn: true only if any APN should be permitted.

Symptoms: Uplink works but no downlink packets arrive.

Possible causes:

  • Direct Tunnel not completed: the Modify Bearer did not carry the RNC F-TEID.
  • Downlink still anchored on a released RNC after the UE went idle.

Resolution:

  1. Confirm the Modify Bearer after RAB assignment carried the RNC F-TEID.
  2. Confirm the downlink switch-back to the SGSN fired on PMM-IDLE so paging can bring the UE back.

RAU not routed to this SGSN​

Symptoms: A UE's Routing Area Update lands on the wrong node.

Possible causes:

  • The P-TMSI NRI does not match this SGSN's nri_bits / pool allocation.

Resolution:

  1. Align nri_bits with the MSC/SGSN pool configuration.

Limitations​

The following are implemented as seams or partial paths and are documented so operators know what is not yet end-to-end:

  • Volume counting under Direct Tunnel: the SGSN sees no user plane, so S-CDR and CAMEL online-charging volumes require an S4 usage-report feed that is not yet wired. The record and reporting loops are complete; live volume decrement awaits that feed.
  • CAMEL Advice-of-Charge to the MS: SendChargingInformationGPRS is captured toward the SM layer, but AoC delivery to the handset is not yet built.
  • Inter-SGSN Forward Relocation: intra-SGSN SRNS relocation signalling is complete; driving the S3 hop to a peer SGSN (connected-mode PS handover completion) is tracked under the S3 interface epic.