《5GC原理与实践》实践篇是按网元来规划的。包括AMF篇、SMF篇、PCF篇等。
本文是AMF篇的第13篇。
本期目录:
1.1.8 跨AMF的移动性注册更新流程关键步骤分析 50
1.1.8.1 UE发给AMF的注册请求(UE-ID为5G-GUTI) 51
1.1.8.2 New AMF找Old AMF要UE上下文 54
1.1.8.3 Old AMF给New AMF返回UE的上下文 55
1.1.8.4 UDM给Old AMF发去注册通知 57
1.1.8 跨AMF的移动性注册更新流程关键步骤分析
5G初始注册流程的原理部分请参考《5G核心网原理与实践:原理篇》的3.1.2节:移动性注册更新流程。这里不再赘述。
本节主要分析该流程中的一些重要消息。
【很多消息与初始注册流程消息类似或相同。因此,本节重点呈现差异化的部分。】
1.1.8.1 UE发给AMF的注册请求(UE-ID为5G-GUTI)
可以看到,Wireshark在报文中添加了一行说明:Security protected NAS 5GS message。这个表示本消息是受到安全保护的,隐含的意思就是说UE已经建立了5G的安全上下文。
并且提供了UE计算出来的用于完整性保护的MAC值。
【本消息只做了完整性保护,没有做NAS加密。因此,后续看到的NAS消息是明文的(Plain NAS 5Gs Message)】
注册请求中的主要参数有:
-Security header type取值为1,表示本消息已启用完整性保护。
- Message type: Registration request。这个是5G NAS消息类型。这里是注册请求。
- 5GS registration type: mobility registration updating。表示因为UE发生了跨注册区的位置移动引发的注册。该参数可用于区分初始注册、周期性注册、移动性注册更新、紧急注册这几种场景。
- NAS key set identifier:用于安全上下文的标识。本例取值为0。另外子参数TSC表示NAS安全上下文的类型。Native表示是5G AMF原生的安全上下文(不是4-->5映射过来的。)
- 5GS mobile identity:5G用户标识。可以是5G-GUTI或者SUCI。这里是5G-GUTI。规范要求如果UE同时存在5G-GUTI和SUCI,那么要使用5G-GUTI。
- UE security capability:UE所支持的加密和完整性保护算法。用于和AMF的算法协商,取交集。
- NAS message container:NAS消息容器,封装了另一个NAS消息,其实还是注册请求消息。那为什么要单独封装起来呢?比较疑惑。查了下规范,该参数应在以下场景中包含:
- The NAS message container shall be included if the UE is sending a Registration Request message as an Initial
NAS message and the UE has a valid 5G NAS security context and the UE needs to send non-cleartext IEs. If the UE does not need to send non-cleartext IEs, the UE shall send a Registration Request message without including the NAS message container.
说白了就是,NAS message container是用来传送一些不能明文发送的参数(non-cleartext UE)的。在本例中,可以看到。该参数包括了两个子参数:Request-NSSAI(UE请求的切片信息)和PDU Session Status(用来和网络侧同步PDU会话状态。)
消息举例如下:
Non-Access-Stratum 5GS (NAS)PDU
Security protected NAS 5GS message
Extended protocol discriminator: 5G mobility management messages (126)
0000 .... = Spare Half Octet: 0
.... 0001 = Security header type: Integrity protected (1)
Message authentication code: 0x1234abcd
Sequence number: 3
Plain NAS 5GS Message
Extended protocol discriminator: 5G mobility management messages (126)
0000 .... = Spare Half Octet: 0
.... 0000 = Security header type: Plain NAS message, not security protected (0)
Message type: Registration request (0x41)
5GS registration type
.... 1... = Follow-On Request bit (FOR): Follow-on request pending
.... .010 = 5GS registration type: mobility registration updating (2)
NAS key set identifier
5GS mobile identity
Length: 11
.... 0... = Odd/even indication: Even number of identity digits
.... .010 = Type of identity: 5G-GUTI (2)
Mobile Country Code (MCC): China (460)
Mobile Network Code (MNC): Unknown (99)
AMF Region ID: 200
0000 0000 01.. .... = AMF Set ID: 1
..00 0001 = AMF Pointer: 1
5G-TMSI: 0xf0006666
UE security capability
Element ID: 0x2e
Length: 2
1... .... = 5G-EA0: Supported
.0.. .... = 128-5G-EA1: Not supported
..0. .... = 128-5G-EA2: Not supported
...0 .... = 128-5G-EA3: Not supported
.... 0... = 5G-EA4: Not supported
.... .0.. = 5G-EA5: Not supported
.... ..0. = 5G-EA6: Not supported
.... ...0 = 5G-EA7: Not supported
0... .... = 5G-IA0: Not supported
.1.. .... = 128-5G-IA1: Supported
..0. .... = 128-5G-IA2: Not supported
...0 .... = 128-5G-IA3: Not supported
.... 0... = 5G-IA4: Not supported
.... .0.. = 5G-IA5: Not supported
.... ..0. = 5G-IA6: Not supported
.... ...0 = 5G-IA7: Not supported
NAS message container
Element ID: 0x71
Length: 35
Non-Access-Stratum 5GS (NAS)PDU
Plain NAS 5GS Message
Extended protocol discriminator: 5G mobility management messages (126)
0000 .... = Spare Half Octet: 0
.... 0000 = Security header type: Plain NAS message, not security protected (0)
Message type: Registration request (0x41)
5GS registration type
.... 1... = Follow-On Request bit (FOR): Follow-on request pending
.... .010 = 5GS registration type: mobility registration updating (2)
NAS key set identifier
0... .... = Type of security context flag (TSC): Native security context (for KSIAMF)
.000 .... = NAS key set identifier: 0
5GS mobile identity
Length: 11
.... 0... = Odd/even indication: Even number of identity digits
.... .010 = Type of identity: 5G-GUTI (2)
Mobile Country Code (MCC): China (460)
Mobile Network Code (MNC): Unknown (99)
AMF Region ID: 200
0000 0000 01.. .... = AMF Set ID: 1
..00 0001 = AMF Pointer: 1
5G-TMSI: 0xf0006666
5GMM capability
Element ID: 0x10
Length: 1
0... .... = Spare: 0
.0.. .... = Spare: 0
..0. .... = Spare: 0
...0 .... = Spare: 0
.... 0... = Spare: 0
.... .0.. = LTE Positioning Protocol (LPP) capability: Not Requested
.... ..0. = HO attach: Not supported
.... ...0 = S1 mode: Not Requested
UE security capability
NSSAI - Requested NSSAI
Element ID: 0x2f
Length: 5
S-NSSAI 1
Length: 4
Slice/service type (SST): 1
Slice differentiator (SD): 1
PDU session status
Element ID: 0x50
Length: 2
0... .... = PSI(7): PDU SESSION INACTIVE
.0.. .... = PSI(6): PDU SESSION INACTIVE
..0. .... = PSI(5): PDU SESSION INACTIVE
...0 .... = PSI(4): PDU SESSION INACTIVE
.... 0... = PSI(3): PDU SESSION INACTIVE
.... .0.. = PSI(2): PDU SESSION INACTIVE
.... ..0. = PSI(1): PDU SESSION INACTIVE
.... ...0 = Spare: False
0... .... = PSI(15): PDU SESSION INACTIVE
.0.. .... = PSI(14): PDU SESSION INACTIVE
..0. .... = PSI(13): PDU SESSION INACTIVE
...0 .... = PSI(12): PDU SESSION INACTIVE
.... 0... = PSI(11): PDU SESSION INACTIVE
.... .0.. = PSI(10): PDU SESSION INACTIVE
.... ..0. = PSI(9): PDU SESSION INACTIVE
.... ...0 = PSI(8): PDU SESSION INACTIVE
1.1.8.2 New AMF找Old AMF要UE上下文
New AMF接下来要去Old AMF要UE的上下文。调用Old AMF的namf-comm服务,服务操作是transfer。其中消息的Request-URI是:
Request-URI:/namf-comm/v1/ue-contexts/5g-guti-46099FE0066F0006666/transfer
【request-uri包含了UE的5G-GUTI】
Body则包含了New AMF发给Old AMF的相关参数,如下图举例:
- Reason:MOBI_REG。表示是因为发生了移动性注册,才找你要UE杀你安稳。
- accesstype:表示是3GPP接入。
- regRequest:结合底部的3gpp.5gnas。把完整的注册请求消息发给了Old AMF。但协议约定,这一部分是采用二进制编码。因此,Wireshark不一定能还原成明文。
1.1.8.3 Old AMF给New AMF返回UE的上下文
Old AMF结合收到的注册请求和UE的5G-GUTI,查询到对应的UE上下文。通过200 OK返回给New AMF。
UE上下文中的主要参数有:UE的SUPI、supiUnauthind(SUPI是否已鉴权指示)、pei、subrfsp(签约的rfsp index)、usedrfsp(UE使用的rfsp index)、subueambr(签约的UE-AMBR)、smssupport(是否支持SMS over NAS)、5gmmcapability(5G移动性管理能力)、pcfId(选择的PCF的ID)、PCFampolicyuri(PCF侧的SBI)、ampolicyreqtriggerlist(向PCF请求更新am-policy的触发条件,如Location_Change)、mmcontextlist(移动性管理上下文参数合集)、sessionContextList(会话管理上下文参数合集。包括pdusessionid、s-nssai、dnn、accesstype、smfid等)
接下来的步骤是:
1)New AMF选择AUSF、UDM,对UE发起鉴权。
2)鉴权完成之后,是New AMF到UDM中做注册登记、获取并订阅UE的签约数据。
3)New AMF找PCF(Old AMF提供了PCF-ID)要am-policy。
这部分与1.1.1初始注册流程基本相同。不再赘述。
1.1.8.4 UDM给Old AMF发去注册通知
由于AMF发生了变化,当New AMF在UDM中注册登记完成后,UDM应给之前登记的Old AMF发去注册通知(Nudm_UECM_DeregistrationNotification),Old AMF收到后,可以删除UE的上下文并释放资源。
UDM给Old AMF发的去注册通知用Post方法,Request-URI是:
Request-URI:/namf-callback/v1/imsi-460990000011111/deregistration-notification
【URI部分实际上是Old AMF在UDM注册时提供的回调地址,用于接收通知。】
Body则包含了UDM发给Old AMF的相关参数,如下图举例:
该消息中的主要参数是deregReason,即UDM要告诉Old AMF去注册的原因,本例取值为UE_REGISTRATION_AREA_CHANGE,即UE的注册区域发生了变更所触发的去注册。
接下来是New AMF给UE回注册接受消息,并重新分配5G-GUTI,T3512等参数。流程结束。
这部分与初始注册流程消息类似,不再赘述。
更多精彩内容,请阅知识星球800+篇精华合集帖。
该链接收录了知识星球800+篇的精华内容,
含视频、图文专栏、精华帖、问答等等精华内容。
无论是想学习课程、看视频、看案例、看log、看实战,统统都有。
各位星友必看!!!
精华合集(链接永久不变,内容自动更新):
https://drpn55b08y.feishu.cn/docx/Y8MqdnyKooY8yKxfBdoc3EvZnof
飞书域名太长,还创建了一个短链接: