51学通信技术论坛

 找回密码
 立即注册
搜索
查看: 40865|回复: 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

55#
发表于 2016-12-23 21:13:50 |只看该作者
谢谢楼主无私分享!!!

使用道具 举报

Rank: 2Rank: 2

54#
发表于 2016-10-10 15:59:42 |只看该作者
为啥TEID-D是必选,TEID-Ctrl不是必选呢?

使用道具 举报

Rank: 2Rank: 2

53#
发表于 2015-4-3 08:50:39 |只看该作者
很不错的流程!

使用道具 举报

Rank: 2Rank: 2

52#
发表于 2014-8-3 22:44:16 |只看该作者
我已深深爱上这个地方了,在成为专家之前坚决不撤退!

使用道具 举报

Rank: 2Rank: 2

51#
发表于 2014-8-3 22:42:48 |只看该作者
谁知盘中餐,发帖真辛苦!

使用道具 举报

Rank: 3Rank: 3Rank: 3

50#
发表于 2014-6-22 13:55:36 |只看该作者
多谢爱总制作和分享

使用道具 举报

Rank: 2Rank: 2

49#
发表于 2014-5-20 12:28:07 |只看该作者
继续学习

使用道具 举报

Rank: 2Rank: 2

48#
发表于 2014-3-3 12:08:49 |只看该作者
有了很好的收获,感谢!

使用道具 举报

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

47#
发表于 2014-2-9 16:58:08 |只看该作者
学习了。。。。

使用道具 举报

Rank: 1

46#
发表于 2013-12-29 17:26:07 |只看该作者
爱卫生 发表于 2013-12-22 19:11
是厂家的实现。最初的create pdp context
request消息是发向DNS解析出来的硬件板卡A的地址,后续的GTP- ...

谢谢楼主,学习了~,能作如下理解么:一个SGSN配有多个板卡,板卡A对应gb接口的通信,板卡B对应gn接口的通信,每个板卡都有不同的ip地址。

点评

爱卫生  可以这么理解。  发表于 2013-12-29 18:54:31

使用道具 举报

Rank: 9Rank: 9

懒

45#
发表于 2013-12-22 19:11:24 |只看该作者
thankgodness 发表于 2013-12-22 14:20
楼主,我想问个问题,为什么SGSN在#2和#3两包数据里面的IP地址会不一样,一次作为目的端,一次作为发送端。 ...

是厂家的实现。最初的create pdp context
request消息是发向DNS解析出来的硬件板卡A的地址,后续的GTP-C消息被负荷分担到IP地址不一样的其他GTP-C板卡上了。

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

使用道具 举报

Rank: 1

44#
发表于 2013-12-22 14:20:58 |只看该作者
楼主,我想问个问题,为什么SGSN在#2和#3两包数据里面的IP地址会不一样,一次作为目的端,一次作为发送端。

使用道具 举报

Rank: 2Rank: 2

43#
发表于 2013-9-12 15:33:51 |只看该作者
受教了,感谢爱总.

使用道具 举报

Rank: 1

42#
发表于 2013-7-15 19:31:32 |只看该作者
欸  小白开始学习

使用道具 举报

Rank: 1

41#
发表于 2013-7-11 16:57:57 |只看该作者
爱卫生 发表于 2011-6-22 23:25
回复 王二麻子 的帖子

  使用不同的IP地址,实际上为了控制和用户面的分离。因为这两个IP地址对应的是两个 ...

没错,如果你了解cs域核心网就更一目了然.现在的cs核心网把控制和用户(或应用)生生分成2个节点,理解这个概念非常直观.

使用道具 举报

Rank: 9Rank: 9

40#
发表于 2013-4-17 21:00:21 |只看该作者
worldwind 发表于 2011-12-16 00:59
结合实际场景咨询一下,一个手机用户打开UC浏览器:
1、先后观看了同一个视频网站的两个不同的视频,此时会 ...

1、先后观看了同一个视频网站的两个不同的视频,此时会创建几个PDP上下文,相互间有什么联系?答:一个。因为PDP上下文的创建是和APN有关系。一个手机访问视频网站的服务器同一时刻应该是在同一个APN里。就一个PDP上下文,相互之间没有关联。2、先后观看了不同视频网站的不同的两个视频,此时又创建了几个PDP上下文,相互间有什么联系?答:要看不同视频网站的不同的两个视频是否在同一个APN里,或者用户是通过哪个APN去访问的。比如用户观看了土豆的视频是用cmwap激活的,然后又通过手机连接电脑使用cmnet激活了另一个PDP上下文去看优酷,这是可能的。但一般来说一个用户直接在手机上同时开两个APN激活好像不太可能,不部分手机应该没这个设置。


51学通信(www.51xuetongxin.com):致力打造最好的通信技术在线学习平台 。

使用道具 举报

Rank: 2Rank: 2

39#
发表于 2013-4-17 18:07:22 |只看该作者
要是能把Raduis,Gx和Gy等其他接口的信息一起包含进来就更好了,更利于掌握big picture了

使用道具 举报

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

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

GMT+8, 2024-5-4 02:26 , Processed in 0.042491 second(s), 14 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部