Brief Analysis of DHCP Protocol

  • I recommend this article. The principle and packet capture are well analyzed:

https://blog.csdn.net/andy_93/article/details/78238931

Insert picture description here

  • The brief steps are as follows:

1. DHCP_Client sends to DHCP_Server: DHCP DISCOVER (broadcast packet)
  When the DHCP client is turned on, it will broadcast to find the DHCP server. Since the client does not know which network it belongs to at this time, the source address of the packet will be 0.0.0.0, and the destination address will be 255.255.255.255, and then the packet information of DHCP discover will be attached.

2. DHCP_Server sends to DHCP_Client: DHCP OFFER (Assign IP information)
  When the DHCP server listens to the DHCP Discover broadcast sent by the client, it will assign an IP address from its own IP pool, plus the client's hardware address (MAC) , XID number (used for identification) and other information, encapsulated as a DHCP OFFER packet, and sent to the client.

3. DHCP_Client sends to DHCP_Server: DHCP REQUEST (request to use a specific IP) (broadcast packet)
  If the client receives DHCP OFFER packets from multiple servers, it will select the first received packet information, and then broadcast it. Sending a DHCP REQUEST is equivalent to broadcasting to all servers: I have accepted the packet from this server. The other rejected servers will not continue to establish connections.

4. DHCP_Server sends to DHCP_Client: DHCP ACK (Assignment Acknowledgement)
  When the DHCP server receives the DHCP Request information answered by the DHCP client, it sends a DHCP Ack containing the IP address and other settings it provides to the DHCP client. Confirm the information. To confirm the official validity of the IP address. Then the DHCP client binds its TCP/IP protocol with its own network card.

PS: If the DHCP server judges that the request packet in step 3 is illegal, it will revert to the DHCP NAK packet, so that steps 1 to 4 can be repeated immediately .

Guess you like

Origin blog.csdn.net/LIU944602965/article/details/108575923