一、DHCP消息格式(详细可以看RFC2131文档,目前没找到中文),括号里面数字均以字节为单位
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| op (1) | htype (1) | hlen (1) | hops (1) |
+---------------+---------------+---------------+---------------+
| xid (4) |
+-------------------------------+-------------------------------+
| secs (2) | flags (2) |
+-------------------------------+-------------------------------+
| ciaddr (4) |
+---------------------------------------------------------------+
| yiaddr (4) |
+---------------------------------------------------------------+
| siaddr (4) |
+---------------------------------------------------------------+
| giaddr (4) |
+---------------------------------------------------------------+
| |
| chaddr (16) |
| |
| |
+---------------------------------------------------------------+
| |
| sname (64) |
+---------------------------------------------------------------+
| |
| file (128) |
+---------------------------------------------------------------+
| |
| options (variable) |
+---------------------------------------------------------------+
(1) op 1 Message op code / message type. (OP 1:消息类型(占一个字节))
1 = BOOTREQUEST, 2 = BOOTREPLY
(2) htype 1 Hardware address type, see ARP section in "Assigned
Numbers" RFC; e.g., '1' = 10mb ethernet.
htype 1:硬件地址类型,更多可以看ARP的RFC文档,1代表10M以太网
(3) hlen 1 Hardware address length (e.g. '6' for 10mb
ethernet).
hlen 1:硬件地址长度,6表示10M以太网
(4) hops 1 Client sets to zero, optionally used by relay agents
when booting via a relay agent.
hops 1:通常都设为0,中继代理可以选择性地对它进行设置
(5) xid 4 Transaction ID, a random number chosen by the
client, used by the client and server to associate
messages and responses between a client and a
server.
xid 4:会话ID,客户端用的一个随机数,用于客户端与服务器端的信息交互
(5) secs 2 Filled in by client, seconds elapsed since client
began address acquisition or renewal process.
(6) flags 2 Flags (see figure 2).
(7) ciaddr 4 Client IP address; only filled in if client is in
BOUND, RENEW or REBINDING state and can respond
to ARP requests.
ciaddr 4:客户端IP地址
(8) yiaddr 4 'your' (client) IP address.
(9) siaddr 4 IP address of next server to use in bootstrap;
returned in DHCPOFFER, DHCPACK by server.
siaddr 4 :下一个DHCP服务器
(10) giaddr 4 Relay agent IP address, used in booting via a
relay agent.
giaddr 4 :代理IP地址
(11) chaddr 16 Client hardware address.
(12) sname 64 Optional server host name, null terminated string.
(13) file 128 Boot file name, null terminated string; "generic"
name or null in DHCPDISCOVER, fully qualified
directory-path name in DHCPOFFER.
(14) options var Optional parameters field. See the options
documents for a list of defined options.
阅读(1744) | 评论(0) | 转发(0) |