In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of the working principle of DHCP under Linux, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on the working principle of DHCP under Linux. Let's take a look at it.
DHCP principle DHCP lease quadrilogy
A: the client makes an IP request
When a DHCP client starts, it automatically configures its IP address to 0.0.0.0, and since it cannot communicate properly using 0.0.0.0, the client must obtain a legitimate address through the DHCP server. Because the client does not know the IP address of the DHCP server, it uses the address of 0.0.0.0 as the source address, the UDP68 port as the source port, 255.255.255.255 as the destination address, and the UDP67 port as the destination port to broadcast the request IP address information. The broadcast message contains the MAC address and computer name of the DHCP client so that the DHCP server can determine which client sent the request.
B: server response
When the DHCP server receives the information that the client requests an IP address, it looks in its own IP address pool to see if there is a legitimate IP address provided to the client. If so, the DHCP server marks the IP address and adds it to the DHCPOFFER message, and the DHCP server broadcasts a DHCPOFFER message that includes the following information: the MAC address of the DHCP client; the legal IP address provided by the DHCP server; the subnet mask; the default gateway (routing); the duration of the lease; and the IP address of the DHCP server. Because the DHCP client does not have an IP address, the DHCP server uses its own IP address as the source address, the UDP67 port as the source port, 255.255.255.255 as the destination address, and the UDP68 port as the destination port to broadcast DHCPOFFER information.
C: client chooses IP
The DHCP client selects the IP address from the first DHCPOFFER message received, and the DHCP server that issued the IP address retains the address so that the address cannot be provided to another DHCP client. The third process of the DHCP lease occurs when the client receives the DHCPOFFER from the first DHCP server and selects the IP address. The client broadcasts the DHCPREQUEST message to all DHCP servers, indicating that it accepts the content provided. The DHCPREQUEST message includes the service identifier (IP address) of the server that provided the IP configuration for the client. The DHCP server looks at the server identifier field to determine whether it has been selected to provide the specified client with an IP address, and if those DHCPOFFER are rejected, the DHCP server cancels the provision and retains its IP address for the next IP lease request.
In the process of selecting IP by the client, although the client has chosen the IP address, it has not yet configured the IP address, and there may be several DHCP servers in a network, so the client still uses the address of 0.0.0.0 as the source address, the UDP68 port as the source port, the 255.255.255.255 as the destination address, and the UDP67 port as the destination port to broadcast DHCPREQUEST information.
D: the server confirms the lease
After receiving the DHCPREQUEST message, the DHCP server broadcasts the successful confirmation to the client in the form of an DHCPACK message containing a valid lease for the IP address and other possible configuration information. Although the server has confirmed the lease request from the client, the client has not received the DHCPACK message from the server, so the server still uses its own IP address as the source address, the UDP67 port as the source port, 255.255.255.255 as the destination address, and the UDP68 port as the destination port to broadcast DHCPACK information. When the client receives the DHCPACK message, it configures the IP address and finishes initializing the TCP/IP.
Server confirmation lease: DHCPNACK (DHCPNAK)
If the DHCPREQUEST is not successful, for example, if the client tries to lease the previous IP address, but the IP address is no longer available, or if the IP is invalid because the client has moved to another subnet, the DHCP server will broadcast the negative confirmation message DHCPNACK. When the client receives an unsuccessful confirmation, it will restart the DHCP lease process.
DHCP lease renewal
DHCP customers send DHCPREQUEST message packets directly to the DHCP server that provides them with an IP address at the end of the 50% lease. If the client receives the DHCPACK message packet responded by the server, the client updates its configuration according to the new lease period and other updated TCP/IP parameters provided in the package, and the IP lease update is completed. If no reply is received from the server, the client continues to use the existing IP address because there is still 50% left in the current lease.
If it is not updated during the past 50% of the lease, the DHCP client will contact the DHCP server that provided it with the IP address again after 75% of the lease. If it is not successful, by 100% of the lease, the DHCP client must give up the IP address and reapply. If no DHCP server is available at this time, the DHCP client will use a random address in 169.254.0.0swap 16 and try again every 5 minutes.
This is the end of the article on "how does DHCP work under Linux?" Thank you for reading! I believe you all have a certain understanding of "what is the working principle of DHCP under Linux". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.