跳到主要内容

3. 注册 (Registration)

Mobile IP registration 为 mobile node 提供一种灵活机制, 用于:

  • 请求并接收 mobility service
  • 告知其 home agent 当前 care-of address
  • 在注册到期前续订注册
  • 返回 home network 时注销

3.1. 注册概览 (Registration Overview)

注册过程涉及三方:

  1. Mobile Node: 发起注册请求
  2. Foreign Agent (可选): 中继注册消息
  3. Home Agent: 接受或拒绝注册请求

注册可以通过 foreign agent 执行, 也可以在使用 co-located care-of address 时直接执行.

3.2. 认证 (Authentication)

所有注册消息都必须经过认证. Mobile IP 为此使用 Mobile-Home Authentication Extension. 认证可以防止恶意节点劫持 mobile node session.

3.3. Registration Request

mobile node 通过 foreign agent 向其 home agent 发送 Registration Request 消息 (如果使用 co-located care-of address, 则直接发送).

Registration Request 中的关键字段:

  • Type: 1 (Registration Request)
  • Lifetime: 请求的注册持续时间, 单位为秒
  • Care-of Address: 隧道终止点
  • Home Address: mobile node 的永久 IP 地址
  • Home Agent: mobile node 的 home agent IP 地址
  • Identification: 用于重放保护的 64-bit 数值

3.3.1. Mobile Node 注意事项

Mobile node 必须:

  • 将 Lifetime 字段设置为期望的注册周期
  • 包含有效的 Mobile-Home Authentication Extension
  • 使用适当的 identification 值以防止重放攻击

3.3.2. Foreign Agent 注意事项

收到 Registration Request 时, foreign agent:

  • 检查其有效性
  • 如果资源不可用, 可以拒绝请求
  • 将有效请求中继给 home agent
  • 如果存在共享安全关联, 添加 Foreign-Home Authentication Extension

3.3.3. Home Agent 注意事项

home agent:

  • 认证 Registration Request
  • 检查 mobile node 是否被授权
  • 创建或更新 mobility binding
  • 发送 Registration Reply

3.4. Registration Reply

home agent 发送 Registration Reply 以批准或拒绝请求.

Registration Reply 中的关键字段:

  • Type: 3 (Registration Reply)
  • Code: 指示接受或拒绝原因
  • Lifetime: 授予的注册 lifetime (可能小于请求值)
  • Home Address: mobile node 的永久 IP 地址
  • Home Agent: home agent 的 IP 地址

3.4.1. Mobile Node 注意事项

收到 Registration Reply 后, mobile node:

  • 验证认证信息
  • 检查 Code 字段以判断接受或拒绝
  • 更新其注册状态
  • 根据授予的 Lifetime 重新安排再次注册

3.4.2. Foreign Agent 注意事项

foreign agent:

  • 如果存在 foreign-home authentication, 则认证 Reply
  • 如果注册被接受, 则更新其 visitor list
  • 将 Reply 中继给 mobile node

3.4.3. Home Agent 注意事项

home agent:

  • 适当地设置 Code 字段
  • 可以缩短请求的 Lifetime
  • 必须包含 Mobile-Home Authentication Extension

3.5. 注册扩展 (Registration Extensions)

扩展为注册消息提供附加功能和安全性.

3.5.1. 计算 Authentication Extension 值

authentication 值通过对注册消息的指定部分使用 keyed MD5 [23] 计算得到.

3.5.2. Mobile-Home Authentication Extension

mobile node 与 home agent 之间的所有 Registration Request 和 Reply 都要求使用此扩展.

格式:

  • Type: 32
  • Length: 4 加上 Authenticator 中的字节数
  • SPI: Security Parameters Index (4 bytes)
  • Authenticator: 可变长度 (MD5 通常为 128 bit)

3.5.3. Mobile-Foreign Authentication Extension

当 mobile node 和 foreign agent 共享 security association 时, 可以包含此扩展.

3.5.4. Foreign-Home Authentication Extension

当 foreign agent 和 home agent 共享 security association 时, 可以包含此扩展.

3.6. 拒绝 Registration Request

注册可能因多种原因被拒绝, 这些原因由 Registration Reply 中的 Code 字段指示:

  • Code 65: Registration accepted
  • Code 128: Reason unspecified
  • Code 129: Administratively prohibited
  • Code 130: Insufficient resources
  • Code 131: Mobile node failed authentication
  • Code 133: Requested Lifetime too long
  • Code 134: Poorly formed Request
  • Code 135: Poorly formed Reply
  • Code 136: Requested encapsulation unavailable

3.7. 注册消息选项 (Registration Message Options)

Mobile IP 通过扩展机制支持多种可选功能, 允许协议在保持向后兼容的同时演进.

3.8. 状态管理 (State Management)

3.8.1. Mobility Binding

home agent 维护 mobility binding, 将 mobile node 的 home address 与其当前 care-of address 和剩余 lifetime 关联起来.

3.8.2. Visitor List

foreign agent 维护 visitor list, 跟踪当前通过其注册的 mobile node, 包括这些节点的 home address, home agent 和 registration lifetime.