BOOTP/DHCP message format
BOOTP/DHCP message format
Here, I will explain the message format of DHCP. Since DHCP is upward compatible with BOOTP (Bootstrap), the structure of the messages has remained largely unchanged.
First, I will explain the BOOTP message format.
BOOTP and DHCP messages use almost the same format structure. Only the final field is different. BOOTP calls this optional field the “vendor specific area” and limits it to 64 bytes.
For DHCP, this field is of variable length and is called “options” and allows DHCP option information to be conveyed.
The figure below shows the BOOTP message format.
DHCP message format
DHCP is an extension of BOOTP, and the message format etc. are almost the same.
The diagram below shows the DHCP message format.
DHCP basic frame
The basic frame of a DHCP message is shown below.
The contents of each field in the DHCP message are as follows.
●Major items of DHCP message
field | Name | explanation |
op (1 byte) | OpCode | Identifies whether the packet is a request or a response. |
htype (1 byte) | hardware type | Specifies the type of hardware address. |
hlen (1 byte) | hardware length | Specifies the hardware address length. |
hops (bytes) | hop | Set to 0 by the client and incremented each time a request goes through the router. |
xid (4 bytes) | transaction ID | A random number chosen by the client. All DHCP messages have the same xid. |
secs (2 bytes) | seconds | Sets the number of seconds that have passed since the DHCP process was started. |
flags (2 bytes) | flag | Specifies whether the message is broadcast or unicast. |
ciaddr (4 bytes) | client IP address | Only used when the client knows its own IP address, like the Bound, Renew, and Rebinding states. |
yiaddr (4 bytes) | Destination IP address | If the client IP address is 0.0.0.0, the DHCP server sets this field to the offered client IP address. |
siaddr (4 bytes) | Server IP address | If the client knows the IP address of the DHCP server, set this field to the IP address of the DHCP server. Otherwise, it is used in DHCPOFFER, DHCPACK from the DHCP server. |
giaddr (4 bytes) | router IP address | Gateway IP address, set by DHCP/BOOTP relay agent. |
chaddr (16 bytes) | client MAC address | DHCP client MAC address. |
name (64 bytes) | server name | Optional server host name. |
file (bytes) | boot file name | Bootfile name. |
options (variable length) | Optional parameters | Optional parameters provided by the DHCP server. |
Huge fields like sname and file don’t make much sense in DHCP. This field is provided to defend its position as an extension of BOOTP.