DHCPv6报文格式
DHCPv6报文是承载于UDP上的高层协议报文,RFC推荐采用547(DHCPv6服务器/Relay)和546(DHCPv6客户端)两个端口号。
DHCPv6消息格式
客户端/服务器端的DHCPv6消息格式
0 7 15 31 +------------------------------------------+ | msg-type | transaction-id | +------------------------------------------+ | options(variable) | +------------------------------------------+
客户端/服务器端的DHCPv6消息字段解释
字段
长度
含义
msg-type
1字节
报文类型:
SOLICIT (1)
ADVERTISE (2)
REQUEST (3)
CONFIRM (4)
RENEW (5)
REBIND (6)
REPLY (7)
RELEASE (8)
DECLINE (9)
RECONFIGURE (10)
INFORMATION-REQUEST (11)
RELAY-FORW (12)
RELAY-REPL (13)
transaction-id
2字节
消息ID
options
可变
选项字段
中继的DHCPv6消息格式
中继的DHCPv6消息格式
0 7 15 31 +------------------------------------------+ | msg-type | hop-count | | +------------------------------------------| | link-address | +------------------------------------------| | peer-address | +------------------------------------------| | options(variable number and length).. | +------------------------------------------+
中继的DHCPv6消息字段含义
字段
长度
含义
msg-type
1B
Relay-forward Message: RELAY-FORW Relay-reply Message: RELAY-REPL
hop-count
1B
Relay-forward Message: Number of relay agents that have relayed this message. Relay-reply Message: Copied from the Relay-forward message.
link-address
12B
Relay-forward Message: A global or site-local address that will be used by the server to identify the link on which the client is located. Relay-reply Message: Copied from the Relay-forward message.
peer-address
12B
Relay-forward Message: The address of the client or relay agent from which the message to be relayed was received. Relay-reply Message: Copied from the Relay-forward message.
options
可变
必须包含名为"Relay Message option"的选项,当然,中继可以添加其他选项。
可选字段的报文格式
DHCPv6 Options字段的格式
0 15 31 +------------------------------------------+ | option-code | option-len | +------------------------------------------| | option-data(option-len octets) | +------------------------------------------+
字段
长度
含义
option-code
2B
无符号整数,标识选项的类型:
OPTION_CLIENTID (1): 标识客户端身份,用于识别客户。
OPTION_SERVERID (2): 用于识别服务器。
OPTION_IA_NA (3): 非临时地址集合选项。
OPTION_IA_TA (4): 临时地址集合选项。
OPTION_IAADDR (5): 用于携带地址选项。
OPTION_ORO (6): 选项请求选项,用来在客户端和服务器之间标识一系列选项。 OPTION_PREFERENCE (7)
OPTION_ELAPSED_TIME (8): Elapsed Time Option
OPTION_RELAY_MSG (9): 在Relay-forward消息或Relay-reply消息中传递DHCP消息。
OPTION_AUTH (11): Authentication Option
OPTION_UNICAST (12): Server Unicast Option,服务器单播选项。
OPTION_STATUS_CODE (13): Status Code Option
OPTION_RAPID_COMMIT (14): Rapid Commit Option
OPTION_USER_CLASS (15): User Class Option
OPTION_VENDOR_CLASS (16): Vendor Class Option
OPTION_VENDOR_OPTS (17): Vendor-specific Information Option
OPTION_INTERFACE_ID (18): 用于标识用户接入接口
OPTION_RECONF_MSG (19): Reconfigure Message Option
OPTION_RECONF_ACCEPT (20): Reconfigure Accept Option
DNS Recursive Name Server (23)
DNS Domain Search List (24)
IA_PD (25): (Identity association for prefix delegation),授权的前缀集合选项。
IA_PD Prefix (26): 用于携带前缀选项。
Relay Agent Remote-ID (37)
Relay Agent Subscriber-ID (38)
AFTR Name (64): 用于DS-Lite方案中携带AFTR的域名。
option-len
2B
无符号整数,标示option-data字段的字节数。
option-data
可变
选项的数据部分。
参考标准
标准
描述
RFC3315
Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
RFC3633
IPv6 Prefix Options for Dynamic Host Configuration Protocol (DHCP) version6
RFC3646
DNS Configuration options for Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
RFC3736
Stateless Dynamic Host Configuration Protocol (DHCP) Service for IPv6
RFC6221
Lightweight DHCPv6 Relay Agent
RFC2131
Dynamic Host Configuration Protocol
RFC2131
DHCP Options and BOOTP Vendor Extensions
RFC3406
DHCP Relay Agent Information Option