WORKINGCHAPTER 10

Subscriber databases: HLR, HSS, authentication centre and equipment register

Every call, text and session starts with a question to a database that knows who you are and what you may do. Learn which database answers in each generation, and what a virtual operator takes on by running its own

45 MINHOW MOBILE NETWORKS WORKUPDATED 2026-11-13
PREDICT

The subscriber database of a mobile network becomes unreachable for ten minutes. Phones already attached are using data and a call is in progress. What happens to them, and to a phone that is switched on now?

A mobile network knows nothing about you except what is in a database. This chapter follows that database through four generations: what it holds, who asks it, how it hands out the material for authentication, what the equipment register adds, and what changes when an operator runs its own.

What a subscriber database does

Three jobs, in every generation.

  1. Authenticate. It holds each SIM’s secret key K and produces the challenge material the network uses to check the SIM (module 1’s SIM chapter shows the exchange). The part that does this is the authentication centre, AuC.
  2. Authorise. It holds the subscription: the phone number (MSISDN), whether service is allowed, which data networks and speeds, which supplementary services such as call forwarding or barring.
  3. Locate. It remembers which part of the network serves the subscriber now, so a call, a text or a session setup can find them.

The records are specified in 3GPP TS 23.008, “Organization of subscriber data”. The same record serves all three jobs, and the same record serves every generation of the network. Only the way the network asks changes.

Three generations, one question

Generation The database Who asks it Protocol and interface
2G and 3G HLR (home location register) with the AuC The MSC and VLR (D interface), the SGSN (Gr), the gateway MSC (C) and the SMS gateway (C) MAP (Mobile Application Part, 3GPP TS 29.002) over SS7 signalling
4G HSS (home subscriber server), which includes the AuC The MME (S6a); the SGSN (S6d); in IMS, the call session control functions (Cx) Diameter, S6a defined in TS 29.272
5G UDM (unified data management) with the UDR (unified data repository) behind it, and the AUSF (authentication server function) The AMF, the SMF and the AUSF HTTP/2 and JSON on the service-based interfaces: Nudm, Nudr, Nausf
Who asksProtocolAnswering functionThe dataMSC, VLR, SGSN, GMSC2G and 3GMAP over SS7HLR + AuCnot in the labMME4G (scripts/s6a.sh plays it)Diameter S6a, TCP 3868HSS (10.33.0.8)–profile epcAMF, SMF, AUSF5GHTTP/2 via the SCPUDMUDROne recordper IMSI(MongoDB inthe lab)

HLR and AuC, 2G and 3G. The HLR answers the MSC’s and SGSN’s questions over MAP. At registration the VLR asks it for authentication data (the MAP operation SendAuthenticationInfo) and then tells it the phone is now in its area (UpdateLocation); the HLR sends back the subscription (InsertSubscriberData) and tells the previous VLR to forget the phone (CancelLocation). For a call to a phone, the gateway MSC asks the HLR where it is (SendRoutingInfo); the HLR asks the serving VLR for a temporary routing number and returns it. For a text, the SMS gateway asks the same way (SendRoutingInfoForSM). That last exchange is the “where is the phone” step you met in the module 1 chapter on a call, a text and a data session. SS7 is the topic of the signalling chapter.

HSS, 4G. The same functions over Diameter on S6a. The MME sends an Authentication-Information-Request (AIR) at attach and gets a vector back; it then sends an Update-Location-Request (ULR) to say “I serve this subscriber now” and gets the subscription data in the Update-Location-Answer (ULA). The HSS can also reach back: it sends Cancel-Location to the old MME when the phone moves, and Insert-Subscriber-Data to push a changed subscription to the MME serving an attached phone. (The HSS is also the subscriber database for IMS, the voice core, over a Diameter interface called Cx. The lab’s HSS does not do that part.)

UDM, UDR and AUSF, 5G. 5G splits what the HSS did. The UDM is the front end: it answers questions, de-conceals the SUCI (the part of the UDM that does this is called the SIDF) and makes the authentication vectors from K (the ARPF, authentication credential repository and processing function). The UDR is the storage behind it, with its own interface, Nudr, so that other functions such as the policy function can read data without going through the UDM. The AUSF sits between the AMF and the UDM for authentication, and holds the home network’s side of the decision. Because the 5G core is built from functions that call each other over HTTP, “the database” is not one box: it is a chain, which the lab lets you read.

Authentication vectors across the generations

A vector is the bundle the database hands the network for one authentication. You saw 5G-AKA in the SIM chapter. The earlier generations differ in what is in the bundle and who judges the answer.

Generation Bundle Who compares the phone’s answer What the visited network learns
2G (GSM) Triplet: RAND, SRES, Kc The MSC or SGSN The session key Kc. The network is not authenticated to the phone, which is why a fake base station works against 2G.
3G (UMTS AKA) Quintet: RAND, XRES, CK, IK, AUTN The MSC or SGSN The keys CK and IK. The SIM now checks the network through AUTN.
4G (EPS AKA) Vector: RAND, XRES, AUTN, KASME The MME KASME, a key derived from CK, IK and the visited network’s PLMN id, so a vector fetched for one network is useless in another.
5G (5G-AKA) Home-environment vector: RAND, AUTN, XRES*, KAUSF; the AMF receives only RAND, AUTN and HXRES* The AMF makes a first check against HXRES*; the AUSF, in the home network, makes the deciding comparison with XRES* A hash only, and the anchor key KSEAF once the home network has said yes. It never sees XRES* or KAUSF.

Two ideas run through the table. First, the SIM does the same Milenage calculation in 3G, 4G and 5G; what changes is how the output keys are derived and who is trusted with them. Second, each step moved the decision toward the home network, because a visited operator’s equipment is outside the home operator’s control.

The home database also keeps the sequence number (SQN) for each subscriber. It is the counter that makes each challenge fresh, as the SIM chapter explained. Two consequences matter for an operator. A subscriber record is not read-only: every vector the database hands out changes it. And a restore from an old backup puts the counter behind the SIM’s. The SIM then answers a challenge with a synchronisation failure and a re-synchronisation token, the network adopts the SIM’s value, and every phone does this once, all in the first minutes after the restore. In the lab you will watch the counter rise by a fixed step with each vector.

The equipment identity register

Everything so far identifies the subscriber. The EIR (equipment identity register) identifies the handset. The phone’s IMEI, a 15-digit serial number (the numbers chapter in this module covers its structure), is checked against three lists: white (allowed), grey (allowed but tracked) and black (refused, usually reported stolen). A phone on the black list gets no service even with a valid SIM.

Who asks, by generation: in 2G and 3G the MSC or SGSN sends the MAP operation CheckIMEI; in 4G the MME sends a Diameter ME-Identity-Check-Request on the S13 interface (TS 29.272); in 5G the AMF asks a 5G-EIR over a service interface, N5g-eir. The check is optional. A network may run it on every attach or never.

The lab has no EIR. You can still see what an EIR would be given: during registration the AMF tells the UDM the phone’s PEI (permanent equipment identifier), and in the lab’s recording it is imeisv-4370816125816151. (A note on the lab: ran/ue.yaml sets the IMEI, 356938035643803, and the IMEISV, 4370816125816151, as two separate values, and they differ. On a real handset the IMEISV is the IMEI with the software version in place of the check digit, so they agree.) Both are readable by the network and neither is secret. Nothing in the lab acts on it.

One record behind all of them

An operator that upgrades from 3G to 4G to 5G does not keep three subscriber lists in step by hand. Open5GS stores one document per subscriber in MongoDB, and both its 4G HSS and its 5G UDR read that same document. That is why a single subscriber.sh add serves a 4G exchange and a 5G registration alike. The lab shows the mapping.

Field in the record (subscriber.sh show) 4G, in the ULA (Diameter) 5G, in nudm-sdm (JSON)
msisdn: ['2340000000001'] MSISDN: 2340000000001 (on the wire, 320400000000f1, digits swapped in pairs with an f filler) gpsis: ["msisdn-2340000000001"]
ambr: down 100, up 50, unit 2 AMBR: DL 100000000, UL 50000000 (bit/s) subscribedUeAmbr: downlink “100000 Kbps”, uplink “50000 Kbps”
slice[0].session[0].name: 'internet' Service-Selection: internet dnn: "internet"
qos.index: 9, arp.priority_level: 8 QoS-Class-Identifier: 9, Priority-Level: 8 "5qi": 9, "priorityLevel": 8
type: 3 PDN-Type: 2 (IPv4v6) "defaultSessionType": "IPV4V6"
subscribed_rau_tau_timer: 12 Subscribed-Periodic-RAU-TAU-Timer: 720 (seconds; the record holds minutes) none in this exchange
security: k, opc, amf, sqn RAND, XRES, AUTN, KASME, never K rand, autn, xresStar, kausf, never K to the AMF

Unit 2 in the AMBR fields is megabits per second in Open5GS’s schema. The numbers are not shared by accident: the standards ask each interface for the same facts in its own units and names.

There is a second kind of data in the record. After a 4G ULR the HSS writes into it: mme_host: 'mme.atlas.lab', mme_realm, purge_flag: false and a timestamp. That is the location job. The 5G equivalent is the AMF’s registration (PUT .../nudm-uecm/.../registrations/amf-3gpp-access), which the UDM stores through the UDR as context-data/amf-3gpp-access. Where the phone is served is part of the database, and it is why a database that has lost state sends a stored call to nowhere.

A real operator may have separate HLR, HSS and UDM systems from different vendors, kept consistent by provisioning. The standards’ answer to the duplication is the common data layer in the 5G core, the UDR. Whichever way an operator does it, the rule that matters is the one the lab’s single record shows: one source of truth for each subscriber.

What a virtual operator may own

The NCC’s virtual operator framework (section 4.2) lets a Tier 2 Simple Facilities Virtual Operator own and issue its own SIM, own and operate its own intelligent network, and own and operate an equipment identity register, home location register, authentication centre and home subscriber server. A Tier 2 operator has no core switching or interconnect and relies on its host’s number ranges. A Tier 1 operator owns none of theseas of 2026-11. In the cast: Kolanut Mobile in its launch year (Tier 1) uses Lumora Mobile’s HLR, HSS and authentication centre, and Lumora holds every K. At its Tier 2 stage Kolanut Mobile runs its own, for the SIMs it issues itself.

Here is what taking the databases over means in practice. This is engineering, not a rule from the framework, and the Tier 2 course covers it in depth.

  • The keys are the crown jewels. The AuC holds K for every subscriber. The SIM manufacturer delivers them in an encrypted batch file, and the operator loads that file into the AuC or HSS. A leak of the file, or of an unencrypted database copy, exposes every subscriber’s SIM at once. Key custody, backup and access control become Kolanut’s job, and its auditors’ question.
  • Existing subscribers cannot be moved without their keys. K never leaves a SIM. The subscribers of Kolanut’s launch year hold SIMs whose keys Lumora has. To move them into Kolanut’s HSS, either Lumora hands over the key file for those SIMs (a commercial and security decision for both sides), or the customers receive new SIMs, which for a large base is a campaign through market agents. New SIMs, with keys Kolanut holds, can start on Kolanut’s HSS at once.
  • The host’s network must ask the right database. Lumora’s MMEs, AMFs and gateway MSCs ask a database for each subscriber. For Kolanut’s subscribers they must reach Kolanut’s HSS and HLR: Diameter on S6a, MAP for the HLR’s calls and texts, in the 5G core the UDM discovered for the subscriber’s identity range. A secure link between the two operators, routing by IMSI range and joint testing come first. The numbers stay Lumora’s range under the framework, so the numbers chapter’s question of who may allocate what arises here too.
  • The database becomes a service Kolanut must keep up. A failure is the Monday of this chapter’s opening. A Tier 2 operator needs a second site, tested failover, backups it can restore with the sequence number handled, and a monitored alarm on query time, not only on “up”.

The lab

The lab has a 4G HSS, the stand-in MME, the shared record, and recordings of both generations asking the same record. You will fetch a vector, check it by hand, register a subscriber, read the same data in 5G, and break it by removing the subscriber.

LAB Ask the HSS, rebuild a vector, read one record from both generations ~40 MIN
YOU NEEDDocker with Compose v2Python 3.9 or laterpip install cryptography (step 3 only)No SCTP needed: the HSS and the stand-in MME use TCP, and every other step reads files in traces/

Work in labs/telecoms. Nothing here needs the 5G core or the phone, so every step works on any machine with Docker. Steps 5 and 7 read recordings in traces/; steps 1, 2, 4 and the break use the live HSS.

1. Start the HSS and give it the subscriber.

docker compose --profile epc up -d mongo hss
sleep 12
scripts/subscriber.sh add 999700000000001 465B5CE8B199B49FAA5F0A2EE238A6BC E8ED289DEBA952E4283B54E88E6183CA 2340000000001
docker compose --profile epc ps hss

provisioned: 999700000000001 (or already provisioned: 999700000000001 if you did it before, which is fine), then the HSS service Up a few seconds. The HSS reads the same MongoDB document the 5G UDR reads; no second copy is made.

2. Ask for a vector, as a 4G MME.

scripts/s6a.sh air 999700000000001

The script prints each message as a tree. First a Capabilities-Exchange-Request and Answer (the two Diameter peers introduce themselves: Origin-Host: mme.atlas.lab, answered by hss.atlas.lab, Result-Code: 2001 (DIAMETER_SUCCESS)). Then the request:

>>> Authentication-Information-Request (one vector for 999700000000001)
  User-Name: 999700000000001
  Requested-EUTRAN-Authentication-Info
    Number-Of-Requested-Vectors: 1
  Visited-PLMN-Id: 99f907

(the real output also has Session-Id, Auth-Session-State, Origin-Host, Origin-Realm, Destination-Realm and Immediate-Response-Preferred lines; they are trimmed here) and the answer, with a vector (these values are from one recorded run; yours differ, because RAND is random and the sequence number moves on):

<<< Authentication-Information-Answer
  Authentication-Info
    E-UTRAN-Vector
      RAND: 41cc387ff3087cbc8e5d4704f68e4299
      XRES: d6bd7cdfa751b62a
      AUTN: d538a6a181c98000db383d08875ff1c8
      KASME: 76076353cb947828d4316a26429df40c0046b244076c5f4a389741b4488c216c
  Result-Code: 2001  (DIAMETER_SUCCESS)

then a Disconnect-Peer exchange to close. 99f907 is the visited network, 999/70, in TBCD (swapped digits with an f filler). K is not in the answer. Run scripts/subscriber.sh show 999700000000001 | grep sqn before and after a second run: the sqn goes up by 32 with each vector (it was Long('128') and then Long('160') in a recorded run; on a fresh record it starts at 64).

3. Rebuild the vector from K and OPc (needs pip install cryptography).

Create vector.py. It uses the Milenage calculation from the SIM chapter, and then the key derivation that makes KASME (3GPP TS 33.401, annex A.2).

# Rebuild a 4G vector from K and OPc: Milenage (TS 35.206), then KASME (TS 33.401 annex A.2).
import hmac, hashlib, sys
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes

K    = bytes.fromhex("465B5CE8B199B49FAA5F0A2EE238A6BC")
OPC  = bytes.fromhex("E8ED289DEBA952E4283B54E88E6183CA")
PLMN = bytes.fromhex("99f907")          # MCC 999, MNC 70, as the MME sent it

def E(x):
    e = Cipher(algorithms.AES(K), modes.ECB()).encryptor()
    return e.update(x) + e.finalize()
def xor(a, b): return bytes(p ^ q for p, q in zip(a, b))
def rot(x, bits): n = bits // 8; return x[n:] + x[:n]
def c(i): return bytes(15) + bytes([i])
def out(temp, r, i): return xor(E(xor(rot(xor(temp, OPC), r), c(i))), OPC)

rand = bytes.fromhex(sys.argv[1]); autn = bytes.fromhex(sys.argv[2])
temp = E(xor(rand, OPC))
o2, o3, o4 = out(temp, 0, 1), out(temp, 32, 2), out(temp, 64, 4)
res, ak, ck, ik = o2[8:], o2[:6], o3, o4
sqn_ak, amf, mac = autn[:6], autn[6:8], autn[8:]
sqn = xor(sqn_ak, ak)
o1 = xor(E(xor(temp, rot(xor(sqn + amf + sqn + amf, OPC), 64))), OPC)
# KASME = HMAC-SHA-256 keyed with CK || IK over 0x10 || PLMN || 0x0003 || SQN xor AK || 0x0006
s = b"\x10" + PLMN + b"\x00\x03" + sqn_ak + b"\x00\x06"
kasme = hmac.new(ck + ik, s, hashlib.sha256).digest()
print("SQN   ", int.from_bytes(sqn, "big"))
print("MAC   ", "match" if o1[:8] == mac else "MISMATCH")
print("XRES  ", res.hex())
print("KASME ", kasme.hex())

Run it on the vector from step 2 (put your RAND and AUTN on the command line), or on the one recorded in traces/s6a.pcapng, which you can pull out with tshark:

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 tshark -r /t/s6a.pcapng \
  -Y 'diameter.cmd.code==318 && diameter.flags.request==0 && diameter.RAND' \
  -T fields -e diameter.RAND -e diameter.XRES -e diameter.AUTN -e diameter.KASME
python3 vector.py df6715bd93447d3ddfad47f771d1fc9e cdde58638a9f8000dc5488afa6f0ab70

tshark prints one line with RAND df6715bd93447d3ddfad47f771d1fc9e, XRES 6e1397fdb6cda8b0, AUTN cdde58638a9f8000dc5488afa6f0ab70 and KASME f8c0d0f66b21bc0835a3453464433e1f1b91e4b912c32822513fb5f11d119dd3. Your script prints:

SQN    64
MAC    match
XRES   6e1397fdb6cda8b0
KASME  f8c0d0f66b21bc0835a3453464433e1f1b91e4b912c32822513fb5f11d119dd3

SQN 64 is the starting value of a fresh record. XRES and KASME equal what the HSS sent, which shows two things. XRES is the SIM’s RES from the SIM chapter: the 4G and 3G answer is the Milenage output unchanged (5G wraps it into RES*). And KASME is a function of K, OPc, RAND and the visited PLMN: change PLMN to another value and the key changes, which is why a vector fetched for one network is useless in another. The same script on the step 2 sample (41cc387f... and d538a6a1...) gives SQN 64, XRES d6bd7cdfa751b62a and KASME 76076353...216c.

4. Register as the serving MME, then compare the answer with the record.

scripts/s6a.sh ulr 999700000000001 | sed -n '/Update-Location-Answer/,/Disconnect/p'
scripts/subscriber.sh show 999700000000001 | head -22

The Update-Location-Answer’s Subscription-Data, with these values (trimmed):

    MSISDN: 2340000000001
    Access-Restriction-Data: 32
    Subscriber-Status: 0
    Network-Access-Mode: 0
    AMBR
      Max-Requested-Bandwidth-UL: 50000000
      Max-Requested-Bandwidth-DL: 100000000
    Subscribed-Periodic-RAU-TAU-Timer: 720
    APN-Configuration-Profile
      APN-Configuration
        PDN-Type: 2
        Service-Selection: internet
        EPS-Subscribed-QoS-Profile
          QoS-Class-Identifier: 9
          Allocation-Retention-Priority
            Priority-Level: 8

and, below it, Result-Code: 2001 (DIAMETER_SUCCESS). Match each line to the table in “One record behind all of them”: MSISDN to msisdn, the AMBR to ambr (50 and 100 Mbit/s), internet to the session name, QCI 9 to qos.index. In the record, mme_host: 'mme.atlas.lab' and purge_flag: false are now filled in: the HSS has written down who serves this subscriber. (Before your first ULR they are empty lists.)

5. Read the same record from the 5G side (from the recording).

Create sbi.py, which prints the JSON bodies of the HTTP/2 messages tshark lists:

import sys, json
for line in sys.stdin:
    n, src, dst, h = line.rstrip("\n").split("\t")
    print("==", n, src, "->", dst)
    print(json.dumps(json.loads(bytes.fromhex(h)), indent=1))
docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 tshark -r /t/attach-and-browse.pcapng \
  -o nas-5gs.null_decipher:TRUE -d tcp.port==7777,http2 \
  -Y 'frame.number in {161,169,177,188,253,286,304,419}' \
  -T fields -e frame.number -e ip.src -e ip.dst -e http2.data.data 2>/dev/null | python3 sbi.py

Eight JSON bodies, which together are the registration’s conversation with the database. In order:

  • Frame 161, UDR (10.33.0.20) to SCP: the authentication subscription: "authenticationMethod": "5G_AKA", "encPermanentKey": "465b5ce8b199b49faa5f0a2ee238a6bc", "sequenceNumber": {"sqn": "000000000040"} (0x40 is 64), "authenticationManagementField": "8000", "encOpcKey": "e8ed289deba952e4283b54e88e6183ca". The names say “enc”, but in this recording the key travels as readable hex: K crosses a network link between two functions. The lab’s functions talk plain HTTP on one machine; 3GPP TS 33.501 expects a live core to protect these links with TLS.
  • Frame 169, UDM to SCP: the vector the UDM made, "avType": "5G_HE_AKA", with rand bb31141c..., autn f2e50daf..., xresStar 9dad3bb4... and kausf 4297752a....
  • Frame 177, AUSF to SCP: what the AMF is given: rand, autn and hxresStar 1c60d432.... No XRES*, no KAUSF. The AMF can only check the phone’s answer against the hash; the deciding comparison is the AUSF’s.
  • Frame 188, AMF to SCP: the phone’s answer, "resStar": "9dad3bb47a01afbfe0bceea0168eaee7", which equals the xresStar in frame 169, so the AUSF can say yes.
  • Frame 253, UDM to SCP: the registration record, which includes "pei": "imeisv-4370816125816151" and "guami" (AMF identity, 999/70).
  • Frame 286, UDM: "gpsis": ["msisdn-2340000000001"] and "subscribedUeAmbr": {"uplink": "50000 Kbps", "downlink": "100000 Kbps"}.
  • Frame 304: "dnn": "internet" as the default for slice sst 1.
  • Frame 419: the session data: "5qi": 9, "priorityLevel": 8, "sessionAmbr" 50000 and 100000 Kbps, IPV4V6.

Compare with step 4: the facts are the same, the names and units are 5G’s. And compare frame 177 with step 2: the 4G MME was given XRES and decides alone; the 5G AMF is given a hash and can only pre-check; the home network’s AUSF decides.

6. Read the Diameter on the wire.

scripts/ladder.sh traces/s6a.pcapng --filter diameter

Eighteen lines: three exchanges, each a Capabilities-Exchange Request and Answer, one request and answer, and a Disconnect-Peer Request and Answer. In the recording the times are in seconds from the start:

  • 6.675 3GPP-Authentication-Information Request (command 318), answered at 6.835: 0.16 s, the slowest of the three.
  • 12.288 3GPP-Update-Location Request (command 316), answered at 12.323: 0.035 s.
  • 17.100 Authentication-Information Request for an unknown subscriber, answered at 17.112: 0.012 s.

Flags show R (request) on every request and not on any answer; the application exchanges also carry P (proxiable) and the application id 16777251, which is S6a. To see the unknown subscriber’s answer:

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 tshark -r /t/s6a.pcapng \
  -Y 'diameter.cmd.code==318 && diameter.flags.request==0' \
  -T fields -e frame.time_relative -e diameter.Result-Code -e diameter.Experimental-Result-Code

prints two lines: the first has 2001 in the Result-Code field (the vector answer); the second has 5001 in the Experimental-Result-Code field, with no Result-Code at all. The two codes are the signalling chapter’s subject; for now, 5001 means “no such subscriber”.

7. The same missing subscriber in 5G (from the recording).

docker run --rm -v "$PWD/traces:/t:ro" nicolaka/netshoot:v0.13 tshark -r /t/unknown-subscriber.pcapng \
  -o nas-5gs.null_decipher:TRUE -d tcp.port==7777,http2 \
  -Y 'frame.time_relative>8.8 && frame.time_relative<9.1 && (ngap || http2.headers.status==404)' \
  -T fields -e frame.time_relative -e ip.src -e ip.dst -e _ws.col.Info

The Registration request at 8.844 s, then a chain of 404 Not Found answers climbing the core: UDR to SCP at 8.995 s (“Cannot find SUPI Type”, detail imsi-999700000000001), then on to the UDM (9.010 s), the AUSF (9.023 s) and the AMF (9.025 s), then Registration reject at 9.035 s, 0.19 s after the request. In 4G the HSS answered the MME directly with 5001. In 5G the same fact travels through four functions as an HTTP error, and the AMF turns it into a reject. The lab’s quirk: Open5GS chooses cause 11, “PLMN not allowed”, for an unknown subscriber; the README lists it.

8. Break it: remove the subscriber and ask again.

scripts/subscriber.sh remove 999700000000001
scripts/s6a.sh air 999700000000001 | sed -n '/>>> Auth/,/Disconnect/p'
docker compose logs --no-log-prefix hss | tail -3

removed: 1, then an answer with no vector and:

  Experimental-Result
    Vendor-Id: 10415
    Experimental-Result-Code: 5001  (DIAMETER_ERROR_USER_UNKNOWN)

The HSS log ends with a line of this form (colour codes, the time and the IMSI vary): [dbi] INFO: [imsi-999700000000001] Cannot find IMSI in DB. Run scripts/s6a.sh ulr 999700000000001 and you get 5001 again, from the other direction: the HSS cannot give a subscription it does not hold. The transport and the HSS are working; the subscriber is missing. Put them back with the add command from step 1.

Removing and adding a subscriber is not harmless. subscriber.sh add writes a fresh record with the sequence number back at 64. A SIM that had already accepted challenges with a higher number would answer the next one with a synchronisation failure, as in the SIM chapter. Explain why a restore of last week’s subscriber database does this to every phone at once, and what a Tier 2 operator should do about the sequence number when it restores. (If you have the 5G core, also run scripts/subscriber.sh remove with the phone off, switch it on and watch the reject in docker compose logs ue.)
DECIDE

Kolanut Mobile is at its Tier 2 stage. Saheed leads its subscriber platform, and the first batch of Kolanut-keyed SIMs is ready. Kolanut's own HSS has passed bench tests, and Habeeb, a Lumora core engineer, confirms Lumora's MMEs and AMFs can route a range of IMSIs to an outside HSS. The 1.1 million existing subscribers hold SIMs whose keys Lumora holds. How do you bring the new HSS into service?

READING
  1. DOC
    3GPP TS 29.272: MME and SGSN related interfaces based on Diameter (S6a, S6d, S13)

    The definition of every message and AVP in steps 2, 4 and 6, including the commands the HSS sends back (Cancel-Location, Insert-Subscriber-Data) and the S13 EIR check. The version archive lists every release; read the latest. Read: clause 5 (S6a/S6d, the subscriber data transfer) and clause 7 (procedures, messages and AVPs).

  2. DOC
    3GPP TS 23.008: Organization of subscriber data

    Lists what the HLR, the HSS and the VLR each store about a subscriber, which is the table behind the record you read in step 4. Read: the HLR and HSS data clauses.

  3. DOC
    3GPP TS 33.401: 3GPP System Architecture Evolution (SAE); Security architecture

    The 4G authentication and key derivation. Annex A gives the key derivation function that your vector.py used to make KASME. Read: clause 6.1 and annex A.

  4. DOC
    3GPP TS 33.501: Security architecture and procedures for 5G system

    5G-AKA: how XRES*, HXRES* and KAUSF are derived and why the AMF holds only the hash, and the requirement to protect the interfaces between functions. Read: clause 6.1 and annex A.

  5. DOC
    RFC 6733: Diameter Base Protocol

    The base protocol under S6a: the Capabilities-Exchange and Disconnect-Peer messages in your trace, Result-Code and Experimental-Result, flags and AVP encoding. Read: sections 3 (overview), 5.3 (capabilities exchange) and 7 (error handling).

  6. BOOK
    From GSM to LTE-Advanced Pro and 5G Martin Sauter, 2021

    The clearest account of the HLR, the HSS and their message flows, and of what each generation's attach does with them. Read: the HLR sections of the GSM chapter and the HSS sections of the LTE chapter.

  7. DOC
    NCC: License Framework for the Establishment of Mobile Virtual Network Operators in Nigeria

    The source for what Tier 2 may own. Read section 4.2 for the tier definitions and the sections on the host agreement before planning a move of subscribers. Read: section 4.2 (the tiers).

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: Signalling: SS7, Diameter and the 5G service interfaces →