MobileIP, the way the operator accesses the Internet, and the situation that the server obtains IP

It is not easy to write, please indicate when reprinting (http://shihlei.iteye.com/blog/2418672)!

I. Overview

        Obtaining the client IP on the server side is a very common operation. The application scenarios of the client IP may include: IP-oriented geolocation services, anti-crawling services, etc. I am very curious, the network environment where the user is located: wired, wifi, 2G, 3G, 4G, roaming, etc. The IP information obtained by the server is sorted according to personal understanding. If there is any error, please give me more guidance.

 

This article mainly introduces:

1) IP Basics

2) The operator's Internet access method.

 

For the way that Java obtains Client IP on the server side, please refer to "Server Obtaining Client IP Tool Class: IPUtil" .

 

Two IP Overview

( 1) IPV4

1 Overview:

A 32-bit binary number that can be represented in the dotted decimal method.

Composed of [network number][host number]

 

in:

The host part is all 0: the network number

The host part is all 1: broadcast address, all hosts on this network

 

2) Classification:

Classful address: Distinguish network numbers, host numbers, and ABCD classes according to categories. The advantages of categories and structure analysis are simple, and the disadvantages are not flexible enough.

Classless address: distinguish the network number and host number according to the subnet mask (the division relationship between the host and the network is not fixed)

 

Special Note: Standard IP routing can only be classful addresses, and classless addresses can be used inside the subnet.

 

3) The problem of tight IP address:

Due to the limited IP addresses and the rapid growth of mobile devices, the public network IP is not enough. At present, the main solutions are: subnetting, IP reservation, IPV6

 

4) Reserved address:

It is used to reuse private network addresses in different units.

 

However, when connecting to the public network, the public network exit must have a public network IP. The IP conversion of the private network and the public network is accomplished through technical means such as NAT and PAT.

 

About reserved IP: The entire IP address space has three small segments of address space, which are used for reserved addresses and will not appear in the shared IP. They are used within the enterprise and can be repeated in the private network.

 

Currently reserved address segment:

10.0.0.0 - 10.255.255.255 10.0.0.0

172.16.0.0 - 172.31.255.255 172.16.0.0

192.168.0.0 - 192.168.255.255 192.168.0.0

 

(2) IPV6

128-bit binary number, often written as colon and hexadecimal method (8 groups of hexadecimal numbers)

 

(3) All-IP core network

The terminal, network element, and wireless network element use IP-based protocol for data transmission.

 

Three-operator network access method 

(1) Mobile network architecture

 

(1) 3g (UMTS network system):

 

Network element:

(a) UE (User Equipment, user equipment): Send and receive data through wireless protocols

(b) NodeB (base station): It is interconnected with the RNC through the standard Iub interface, and communicates with the UE through the Uu interface. It mainly completes the processing of the Uu interface physical layer protocol and the Iub interface protocol.

(c) RNC (Radio Network Controller, Radio Network Controller): It is an integral part of the access network and is responsible for mobility management, call processing, link management and handover mechanism.

(d) SSNG (Serving GPRS Support Node, Serving GPRS Support Node): routing and forwarding of packet data packets, mobility management, session management, logical link management, authentication and encryption, bill generation and output and other functions.

(e) GGSN (Gateway GPRS Support Node, Gateway GPRS Support Node; Gateway GSN, Gateway GSN): The public network exit of mobile data packets, the dividing line between the GPRS network and the external network, responsible for the transmission of the Gn network internally, and an external network. an Internet router.

 

(2) 4G (LTE network system):


Network element:

(a) UE (User Equipment, user equipment): Send and receive data through wireless protocols

(b) eNodeB (base station): Node B, which integrates some of the functions of the RNC and reduces the level of protocols during communication.

(c) S-GW (Serving GateWay, serving gateway): The user plane accesses the serving gateway, which is equivalent to the user plane function of the traditional SGSN. Responsible for signaling planes such as mobility management and user access control.

(d) P-GW (PDN GateWay, PDN Gateway): The public network exit of mobile data packets , similar to the function of GGSN network element, provides user session management and bearer control, data forwarding, IP address allocation and non-3GPP user access. Enter and other functions.

 

(3) Special attention:

3G,4G基本都是基于IP协议,在GGSN/P-GW前,都是内网IP,对Server端不可见,从P-GW后通过NAT,从地址池中分配公网IP使用。

  

二)接入方式

 

(1)归属地接入方式

无论用户是本地访问还是漫游,都是通过“归属地”GGSN/P-GW来连接到Internet。主要实现技术是Mobile IP技术。

 

优点:运营商计费方便。

缺点:要回归归属地,增加网络时延,造成网速慢。

 

注:Mobile IP技术:


 

(a)目的:

在跨越网络边界时(进入不同网段的网络),保证移动设备的对外通讯的IP不变。

 

(b)实现方式:

使用归属地 IP 地址和转交地址(访问地绑定地址,COA)完成数据回源与转发。

 

(c)核心逻辑组件:

  • 移动节点 (Mobile node, MN):移动节点,使用“归属地地址(家乡IP)”维持所有通讯。
  • 家乡代理 (Home agent, HA):位于移动节点的家乡网络上的路由器或服务器。路由器会拦截发往移动节点的数据报,然后,通过“转交地址(外阜IP)”传送数据报。家乡代理也会维护有关移动节点位置的当前信息。
  • 外地代理 (Foreign agent, FA):位于移动节点访问的外地网络上的路由器或服务器。外地代理可为移动节点提供主机路由服务。外地代理还可能在注册移动节点时向其提供转交地址。

(d)数据包传输过程:

前提:

移动节点始终保存HA的IP。

在移动过程中,更换FA时,从FA获取分配COA,并通过FA将COA注册到HA,以便数据包可以回传。

 

数据包上行:

源IP为“归属地IP”,目的IP为“远程服务器IP”,普通情况,IP协议仅通过目的IP路由,所以可以直接通过“常规路由协议”,到达远程Server。

仅在有源IP安全验证的网络环境,才需要回HA进行转发,以便通过源IP验证。

 

数据包下行:

        源IP为“远程服务器IP”,目的IP为“归属地IP”,数据包一定会先到归属地网络被拦截,然后进行转发。

 

        下行流程:

步骤1:Internet 主机使用移动节点的家乡地址向移动节点发送数据报(此为标准的 IP 路由过程)。

步骤2:如果移动节点位于家乡网络,则数据报会通过常规 IP 进程传送到移动节点。否则,数据报将传送到家乡代理。

步骤3:如果移动节点位于外地网络,则家乡代理将数据报通过“隧道”技术转发到外地代理。

步骤4:外地代理将数据报传送到移动节点。

 

(2)漫游接入方式

使用漫游地运营商的GGSN/P-GW接入Internet。

 

优点:速度快,时延低。

缺点:某些会话会断,运营商商计费,控制困难。

 

两种接入方式各有优劣,运营商们会根据自身的一些情况来选择用户漫游时将采用使用哪一种接入方式。

 

(三)关于运营商的接入策略

 

  2g 3g 4g
移动     漫游 漫游
联通   归属地 归属地
电信   漫游 归属地 

 

四 总结

(一)关于获取IP

服务器能获取的IP,一定是网络边界(GGSN/P-GW)分配的公网IP,由于接入方式不同,ip对应的城市也不同。

 

(1)归属地接入方式:ip为归属地GGSN/P-GS分配的ip,“IP归属城市”一般不会变化

(2)漫游接入方式:ip为漫游地GGSN/P-GW分配的ip,且“IP归属城市”随着漫游地变化而变化

 

(二)关于IP变化条件

 

(1)重新发起接入(重启,wifi到4g,没信号到有信号),GGSN会从地址池中重新分配公网IP

(2)IP是三层协议,接入方式是数据链路层,只要在接入过程重没有断网,切换小区,切换接入点(基站)不会引擎IP变化。

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326130745&siteId=291194637