51学通信技术论坛

 找回密码
 立即注册
搜索
查看: 40774|回复: 11
打印 上一主题 下一主题

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: 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: 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: 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: 9Rank: 9

懒

5#
发表于 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: 9Rank: 9

懒

6#
发表于 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: 9Rank: 9

懒

7#
发表于 2012-3-19 21:17:39 |显示全部楼层
回复 ktpd00wen99 的帖子

1 UDP的端口号,在协议里没有说一定要源和目的端口都相同。不见得源端口也要用2123。

  规范29.060里的原话是:

The UDP Destination Port number for GTP-C request messages is 2123. It is the registered port number for GTP-C.

The UDP Destination Port number for GTP-U request messages is 2152. It is the registered port number for GTP-U.

The UDP Source Port is a locally allocated port number at the sending GSN/RNC.

  因此,GSN节点可以本地分配源端口,只需要在本地能够区分出上层应用即可。

2 谢谢,之前的回复确实不准确。已经更新。正确的应该如下。

SGSN发给GGSN的用户面和控制面IP可以是相同的,也可以不相同的。这是两个GTP协议的IE(信息元素)。一个GTP-C,一个GTP-U。要区分的话,不是通过IP地址来区分,而是通过TEID。控制面和用户面的TEID通常是不一样的。即使一样,也能够区分。在解封装的时候,GGSN是先解IP头部,然后解UDP,看到不同的端口号,就送给不同的进程(GTP-C和GTP-U)来处理。不同的进程再根据TEID来区分用户。

另外,#2的TEID是SGSN给GGSN分的,用于下行GTP包封装,而#3的TEID是GGSN给SGSN分的,用于上行方向GTP封装。两者没有直接联系。

3 这个问题的答案见第1个问题的答案。如果GGSN确定是用户面,则目的端口为2152,否则是2123。源端口可以随机定。也可以和目的端口一致。看厂家了。

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

使用道具 举报

Rank: 9Rank: 9

懒

8#
发表于 2012-4-28 19:02:32 |显示全部楼层
回复 爱学习 的帖子

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

使用道具 举报

Rank: 9Rank: 9

懒

9#
发表于 2012-5-2 20:53:59 |显示全部楼层
回复 imwoohan 的帖子

没关系的。因为Gn接口控制和用户面是分离的。通过udp端口号2123和2152区分。从传输层UDP查端口号,就可以交给上层的用户部分即GTP-C或GTP-U处理,因此TEID是可以复用的。就好象两个局域网,因为是彼此隔离的,因此可以使用相同的IP地址段。
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 9Rank: 9

懒

10#
发表于 2012-6-19 21:13:01 |显示全部楼层
dandaner00hcw 发表于 2012-6-19 21:03
我突然有个问题,爱总,ggsn在收到create pdp context request后,跟radius和dhcp 的交互过程是怎么样的?能 ...

现网中DHCP比较少用,可能一些企业用户有吧。

RADIUS现网中主要的作用有两个,一个是认证,但现在都是透明接入不需要认证,除非是一些企业用户。包括access request和access accept消息,可以用PAP或CHAP协议来做认证。还有一个作用是Accouting,作用是将MS的相关信息例如IMSI、MSISDN提供给WAP网关做一些业务的参考等。消息包括Accouting request、accouting response。

论坛已经开通全文搜索功能,可以搜索radius得到更多信息。具体过程参考这篇帖子:http://www.gprshome.com/forum.php?mod=viewthread&tid=1581RADIUS协议基本概念及带有RADIUS过程的PDP激活流程

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

使用道具 举报

Rank: 9Rank: 9

懒

11#
发表于 2012-8-2 21:45:54 |显示全部楼层
Erin 发表于 2012-8-2 14:18
哦,好的,谢谢!
     我可以这么理解:就是根据TBF建立时的请求原因决定是GPRS附着,PDP激活,位 ...

基本是这样的。补充一下,就是现网中核心网下发的ready timer时间都比较长了,不是44秒,可能几百秒等等。这样QQ心跳来了就不需要寻呼MS了。而CCCH包括PCH和RACH、AGCH。PCH因为ready timer调长了而占用会减少,但后面两个用于建TBF不会减少了。

不是100%确定。供参考!

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

使用道具 举报

Rank: 9Rank: 9

懒

12#
发表于 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及移动通信技术学习交流分享平台。

使用道具 举报

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

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

GMT+8, 2024-5-2 17:47 , Processed in 0.029987 second(s), 14 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部