DHCP protocol

The DHCP protocol uses UDP as the transmission protocol, the DHCP server uses port 67, and the DHCP client uses port 68 to receive the response message from the DHCP server.
1. The DHCP Client sends a DHCP Discover message by broadcasting.
2. All DHCP Servers can receive the DHCP Discover message sent from the DHCP Client, and all DHCP Servers will respond and send a DHCP Offer message to the DHCP Client.

3. The "Your(Client) IP Address" field in the DHCP Offer message is the IP address that the DHCP Server can provide to the DHCP Client, and the DHCP Server will put its own IP address in the "option" field so that the DHCP Client can distinguish different DHCP Server. After the DHCP Server sends this message, there will be a record of the assigned IP address.

4. The DHCP Client can only process one of the DHCP Offer messages. The general principle is that the DHCP Client processes the DHCP Offer message received first.

The DHCP Client will send a broadcast DHCP Request message, and the IP address of the selected DHCP Server and the required IP address will be added to the option field.
5. After the DHCP Server receives the DHCP Request message, it determines whether the IP address in the option field is the same as its own. If they are not the same, the DHCP Server will not do any processing and only clear the corresponding IP address allocation records; if they are the same, the DHCP Server will respond to the DHCP Client with a DHCP ACK message and add the IP address lease information in the option field.

6. After the DHCP Client receives the DHCP ACK message, it checks whether the IP address assigned by the DHCP Server can be used. If it can be used, the DHCP Client successfully obtains an IP address and automatically starts the renewal process according to the IP address usage lease; The DHCP Server disables this IP address, and then the DHCP Client starts a new address application process
7. After the DHCP Client successfully obtains an IP address, it can release its own IP address at any time by sending a DHCP Release message. After the DHCP Server receives the DHCP Release message, it will reclaim the corresponding IP address and reassign it.

https://www.nowcoder.com/questionTerminal/4213a080d42f4ad384b86503076f2158?orderByHotValue=1&page=1&onlyReference=false

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325822079&siteId=291194637