简介

一、需求

对接入点:在移动的过程中会改变接入点。

  • 手机使用的蜂窝网络中,移动会改变基站。
  • 在WLAN中,一个用户在移动的过程中会改变AP(连接点)

对应用:希望应用不会再移动性上被打扰

  • 基站改变,但通话质量不变(蜂窝)
  • AP改变继续应用(WLAN)

二、移动解决方案

1.蜂窝

GSM 有自己的 注册、切换、移动管理过程

2.移动网络

移动IP,基于主机和移动用户

三、Mobile IP

工作在网络层,为了解决用户的移动性,支持无缝切换。
不考虑如何切换物理接入点

通过使用Mobile IP,TCP/IP应用不会意识到用户在移动,只有IP协议和底层会知道。

1.目标

  1. 支持漫游、切换
  2. 和现有协议和谐相处
  3. 独立于物理层和数据链路层

2.RFC

移动IP

概念和术语

Mobile Node(MN) :移动节点,电脑手机等
Home Network(HN):家乡网络(最早申请IP地址的网络)
Foreign Network(FN):外地网络
移动IP
Home agent(HA):家乡代理,和最早注册的网络在同一链路上的路由器。作用是维护主机在本地网络的属性。当MN移动到别的网络会向HA报道。职责是将数据包转发给移动节点

Foreign agent(FA):和当前主机所处的外部网络在同一链路的路由器。

  • 为移动节点分配COA
  • 和移动节点的家乡网络进行通信
  • 默认路由器

Correspondent Node(CN):通信端点,和移动主机进行通信。
移动IP
Home Address:家乡地址,通过这个地址,不管主机在哪个网络都是可达的(不会收回)。
Care-of-address:转交地址,别的网络分配给主机的地址。
Home link:家乡链路
Foreign link:外部链路
移动IP

移动IP功能

一、移动IP的主要想法

到达新的连接点要有新的IP地址。Home address是不变的,COA是动态的。

二、COA的类型

  1. Foreign agent care-of-address
    和foreign agent在一起,移动节点可以直接使用(coa和FA在同一网段)
  2. Collocated care-of-address
    没有 foreign agent,移动节点和FA用同一个地址。

三、通信过程

移动IP

  1. MN向家乡网络报告自己的位置,通过FA再到HA。
  2. CN发送报文会先发送到家乡网络,因为它不知道MN现在的位置。再由HA、FA转发。
  3. MN发送的消息,通过FA直接转发到CN所在的网络。

四、移动IP功能

  1. 发现代理:当移动节点移动到新的网络时,首先要找到外部代理(用ICMP消息)。
    • HA和FA每隔一定时间广播通告信息,允许移动节点能够发现,移动节点通过通告信息可以判断是HA还是FA。
    • 移动节点也可以主动发送ICMP消息。
  2. 注册:向家乡代理注册
  3. 隧道:当报文发给移动节点,但是不在家乡网络。家乡代理收到报文,通过隧道发送给MN。

五、一个数据包从通信节点到移动节点

IP-C: IP Address of Correspondent Host
IP-M: IP Adress of Mobile Host (家乡地址)
IP-H: IP Address of Home Agent (care-of-address of mobile)
IP-F: IP Address of Foreign Agent.
移动IP
reply信息,不经过HA,所以不需要隧道。
移动IP

六、代理发现

移动IP代理通告消息:
移动IP
Flags:
R: Registration requires (with the foreign agent) 注册时需要
B: Foreign agent is busy 外部代理忙
H: The agent is home agent. 当前代理是家乡代理
F: The agent is foreign agent 当前代理是外部代理
M: Minimum encapsulation 最小封装
G: GRE encapsulation GRE封装
V: Van Jacobson Header Compression 压缩方式

七、注册

1.为什么要注册?
  1. 获取care-of-address
    1. 从外部代理获取
    2. 从DHCP服务器获取
  2. 让家乡代理知道当前所处的转交地址。
2.什么时候注册?

当移动节点发现自己移动到一个新的位置的时候。

3.注册消息使用什么协议?

UDP 434端口

4.注册过程包含两种消息
  1. 注册请求消息
  2. 注册回应消息
5.注册更新绑定
  • home address
  • the care-of address
  • Registration lifetime(生命周期)
6.注册请求消息

移动IP
Type: 1 -Registration Request.(1表示注册请求
Lifetime: Number of seconds registration is valid.
Home address: The home IP address of the mobile
Home agent: The IP address of the home agent.
Care-of-address: The current IP address of the mobile node
Identification: Used for replay protection. (防止重放)
Extensions: Security extensions can be added to protect from malicious people. (其他安全参数)

标志位
S: Simultaneous binding. (注册的同时绑定
B: Broadcast – Home agent will tunnel broadcast datagrams to the mobile
D: Mobile node is using a collocated care-of-address - that means there is no foreign agent and mobile node will de-capsulate the packets itself. (意味着没有FA)
M: Mobile node requests the home agent to encapsulate the packets using Minimal Encapsulation(最小封装)
G: Mobile node requests the home agent to encapsulate the packets using GRE Encapsulation(GRE封装)

7.注册回应消息

移动IP
Type: 3 – Registration Reply(3是注册回应)

Code: Indicates the result of registration 注册结果

  • 0 registration accepted
  • 66 insufficient resources at foreign agent
  • 70 poorly formed request
  • 130 insufficient resources at home agent
  • 131 mobile node failed authentication

Lifetime: The granted life time by home agent for registration
Home address: The home IP address of the mobile
Home agent: The IP address of the home agent.
Identification: Used for replay protection.
Extensions: Security extensions can be added to protect from malicious people.

相关文章: