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
|OpCode||Identifies whether the packet is a request or a response.|
|hardware type||Specifies the type of hardware address.|
|hardware length||Specifies the hardware address length.|
|hop||Set to 0 by the client and incremented each time a request goes through the router.|
|transaction ID||A random number chosen by the client. All DHCP messages have the same xid.|
|seconds||Sets the number of seconds that have passed since the DHCP process was started.|
|flag||Specifies whether the message is broadcast or unicast.|
|Only used when the client knows its own IP address, like the Bound, Renew, and Rebinding states.|
|If the client IP address is 0.0.0.0, the DHCP server sets this field to the offered client 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.|
|Gateway IP address, set by DHCP/BOOTP relay agent.|
|DHCP client MAC address.|
|server name||Optional server host name.|
|boot file name||Bootfile name.|
|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.