51学通信技术论坛

 找回密码
 立即注册
搜索
查看: 39755|回复: 54

Primary PDP Context激活流程及实例     [复制链接]

Rank: 9Rank: 9

懒

发表于 2011-5-1 10:54:43 |显示全部楼层
一键分享 一键分享

   本贴中,我们通过一个实例来了解一下GPRS网络中一个Primary PDP Context(即MS激活的第一个PDP上下文)的信令流程。通过激活PDP上下文可以建立到GPRS网络的会话连接即常说的通过GPRS网络上网。这里仅根据抓包文件进行讲解。详细的流程请参考规范TS23.060的9.2.2.1章节。同时,本论坛也会在TS23.060规范版块进行相应的翻译。

   

   #1 MS发送Activate PDP Context Request消息给SGSN,附带的信息主要有:NSAPI=5代表是第一个PDP上下文,请求的QOS profile代表MS侧认为要访问某个应用所需要的QOS(这是由终端厂家预置的),请求的PDP地址代表请求外部PDN网络为MS分配PDP地址(如果PDP网络为IP网络,则请求的PDP地址即为IP地址,这在里面的PDP Type number=33可以看出请求的是一个IPV4地址),请求的APN代表MS想要访问的外部网络。最后是PCO字段,这是个可选字段,如果分配IP地址的方式不是由GGSN来分配,那这个PCO字段还可以携带用于分配用户地址做鉴权的用户名和口令。   

#2 SGSN收到MS发过来的请求后,首先要做一个核对。因为在附着过程中,SGSN已经从HLR拿到了关于这个MS的签约数据,这个签约数据里面就有用户允许访问的APN等信息,如果SGSN发现MS请求的APN不在签约数据中,将直接拒绝这个PDP上下文的激活。流程到此就终结了。如果SGSN核对用户权限没有问题,就给GGSN发送Create PDP Context Request消息,消息中的很多IE是直接从#1中MS的激活请求消息中复制过来,并且根据规范,在Create PDP Context Request消息中,只有Tunnel Endpoint Identifier Data I、NSAPI、SGSN Address for signalling、SGSN Address for user traffic、Quality of Service Profile这4个IE为必选IE。分别为用户面TEID、NSAPI、控制面SGSN地址、用户面SGSN地址和QOS Profile。这里的TEID和SGSN地址信息均为SGSN分配,关于TEID的实例,可以参考另一篇实例帖子“GTP协议循序渐进(三)----通过实例了解TEID http://www.gprshome.com/forum.php?mod=viewthread&tid=61&extra=page%3D1 ”在包中你可以看到,有两个地址都是192.169.100.1,其实一个是用户面、一个是控制面。NSAPI=5是从MS侧复制过来的,QOS Profile并不是从MS侧的激活请求中复制过来,而是在MS请求的、HLR签约的、SGSN所能提供的三者QOS Profile中取最小值发给GGSN。其他很多IE都是有条件的或是可选的。但比较重要的还有APN、请求的用户地址等信息。另外,有些IE可发送给GGSN用于计费目的。例如RAT Type(3G用户资费高些)、IMSI、MSISDN等。   

#3 GGSN在收到SGSN的激活请求后,也要做一个检查核对。包括选择模式(Selection Mode)的检查(请参考另一篇帖子Selection Mode的用途及在PDP上下文激活中的影响 http://www.gprshome.com/forum.php?mod=viewthread&tid=189&highlight=selec)、APN的检查、PDP地址类型检查等等,如果这些信息不匹配的话,GGSN将直接拒绝激活。如果检查都通过,则GGSN回送Create PDP Context Response消息给SGSN。这里最重要的就是给MS分配IP地址。携带在End User Address IE中。此例为192.168.252.130。除此以外,GGSN还会将自己所能支持的QOS Profile发给SGSN,同SGSN进行协商。Cause IE为128,代表请求接受。另外,还有一些其他的可选和有条件产生的IE,比较重要的包括NSAPI=5、用户面和控制面地址和TEID、Charging ID等。   

#4 SGSN收到GGSN的激活响应后,如果是3G的话,会请求RNC建立一个用户的RAB(Radio Access Bearer)用于后续用户payload的传递,但没有抓到包省略了。在RAB建立后,SGSN给MS发送Activate PDP Context Accept消息,将分配给用户的IP地址告知MS,并且下发一个QOS Profile,这个Profile叫做协商的QOS Profile,就是MS和网络侧各节点协商的一个结果(最小值)。MS收到后将IP 地址等信息存入手机中。接下来MS就可以发起对外部PDN网络的访问了。所能享用的QOS则由得到的这个协商的QOS Profile里的参数来指定。

And here are the English version:

#1 MS send the Activate PDP context
Request message to the SGSN, with the information: NSAPI=5 on behalf of the first PDP context, the requested QOS profile on behalf of a certain QOS required by an application (preset by the terminal factory), with the MS side believing that QOS should be accessed. The requested PDP address representative shall require the external PDN network to allocate  the PDP address for the MS (if the PDP is an IP network, the requested PDP address is the IP address, with the requested IPV4 address can be known as the PDP Type number = 33), requested APN represent the external network that the MS wants to access. Finally, the PCO field is an optional field, if IP adress is not assigned by the GGSN, then the PCO field can also bring the user name and password whick can be used to assign user address authentication.

# 2 SGSN on the receiving of the request sent by MS, will do a check first. Since during the attachment process, the SGSN has already got the subscription data of the MS from the HLR, with the subscription data containing the APN allowed to access by the users and other information, if the SGSN found that the MS requested APN is not in the data, PDP context
activation will be rejected. This is the end of the process. If the SGSN has checked user permissions and finds no problem, will send GGSN the Create PDP Context Request message, many IEs are directly copied from the activation of the MS # 1 request message, and according to the specifications, in the Create PDP Context Request message, only the Tunnel Endpoint Identifier Data I, NSAPI, the SGSN Address for signaling, the SGSN Address for user traffic and Quality of the
Service the Profile are Required IE.  Respectively are the user plane TEID,NSAPI, control plane SGSN adress and QOS profile. Here the TEID and SGSN address infromation are allocated by SGSN, you can refer to a separate instance for the
TEID <GTP Protocol step by step (III) – instance to learn the TEID
http://www.gprshome.com/forum.php?mod=viewthread&tid=61&extra=page%3D1".
In the package, you can see that there are two addresses of 192.169.100.1, in fact one is a user plane, and another the control plane. The NSAPI = 5 is copied from the MS side, while the QOS the Profile is not copied from the MS side of the activation request, but the minimum value of the QOS profile among the MS requested, the HLR signed and the SGSN provided to send to GGSN. Many other IEs are conditional or optional. But the APN, user requested address and other information are important as well. In addition, some IEs can be sent to the GGSN for billing purposes. For example, the RATs Type (3G user charges higher), IMSI, MSISDN, etc..

# 3 GGSN upon receiving the activation request of SGSN will also do a check, including the selection mode check (please refer to the <Use of Selection Mode and influence in the PDP context activation>,
http://www.gprshome.com/forum.php?mod=viewthread&tid=189&highlight=selec", APN check , and the PDP address type check, etc., if this information does not match, GGSN will directly refuse to activate. If the checks are passed, then the GGSN echo the Create the PDP Context Response message to the SGSN,. The most important thing is to assign IP addresses to MS, attached in the End User Address IE. In this case is the 192.168.252.130. Besides, the GGSNs
also will send the QOS Profile supported to SGSN, in consultation with the SGSN.Cause IE of128, on behalf of the request to accept. In addition, there are some other optional and conditional IE, including the NSAPI = 5, the user plane and control plane address and The Tunnel Endpoint Identifier, Charging ID, etc..

# 4 SGSN on receiving in activation response sent by GGSN, if it is 3G, then will ask the RNC to establish a user RAB (Radio Access Bearer) for the transfer of the follow-up user payload, but if no package caught, then omitted. After the RAB is established, the SGSN sends to the MS the Activate PDP Context Accept message, tell the MS the IP address assigned to the user, and issue the QOS Profile, which is called consultation QOS profile, that is the minimum result of consultation of each node of the MS and network side. MS on receiving the IP Address and other information will store it in the phone.
Next, the MS can initiate access to the external PDN network. The QOS that can
be used will be specified by the QOS Profile parameters consulted.
附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

Rank: 2Rank: 2

发表于 2011-6-7 22:04:38 |显示全部楼层
回复 爱卫生 的帖子

原文中
"在Create PDP Context Request消息中,只有Tunnel Endpoint Identifier Data I、NSAPI、SGSN Address for signalling、SGSN Address for user traffic、Quality of Service Profile这4个IE为必选项"

但是看23.060 6b0文中9.2.2.1 的步骤4)中是
"The SGSN sends a Create PDP Context Request (PDP Type, PDP Address, Access Point Name, QoS Negotiated, TEID, NSAPI, MSISDN, Selection Mode, Charging Characteristics, Trace Reference, Trace Type, Trigger Id, OMC Identity, Protocol Configuration Options, serving network identity, Maximum APN Restriction IMEISV, CGI/SAI, RAT type, S-CDR CAMEL information)"


并没有Tunnel Endpoint Identifier Data I、SGSN Address for signalling、SGSN Address for user traffic、Quality of Service Profile。是不是文中别的地方有详细的说明,另外如何知道哪些选项是必选项?谢谢楼主





使用道具 举报

Rank: 9Rank: 9

懒

发表于 2011-6-7 22:29:51 |显示全部楼层
回复 王二麻子 的帖子

参考的是TS29.060 关于GTP协议的规范。这里给出V10.1.0的7.3.1章节关于Create PDP Context Request消息的描述,摘录如下:

Table 5: Information Elements in a Create PDP Context Request

Information element

Presence requirement

Reference

IMSI

Conditional

7.7.2

Routeing Area Identity (RAI)

Optional

7.7.3

Recovery

Optional

7.7.11

Selection mode

Conditional

7.7.12

Tunnel Endpoint Identifier Data I

Mandatory

7.7.13

Tunnel Endpoint Identifier Control Plane

Conditional

7.7.14

NSAPI

Mandatory

7.7.17

Linked NSAPI

Conditional

7.7.17

Charging Characteristics

Conditional

7.7.23

Trace Reference

Optional

7.7.24

Trace Type

Optional

7.7.25

End User Address

Conditional

7.7.27

Access Point Name

Conditional

7.7.30

Protocol Configuration Options

Optional

7.7.31

SGSN Address for signalling

Mandatory

GSN Address 7.7.32

SGSN Address for user traffic

Mandatory

GSN Address 7.7.32

MSISDN

Conditional

7.7.33

Quality of Service Profile

Mandatory

7.7.34

TFT

Conditional

7.7.36

Trigger Id

Optional

7.7.41

OMC Identity

Optional

7.7.42

Common Flags

Optional

7.7.48

APN Restriction

Optional

7.7.49

RAT Type

Optional

7.7.50

User Location Information

Optional

7.7.51

MS Time Zone

Optional

7.7.52

IMEI(SV)

Conditional

7.7.53

CAMEL Charging Information Container

Optional

7.7.54

Additional Trace Info

Optional

7.7.62

Correlation-ID

Optional

7.7.82

Evolved Allocation/Retention Priority I

Optional

7.7.91

Extended Common Flags

Optional

7.7.93

User CSG Information

Optional

7.7.94

APN-AMBR

Optional

7.7.98

Signalling Priority Indication

Optional

7.7.103

Private Extension

Optional

7.7.46

www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 2Rank: 2

发表于 2011-6-7 22:33:34 |显示全部楼层
回复 爱卫生 的帖子

哦,谢谢楼主,看来得两个规范一起看!

使用道具 举报

Rank: 2Rank: 2

发表于 2011-6-22 23:14:22 |显示全部楼层
看到必选项有
“SGSN Address for signalling、SGSN Address for user traffic”
规范里还特别强调这两个地址不一定与IP地址相同,问题就是:SGSN的IP地址是用于GGSN找到本节点(也就是SGSN的),上面的两个地址也是标识同一个物体——sgsn,既然能用IP地址,为何还要额外分配信令地址(SGSN Address for signalling)和用户流地址SGSN Address for user traffic?

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2011-6-22 23:25:45 |显示全部楼层
回复 王二麻子 的帖子

  使用不同的IP地址,实际上为了控制和用户面的分离。因为这两个IP地址对应的是两个GTP隧道。一个是GTP-C,一个是GTP-U。这两个GTP隧道可以根据运营商的IP承载网的拓扑结构,选择不同的路径来路由数据。其中GTP-C属于控制平面,路由也可能是需要经过核心网络。而GTP-U是用户平面,那可能在设计时经过IP网络的分布层就可以了。所以在设计规范的时候,至少你要允许这两个隧道使用两个不同的IP地址。
  另外,也为了方便厂家更好的做产品设计。因为GTP-C的IP可能对应的是控制面的硬件板卡,GTP-U的IP可能对应的是用户面的硬件板卡,两者的工艺、成本、芯片都不一样。这样厂家在做实现的时候有更多选择。
  以上是我的个人理解,仅供参考。
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 2Rank: 2

发表于 2011-6-24 22:59:02 |显示全部楼层
回复 爱卫生 的帖子

”他们可能对应不同的板卡,走不同的路由“,似乎明白了,恩,3Q

使用道具 举报

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

特殊贡献奖

发表于 2011-6-30 15:50:00 |显示全部楼层
楼主,问个和PDP上下文激活无关的问题哦,和上面抓的包“一个完整的激活流程”有关。

在上面,我们看到在Activate PDP Context Accept消息里,包含了参数PCO选项,里面放的PPP-IPCP协议内容,包含了GGSN给MS分配的IP地址。

我想问的是IPCP NAK和IPCP ACK有什么区别?在有些地方看到,NAK表示协商的内容没有完全通过,在这之后会不会还有后续的协商消息,直到回复IPCP ACK为止。

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2011-6-30 23:57:22 |显示全部楼层
回复 bestflora 的帖子

  恩。这个问题实际上是IPCP的协商过程。属于PPP协议的一部分。PCO中的IP-Address 用来协商本地使用的IP 地址。该选项允许请求发送者提供自己的IP 地址或请求对方给自己分配IP 地址,在后一种情况下,请求者发送一个全为0 的IP 地址,对方在一个NAK 数据帧中给出请求者的IP 地址。这个NAK代表接收方不认可请求者发送的全0的这个地址,而将自己认为正确的即分配给手机的IP地址放在NAK中告诉用户。
  IPCP ACK是对NAK的一个确认。
  整个协商过程是:
  客户端首先发送IP 地址和DNS 地址都为零的请求数据帧,服务器接收到后用NAK 数据帧回复动态IP 地址和DNS 地址,然后客户端再次用接收到地址发送请求,接收到ACK数据帧即完成了IPCP 配置。服务器直接将自己的IP 地址发送给客户端,接收到ACK 数据帧后IPCP 配置成功。
  可以参考百度文库:http://wenku.baidu.com/view/b31c5e1eb7360b4c2e3f64ee.html 和这个附件。
附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

特殊贡献奖

发表于 2011-7-1 09:43:59 |显示全部楼层
懂了,谢谢!
我当时就想着我给你发request,你直接用ACK消息回复我请求的内容就好了。
被旧有的一些协议规范给捆绑住了,所以还是不能经验主义啊。

使用道具 举报

Rank: 3Rank: 3Rank: 3

发表于 2011-7-25 21:51:54 |显示全部楼层
请问SGSN的发给GGSN的用户面ip地址和控制面ip地址都是192.169.100.1,那GGSN如何区分SGSN的用户面和控制面啊?

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2011-7-26 13:53:34 |显示全部楼层
本帖最后由 爱卫生 于 2012-3-19 21:14 编辑
linyuxuan 发表于 2011-7-25 21:51
请问SGSN的发给GGSN的用户面ip地址和控制面ip地址都是192.169.100.1,那GGSN如何区分SGSN的用户面和控制面啊 ...
   SGSN发给GGSN的用户面和控制面IP可以是相同的,也可以不相同的。这是两个GTP协议的IE(信息元素)。一个GTP-C,一个GTP-U。要区分的话,不是通过IP地址来区分,而是通过TEID。控制面和用户面的TEID通常是不一样的。即使一样,也能够区分。在解封装的时候,GGSN是先解IP头部,然后解UDP,看到不同的端口号,就送给不同的进程(GTP-C和GTP-U)来处理。不同的进程再根据TEID来区分用户。
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 3Rank: 3Rank: 3

发表于 2011-7-27 00:43:48 |显示全部楼层
回复 爱卫生 的帖子

楼主,谢谢。。

使用道具 举报

Rank: 2Rank: 2

发表于 2011-7-27 11:01:22 |显示全部楼层
版主,有个问题想问一下,GB口协议栈为GSM>LLC>BSSGP>NS>UDP>IP 为什么UDP,IP会在底层呢?

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2011-7-27 12:15:11 |显示全部楼层
wangchenfool 发表于 2011-7-27 11:01
版主,有个问题想问一下,GB口协议栈为GSM>LLC>BSSGP>NS>UDP>IP 为什么UDP,IP会在底层呢?

  因为这里提到的IP是指的底层的承载。承载是用来传递上层的应用消息的,因为这个上层应用消息不能只在天上飞,而是要落地发出去的。在通信网络中就是要通过一个具体的端口发出去。
  所以,按照协议栈流程,上层消息封装好后,将将给IP层,查找目的IP,再和数据链路层和物理层的端口以及VLAN映射,最后将这个包从节点发出去。所以IP是在底层,但实际上IP下面还有数据链路层和物理层(通常Gb Over IP都是用的以太网来做物理端口承载)。所以这里的IP是代表的IP的承载。
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 2Rank: 2

发表于 2011-10-31 22:02:41 |显示全部楼层
受益匪浅,非常 感谢。

使用道具 举报

Rank: 2Rank: 2

发表于 2011-12-16 00:59:53 |显示全部楼层
结合实际场景咨询一下,一个手机用户打开UC浏览器:
1、先后观看了同一个视频网站的两个不同的视频,此时会创建几个PDP上下文,相互间有什么联系?
2、先后观看了不同视频网站的不同的两个视频,此时又创建了几个PDP上下文,相互间有什么联系?

使用道具 举报

Rank: 2Rank: 2

发表于 2012-1-20 21:26:28 |显示全部楼层
请求的PDP地址代表请求外部PDN网络为MS分配PDP地址(如果PDP网络为IP网络,则请求的PDP地址即为IP地址,这在里面的PDP Type number=33可以看出请求的是一个IPV4地址)
请问版主,这句话中的“请求的PDP地址代表请求外部PDN网络为MS分配PDP地址”是什么意思,外部PDN 网络为MS 分配的PDP地址是什么,和GGSN 给MS 分配的地址有什么区别

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

站长邮箱|Archiver|51学通信 ( 粤ICP备11025688 )

GMT+8, 2024-3-28 17:11 , Processed in 0.039192 second(s), 14 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部