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
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
- How to Configure DHCP for Multiple VLANs?
- Event ID 407, 408 – when NAT is used as a DNS server
- Pxe-e51 “no DHCP or DHCP proxy offers received” error appears when PXE windows img under Linux client starts
- Program RPC 1726 error tracking
- Mount error (112): host is down
- Ubuntu network configuration+Fixing “Failed to bring up eth0” in Ubuntu
- How to Fix Session is not Connecting (How to Diagnose it)
- [FAILED] Failed to start Raise network interfaces
- Several ways to check the IP address of raspberry pie
- TNS-12545: Connect failed because target host or object does not exist
- PHP – PHP Error: Error while sending QUERY packet. PID=*
- JDBC connect to Sql Server to connect to the database–The TCP/IP connection to the host localhost, port 1433 has failed
- How to Fix java.net.ConnectException: Connection refused: connect
- solve java.net.ConnectException : Connection refused:connect report errors
- Solutions to problems encountered when installing isc-dhcp-server on debian9.6
- Putty prompt network error: software caused connection abort solution
- Solution to Oracle error 17002
- SSH write failed broken pipe
- openssl TXT_DB error number 2 failed to update database
- The solution of PL / SQL can’t connect to the remote server after installing Oracle locally