51学通信技术论坛

 找回密码
 立即注册
搜索
查看: 12747|回复: 19

请教关于UE的IPv6前缀分配问题   [复制链接]

Rank: 2Rank: 2

发表于 2011-10-24 09:57:24 |显示全部楼层
一键分享 一键分享
在UE附着到EPS网络过程中,在默认承载建立过程分配IP地址。如果是分配IPv6地址的话,好像MME收到PDN GW分配的IPv6前缀和接口标识符,只把接口标识符发给UE,而不把前缀发给UE,不知道是为什么?多谢!
23401协议原文:

5.3        Authentication, security and location management
5.3.1       IP address allocation
5.3.1.1            General
……
During default bearer establishment, the PDN GW sends the IPv6 prefix and Interface Identifier to the S‑GW, and then the S‑GW forwards the IPv6 prefix and Interface Identifier to the MME or to the SGSN. The MME or the SGSN forwards the IPv6 Interface Identifier to the UE. The MME does not forward the IPv6 prefix to the UE. If the UE receives the IPv6 prefix from the SGSN during PDP Context Activation procedure, it shall ignore it.

Rank: 9Rank: 9

懒

发表于 2011-10-25 13:42:09 |显示全部楼层
回复 youthjun 的帖子

  这个问题其实应该算IPV6的问题,和EPC信令流程关系不大。IPV6中的地址获取方式实现的是即插即用,类似现在的DHCP。只要连接上网,UE无需任何配置就可以得到一个IPV6的地址。这个IPV6地址由两部分组成,IPV6 prefix+Interface ID。如果是固网的话,网络侧会分配一个prefix(这个网络侧实际上就是终端的网关路由器啦),然后终端PC根据自己的MAC48位地址推算出一个Interface ID,两部分加一起就构成了一个完整的IPV6地址。而无论是移动网络还是固定网络,获取网络前缀的方法都是用RS和RA消息。其中S代表solicited,A代表Advertisement。即RS是终端主动发起的获取IPV6 Prefix的请求,RA可以是网络侧主动发起,也可以是对RS的一个应答,在RA消息里就包含了IPV6的prefix。
  所以,再看看TS23.401,后面有提到这个prefix到底怎么给UE。如下:
“The procedure of stateless IPv6 address autoconfiguration is the following: After default bearer establishment the UE may send a Router Solicitation message to the PDN GW to solicit a Router Advertisement message. The PDN GW sends a Router Advertisement message (solicited or unsolicited) to the UE. The Router Advertisement messages shall contain the same IPv6 prefix as the one provided during default bearer establishment. If the UE receives an IPv6 prefix from a SGSN during the PDP Context activation procedure, it shall ignore it.”
   也就是在default bearer建立之后,UE实际上得到了一个interface ID,这时UE可以发送一个RS消息给PGW来请求获取IPV6的prefix。然后PGW回的RA消息应包含在default bearer建立过程中相同的IPV6 prefix。
   另外,在5.3.2.1附着流程中的第18步也提到了这一点,如下:“
If the UE receives an IPv6 interface identifier, it may wait for the Router Advertisement from the network with the IPv6 prefix information or it may send a Router Solicitation if necessary.”
   也就是当收到网络侧的Attach accept消息后,得到了interface ID,UE可以等PGW发RA消息,或主动发RS消息来请求IPV6 prefix。
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 2Rank: 2

发表于 2011-10-25 14:31:33 |显示全部楼层
谢谢!受教了。

可还有一个问题再问一下哈,主要是对TS 23.401中的IP分配情况:The Router Advertisement messages shall contain the same IPv6 prefix as the one provided during default bearer establishment.

既然在默认承载建立后,可以给UE分配IPv6 prefix(UE发RS请求或PGW主动下发RA),为何在默认承载建立过程中给UE分配interface ID时还要带上IPv6 prefix呢?后面最终UE使用的IPv6 prefix和这默认承载建立中提供的IPv6 prefix还是相同的,UE直接使用在默认承载建立中分配的IPV6 prefix+Interface ID,和后来再组成完整的IPv6地址,好像效果是一样的。

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2011-10-29 17:23:31 |显示全部楼层
回复 youthjun 的帖子

  这又回到你开始的问题了。规范里,在建立默认承载的时候,UE是得不到IPV6 Prefix的,这个分配的Prefix只会通过PGW给SGW再给到MME存起来。所以UE无法在建立默认承载的时候构建完整的IPV6地址。
  至于为什么规范不让MME把IPV6 Prefix下发给UE。一方面我感觉是为了保持IPV6协议的一贯性,因为IPV6里的地址分配机制就是通过终端发RA,或网络侧发RS消息来进行分配的。如果建立默认承载就把prefix发下去,可能会破坏这种机制。对一些硬件厂家做开发比较麻烦。另外,UE发RS消息后,MME进行确认prefix的分配,也算是一种安全性的保护吧。
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 8

发表于 2012-10-7 10:54:16 |显示全部楼层
请问一个问题,the PDN GW sends the IPv6 prefix and Interface Identifier to the S‑GW

PGW为什么会把interface ID告诉给UE呢?这个ID不是UE从自己的MAC的48bit得到的吗?

谢谢。

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2012-10-7 19:47:50 |显示全部楼层
watson100 发表于 2012-10-7 10:54
请问一个问题,the PDN GW sends the IPv6 prefix and Interface Identifier to the S‑GW

PGW为什 ...

固网可能是这样。移动网络为了减少UE的负担,很多事情都交由网络侧来做。这样,可以帮助UE省电,另外UE也不见得有MAC地址吧。

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

使用道具 举报

Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7

版主 特殊贡献奖

发表于 2012-11-28 09:47:15 |显示全部楼层
跟着有问题。不另外帖子了, "这时UE可以发送一个RS消息给PGW来请求获取IPV6的prefix。然后PGW回的RA消息"

RS和RA 消息通过什么途径在UE 和PGW 之间互传呢?  分装在GTP-U 还是 通过S1AP ?

在S1-MME 接口上没有发现过S1AP 中包含有关这部分的内容。
如果通过GTP-U,那么这段时间因为UE的IP 并没有分配到,eNodeB是怎么通知到UE呢?

人刚我柔谓之走,我顺人背谓之粘。动急则急应,动缓则缓随。虽变化万端, 而理为一贯。

使用道具 举报

Rank: 9Rank: 9

懒

发表于 2012-11-28 11:12:35 |显示全部楼层
wenliu 发表于 2012-11-28 09:47
跟着有问题。不另外帖子了, "这时UE可以发送一个RS消息给PGW来请求获取IPV6的prefix。然后PGW回的RA消息"
...

我传1个IPV6的RS和RA报文可能就清楚了。

一定是通过S1-U的GTP隧道来传的。因为规范已经说了,这时候default bearer已经创建完成了。所以控制面已经结束,后续的IPV6的RS和RA都是属于用户面,就像一个HTTP报文一样都是用户面。IPV6网络中,IP地址有很多种类型,你所说的还没拿到IP地址实际上是指的global地址用于访问internet的,这个确实UE还没有。但UE会生成一个link local地址,前缀是fe80开头的,封装在RS报文头的IP源地址中向PGW请求global地址的前缀(规范里讲的IPV6地址前缀都是说的这个global地址,因为link local或者叫站点本地地址是终端自己生成的,你只要启用了IPV6的协议栈就会马上得到一个这样的地址。你可以在电脑上打ipconfig /all看看)。PGW响应RA的时候,也是用自己生成的link local地址作为I源地址回的。


附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册
www.gprshome.com: GPRS及移动通信技术学习交流分享平台。

使用道具 举报

Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7

版主 特殊贡献奖

发表于 2012-11-28 11:17:18 |显示全部楼层
啊。谢谢。 我也是这么想。但是苦于没有讨论的人。而且我也没怎么弄过IP 的东西,所以没办法来验证这一点。

使用道具 举报

Rank: 1

发表于 2013-6-6 12:33:42 |显示全部楼层
本帖最后由 小张 于 2013-6-6 12:47 编辑

能否请爱总帮忙解释一下CPI的这段描述:

The allowed netmask range for IPv6 APNs is from /44 to /62.

Each IPv6 UE is allocated a /64 prefix. IPv6 addresses are allocated as a prefix per primary PDP context or default EPS bearer. Prefixes are no longer reserved for network or broadcast purposes. Broadcast functionality in IPv6 is implemented as multicast in an own address space.

The number of allowed primary PDP contexts or default EPS bearers for each specified IPv6 address range can be calculated the following way:

number of available IPv6 address prefixes = 2^(64-x)

x   the configured prefix size


For example, in the case of GGSN APNs, /50 gives support for 16384 primary PDP contexts. Likewise, in the case of PGW APNs, /50 gives support for 16384 default EPS bearers.

===============================================================================================================

按照这个帖子的描述,我理解如果是/50的的prefix, 那么将会有2^14个IPV6 prefixs,而每个prefix的interface id 是64位的,即2^64个。

那么如果是/50的配置,那么会有2^78个主机地址,即可以给2^78个PDP或default bearer分配。为什么CPI里说是16384(2^14)个呢?

还是没能彻底理解IPv6在PGW上面的分配机制,请爱总帮助解惑。谢谢。

使用道具 举报

Rank: 9Rank: 9

发表于 2013-6-6 19:51:05 |显示全部楼层
小张 发表于 2013-6-6 12:33
能否请爱总帮忙解释一下CPI的这段描述:

The allowed netmask range for IPv6 APNs is from /44 to /62. ...

我的理解是这样的,IPV6的地址128位分成两段,一段是network prefix,相当于IPV4网络当中的IP Subnet即网络位,是64位。这64位当中又有一部分是IANA分配的,剩下的才是运营商可以自行分配的,比如本例中的44到62位。还有一段是主机部分,也是64位。通常是终端自己生成的,例如根据48位的MAC地址通过EUI-64扩展的方式自动生成。所以,下面这句话还是好理解:

:“number of available IPv6 address prefixes = 2^(64-x)”。

注意,这里提到的不是可以的IPV6 address,而是可用的IPV6 address prefix。两者不一样。后者实际上是指运营商可以在标准掩码64位的基础上可以再划分多少个子网,还是网段不是IP地址。就像运营商从IANA申请到一段200.1.1.0/24的网段一样,可以拆分成2个25位的网段一样。但IPV4的话,还是这个例子,那24~32位都可以用运营商来分配。所以200.1.1.0/24最多你也可以拆分成2^8个32位地址。

但IPV6就不一样了,第二部分的64位是主机ID,是由终端自己生成的。不受运营商控制。所以不能由运营商规划,所以CPI说的没错的。/50可用的并不是2^78,而是2^14。

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

使用道具 举报

Rank: 1

发表于 2013-6-7 10:39:35 |显示全部楼层
admin 发表于 2013-6-6 19:51
我的理解是这样的,IPV6的地址128位分成两段,一段是network prefix,相当于IPV4网络当中的IP Subnet即网 ...

感谢版主答复。

按照这个帖子上面的讨论结果,IPv6地址的后64位即if id是由PGW分配的,而我也确实看到过这样的抓包。

即使是由UE自己产生的,也是通过MAC地址产生的,全球的终端都不会有同样的MAC,所以后64位也是唯一的。

那么,每一个IPv6 prefix都会有 2^64个主机地址,假设有2^12个Prefixs将会支持2^12*2^64个Primary PDP或default bearer.

仍然迷惑。

使用道具 举报

Rank: 9Rank: 9

发表于 2013-6-7 16:42:21 |显示全部楼层
小张 发表于 2013-6-7 10:39
感谢版主答复。

按照这个帖子上面的讨论结果,IPv6地址的后64位即if id是由PGW分配的,而我也确实看到 ...

我查了下规范。PGW确实会直接分配一个IPV6的地址。如下:“

PDN Address and Prefix (octet 6 to n+4)

If PDN type value indicates IPv4, an IPv4 address is present in the PDN Address and Prefix from octet 6 to octet 9. Bit 8 of octet 6 represents the most significant bit of the IPv4 address and bit 1 of octet 9 the least significant bit.

If PDN type value indicates IPv6, octet 6 contains the IPv6 Prefix Length. Octets 7 through 22 contain an IPv6 Prefix and Interface Identifier. Bit 8 of octet 7 represents the most significant bit of the IPv6 Prefix and Interface Identifier and bit 1 of octet 22 the least significant bit.”(7到22字节就是16个字节,就是一个完整的IPV6地址了)。

同样,在23401里也提到了:“For external PDN addressing for IPv6, the PDN GW obtains the IPv6 prefix from the external PDN using either RADIUS or Diameter client function. In the PDN Address field of the Create Session Response, the PDN GW includes the Interface Identifier and IPv6 prefix. The PDN GW sends Router Advertisement to the UE after default bearer establishment with the IPv6 prefix information for all cases.”。

这也是你在抓包文件中看到PGW给UE分配了64位interface ID的原因。

但需要注意的是,这里你看到的PGW给UE分配的64位interface ID以及完整的network prefix,看似是一个完整的IPV6地址,是可以用来上网了。但其实不然。UE得到这个所谓的IPV6地址后,还不能直接上网,根据规范的信令过程,在完成default bearer的创建后,UE还需要发送RS消息给PGW,PGW发送RA消息给UE重新分配一个可用于在internet网上路由的公网network prefix。UE需要再根据PGW通过RA消息分配的这个公网network prefix,本地根据规则再重新生成一个64位的interface id(和create session response消息里的interface iD不是同一个)加上PGW分配的network prefix构成一个可以在internet中路由的公网IPV6地址然后才可以上网。PGW在create session response消息中分配的64位interface id是为了帮助UE生成一个唯一的link local地址(比ipv4网络中的私网地址有效范围还要小,不能跨网段转发,可用于获取一个public ipv6地址)。

所以,信令流程是这样的:

1 PGW给SGW发送的create session reponse消息,在pCO字段中包含64位的network prefix,并且在PCO的第6个字节指明了一下network prefix的长度,例如50。并且PCO字段还携带了一个64位的interface ID,假设是ID-A。

2 完成default bearer和attach过程。UE得到了该IPV6地址的network prefix和ID-A。

3 UE根据步骤2得到的network prefix和ID-A生成一个唯一的ipv6 link local地址,并以该地址作为ip层的源地址向PGW发送RS消息,申请一个公网的IPV6地址。

4 PGW收到后,响应一个RA消息。包含公网IPV6地址的network prefix部分(64位)。

5 UE收到后,本地生成一个新的64位的interface OD,假设是ID-B。这个ID-B和ID-A可以是不一样的。再加上第4步PGW下发的公网ipv6地址的network prefix部分,就构成了一个完整的128位public IPV6地址。

6 UE使用第5步生成的public IPV6地址访问internet。

规范的原文如下:“

5.3.1.2.2 IPv6 prefix allocation, renewal and release via IPv6 stateless address autoconfiguration

When the PLMN allocates an IPv6 prefix, it is the PDN GW responsibility to allocate and release the IPv6 prefix. The PDN GW may use an internal IPv6 prefix pool in this case. The PDN GW allocates a globally unique /64 IPv6 prefix via Router Advertisement to a given UE.

The procedure of stateless IPv6 address autoconfiguration is the following: After default bearer establishment the UE may send a Router Solicitation message to the PDN GW to solicit a Router Advertisement message. The PDN GW sends a Router Advertisement message (solicited or unsolicited) to the UE. The Router Advertisement messages shall contain the same IPv6 prefix as the one provided during default bearer establishment. If the UE receives an IPv6 prefix from a SGSN during the PDP Context activation procedure, it shall ignore it.

After the UE has received the Router Advertisement message, it constructs a full IPv6 address via IPv6 Stateless Address autoconfiguration in accordance with RFC 4862 [18]. To ensure that the link-local address generated by the UE does not collide with the link-local address of the PDN GW, the PDN GW shall provide an interface identifier (see RFC 4862 [18]) to the UE and the UE shall use this interface identifier to configure its link-local address. For stateless address autoconfiguration however, the UE can choose any interface identifier to generate IPv6 addresses, other than link-local, without involving the network. For privacy, RFC 3041 [39], the UE may change the interface identifier used to generate full IPv6 addresses, without involving the network.

Any prefix that the PDN GW advertises to the UE is globally unique. The PDN GW shall also record the relationship between the UE's identity (IMSI) and the allocated IPv6 prefix. Because any prefix that the PDN GW advertises to the UE is globally unique, there is no need for the UE to perform Duplicate Address Detection for any IPv6 address configured from the allocated IPv6 prefix. Even if the UE does not need to use Neighbor Solicitation messages for Duplicate Address Detection, the UE may, for example, use them to perform Neighbor Unreachability Detection towards the PDN GW, as defined in RFC 4861 [32]. Therefore, the PDN GW shall respond with a Neighbor Advertisement upon receiving a Neighbor Solicitation message from the UE.

从上述规范里蓝色字体还看到,从PGW分配给UE的prefix必须要是全局唯一的。所以我个人认为这也是CPI上为什么这么说的原因:“Each IPv6 UE is allocated a /64 prefix. IPv6 addresses are allocated as a prefix per primary PDP context or default EPS bearer. ”

这段话翻译成中文应该是:每个IPV6的UE都会被分配一个/64 prefix(CPI并没有说明该prefix是否是唯一的,但参照规范,应该是需要全局唯一的)。然后是IPV6的地址是针对每个primary pdp上下文呢或default EPS bearer作为一个prefix来进行分配的。也就是隐含的说明一个primary pdp context对应的IPV6 prefix是唯一的。所以,按此说法。后面的计算,针对UE的IPV6地址就是2^(64-50)=16384。而不是2^(64-50+64)了。

所以,个人认为CPI还是没有问题的。供参考。

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

使用道具 举报

Rank: 1

发表于 2013-6-9 15:29:32 |显示全部楼层
这下找到根源了,看来CPI是没有问题的。但是不理解协议的思路,如此的话,后面的64位岂不是浪费了?

非常感谢楼主的付出及详细的解释。

附上一个IPV6分配过程中的抓包,供大家参考。
附件: 你需要登录才可以下载或查看附件。没有帐号?立即注册

点评

admin  谢谢分享。  发表于 2013-6-9 16:29:31

使用道具 举报

Rank: 4Rank: 4Rank: 4Rank: 4

发表于 2013-7-19 15:38:26 |显示全部楼层
本帖最后由 johne.xiao 于 2013-7-19 15:43 编辑
小张 发表于 2013-6-9 15:29
这下找到根源了,看来CPI是没有问题的。但是不理解协议的思路,如此的话,后面的64位岂不是浪费了?

非常 ...

你好 ,我想问一下,为什么 这个包里面Router solicitation 的信令出现在三次Router advertisement后呢?不是应该发出RS后才有RA么?还是可以解释是PGW主动给发RA了呢?

使用道具 举报

Rank: 3Rank: 3Rank: 3

发表于 2013-8-2 09:10:45 |显示全部楼层
爱卫生 发表于 2012-11-28 11:12
我传1个IPV6的RS和RA报文可能就清楚了。一定是通过S1-U的GTP隧道来传的。因为规范已经说了,这时候defaul ...

请问这个包是在手机上抓的吗,和楼下另一位兄弟提供的数据包对比了一下,没有GTP封闭哦

点评

wenliu  之前爱总传的只是针对IPV6分配的两条消息说明了下。并不针对LTE 中UE IPv6 分配的机制。  发表于 2013-8-12 14:13:52

使用道具 举报

Rank: 3Rank: 3Rank: 3

发表于 2013-8-12 20:41:08 |显示全部楼层
zzz 发表于 2013-8-2 09:10
请问这个包是在手机上抓的吗,和楼下另一位兄弟提供的数据包对比了一下,没有GTP封闭哦

好的,多谢!

使用道具 举报

Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7Rank: 7

版主 特殊贡献奖

发表于 2013-8-14 11:12:29 |显示全部楼层
johne.xiao 发表于 2013-7-19 15:38
你好 ,我想问一下,为什么 这个包里面Router solicitation 的信令出现在三次Router advertisement后呢? ...

针对包里面之前出现的Router Advertisement的消息,是路由器周期性的发送路由器通告消息,是向邻居节点通告自己的存在,是多播方式。

之前的出现的RA消息是 fe80:1 发给ff02:1
fe80:1 为链路-本地地址,发送RA 到 ff02:1 链路本地范围的所有节点多播地址。

随后的RS和RA 地址分别为fe80::ce86:bb86:ef81:c456, 这个是UE 的链路本地地址格式,使用了fe80 这个固定开头+之前分配的IPV6 接口地址 作为interface ID,构建了这个链路本地地址。

ff02:2 链路本地范围的所有路由器多播地址。
路由器随后通过fe80::1 地址发给 UE RA, 并携带Prefix 2005::

人刚我柔谓之走,我顺人背谓之粘。动急则急应,动缓则缓随。虽变化万端, 而理为一贯。

使用道具 举报

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

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

GMT+8, 2024-3-28 22:17 , Processed in 0.033947 second(s), 15 queries .

Powered by Discuz! X2

© 2001-2011 Comsenz Inc.

回顶部