I. Function overview
The main function of DHCP (Dynamic Host Configuration Protocol) is to centrally manage and assign IP addresses, so that hosts in the network environment can dynamically obtain IP address, Gateway address, DNS server address and other information, and improve the utilization rate of addresses.
DHCP protocol adopts the client/server model: When the DHCP server receives the address application information from the network host, it will send the relevant address configuration information to the network host to realize the dynamic configuration of the network host address information.
Ii. Working principle
DHCP USES UDP as the transport protocol. The host sends the request message to port 67 of DHCP server, and the DHCP server responds the reply message to port 68 of the host. The detailed interaction is as follows.
(1) DHCP Client sends DHCP Discover message by broadcasting.
- (2) all DHCP servers can receive DHCP Discover message sent by the DHCP Client, and all DHCP servers will give a response and send a DHCP Offer message to the DHCP Client. (3) The “Your(Client) IP Address” field in the DHCP Offer packet is the IP Address that DHCP Server can provide to THE DHCP Client, and DHCP Server will put its IP Address in the “Option” field so that DHCP Client can distinguish different DHCP servers. The DHCP Server will have a record of the assigned IP address after sending this message. (4) DHCP Client can only handle one DHCP Offer packet among them, and the general principle is that DHCP Client can handle the DHCP Offer packet that it receives first. (5) The DHCP Client will send a broadcast DHCP Request message, and add the IP address and the required IP address of the selected DHCP Server into the option field. (6) After the DHCP Server receives the DHCP Request message, it shall determine whether the IP address in the option field is the same as its own address. If it is not the same, DHCP Server does not do anything but clear the corresponding IP address assignment record; If the same is true, the DHCP Server will respond to the DHCP Client with a DHCP ACK packet and add the usage lease information for the IP address in the options field. (7) After the DHCP Client receives the DHCP ACK packet, it shall check whether the IP address assigned by the DHCP Server can be used. If it can be used, then the DHCP Client successfully obtains the IP address and automatically starts the renewal process by using the lease term according to the IP address; If the DHCP Client finds that the assigned IP address has been used, the DHCP Client will send the DHCP Decline message to the DHCPServer, notify the DHCPServer to disable this IP address, and then the DHCP Client will start the new address application process. (8) After the DHCP Client successfully obtains the IP address, it can Release its IP address at any time by sending THE DHCP Release message. After the DHCP Server receives the DHCP Release message, it will recover the corresponding IP address and reassigned it. 3. Experimental verification: After DHCP services are configured on servers and network devices (routers and switches), DHCP can generally be used as DHCP servers. In this experiment, routers were used to simulate the network topology, as shown in the figure below: In the diagram, routers were dhCP-server and switches were two-layer devices (switch ports connected to PC1-6 hosts were all in the default VLAN 1).
1. Before the configuration of dhcp-server is completed, PC1 is configured to DHCP to get the IP address, which is shown as follows:
The result shows “DHCP failed. APIPA is being used”, indicating that the IP address was not successfully obtained (generally a “169.254.0.0/16” segment address is displayed, indicating that the IP address was not obtained from the DHCP server).
2. Configure DHCP related information on the router:
(1) configure port IP as shown in the figure below:
(2) configure DHCP service as shown in the figure below:
3. At this point, verify the IP address acquisition above PC1:
As can be seen from the figure above, PC1 successfully obtained the CONFIGURATION information of IP address, gateway, DNS-Server, etc.
Reproduced in: https://blog.51cto.com/13401027/1977218
- Pxe-e51 “no DHCP or DHCP proxy offers received” error appears when PXE windows img under Linux client starts
- How to Configure DHCP for Multiple VLANs?
- Solutions to problems encountered when installing isc-dhcp-server on debian9.6
- The principle of deformable convolution
- RPC principle and related technologies used
- Principle and usage of feof ()
- Introduction to the principle of Mali tile based rendering
- Solution to the incomplete display of the principle icon number exported by smartpdf in Ad
- MQTT Host name verification failure (SSL) [How to Solve]
- Login authority verification
- Processing method of eslint verification error
- Solve host key verification failed [valid]
- CSRF verification failed. Request aborted.
- Forbidden (403) CSRF verification failed. Request aborted. – Django
- PHP in Windows combined with bat batch processing to achieve multi process verification proxy server function
- Example of public key signature and verification generated with fabric case
- Using CV2 to solve sliding verification code
- Verification of your TeamViewer version failed
- Hash verification failed for CDH5.8.2 installation
- Realization of springboot authorization verification technology based on JWT