Certainly! Here is the rewritten content:**DHCP Message Format**The DHCP message format is a specific structure used for sending and receiving messages between DHCP clients and servers. It defines how the data is organized and communicated within the DHCP protocol.

The above image shows the DHCP message format; let’s analyze it in detail.
op: Type of operation in the message. It is divided into request and response messages. 1: for request messages, 2 for response messages.
htype: Hardware address type of the DHCP client. 1 represents Ethernet.
hlen: Length of the DHCP client’s hardware address. Ethernet is 6.
hops: Number of DHCP relays the message passes through, defaulting to 0. Each time the message passes through a DHCP relay, this field increments by one.
xid: Random number generated by the client upon making a request.
secs: Time elapsed since the DHCP client initiated the DHCP request. Currently not in use, fixed at 0.
flags: Indicates whether the DHCP server response message is sent via unicast or broadcast. Only uses the 0th bit. 0 means unicast, 1 means broadcast. The remaining bits are reserved.
ciaddr: IP address of the DHCP client.
yiaddr: IP address assigned to the client by the DHCP server.
siaddr: IP address of the DHCP server.
giaddr: IP address of the first DHCP relay the client message passed through, which is also the gateway IP address.
chaddr: Hardware address of the DHCP client, also known as the MAC address.
sname: Name of the server.
file: Name and path information of the boot configuration file assigned by the DHCP server to the DHCP client.
options: Optional variable-length field, includes the type of message, valid lease time, IP address of the DNS server, etc.
(2) Capturing DHCP Message Data
Since DHCP only renegotiates an IP address when the host’s IP address expires or the system restarts, to capture a DHCP data message, you must restart the network card to obtain the DHCP message.
Execute the following command while running to release current information.

Once the above command is executed, the current address information will be released.
To reacquire the address information, execute the command below:

Of course, remember to enable Wireshark’s data filtering feature when performing the operations above.

(3) Analyzing the DHCP Discover Packet, corresponding to frame 94, the Info section clearly displays: DHCP Discover.

From the image above, you can see that the client currently has no IP address, and the discovery phase is sent as a broadcast packet. This means that all DHCP servers on the network can receive this data packet.
You might be unclear about the value of the following Option field; let’s look at the values of the option field.

(4) Analyzing the DHCP Offer Phase Data, corresponding to frame 99.

In the discovery phase, we analyzed the detailed request information of the Option. Naturally, in the offer phase, we need to analyze the configuration information assigned by the server to the DHCP client.

At this point, the DHCP client has already received the data packet from the DHCP server. Of course, if there are multiple DHCP servers, you must respond to confirm which DHCP server to use.
(5) Analyzing the DHCP Selection Phase, where the DHCP server must respond accordingly to the DHCP server offering its IP, corresponding data frame is frame 100.

(6) DHCP Acknowledgment Phase (corresponding to analysis of frame 101)

From the above image, you can see that the server assigned the IP address 192.168.1.100 to the client. For detailed information about the IP address assigned by the server to the client, a detailed analysis of the option field is needed.

Above are the four stages of DHCP.