Schematic 4-step lease process for DHCP

Source: Internet
Author: User

schematic 4-step lease process for DHCPThe DHCP lease process is the process by which the DHCP client obtains the IP address dynamically. The DHCP lease process is divided into 4 steps: ① client requests IP (client sends DHCPDISCOVER broadcast packet); ② Server response (server sends DHCPOFFER broadcast packet); ③ client selects IP (client sends DHCPREQUEST broadcast packet);The ④ Server determines the lease (the server sends the Dhcpack/dhcpnak broadcast packet). detailed 4-Step lease process:1th Step: Client Request IPThe client request IP is also known as DHCPDiscover. When a DHCP client is started, its IP address is automatically configured to 0.0.0.0, because the use of 0.0.0.0 cannot communicate normally, so the client must pass the DHCP server to obtain a legitimate address. Because the client does not know the IP address of the DHCP server, it Use the 0.0.0.0 address as the source address, use the UDP68 port as the source port, use the 255.255.255.255 as the destination address, and use the UDP67 port as the destination port to broadcast the request IP address information (see figure I). The broadcast information contains the MAC address and computer name of the DHCP client so that the DHCP server can determine which client sent the request. The DHCP client always tries to re-lease the last IP address it has received, which brings some stability to the network. Figure one: Client request IP 2nd Step: Server ResponseThe server response is also known as Dhcpoffer. When the DHCP server receives information from the client requesting the IP address, it looks in its own IP address pool for a legitimate IP address to provide to the client. If so, the DHCP server marks the IP address and joins it in the DHCPOFFER message, and the DHCP server broadcasts a DHCPOFFER message that includes the following information:the MAC address of the DHCP client, the legitimate IP address provided by the DHCP server, the subnet mask, the default gateway (route), the duration of the lease, and the IP address of the DHCP server. because the DHCP client does not yet have an IP address, the DHCP server uses its own IP address as the source address, using the UDP67 port as the source port. Using 255.255.255.255 as the destination address, use the UDP68 port as the destination port to broadcast Dhcpoffer information (see figure II). Figure two: server response3rd Step: Client Select IPthe client chooses IP, also known as DHCPRequest. 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 is not available to another DHCP client. The third process of a DHCP lease occurs when a client receives dhcpoffer from the first DHCP server and chooses an IP address. The client broadcasts the DHCPREQUEST message to all DHCP servers, indicating that it accepts the provided content. The DHCPREQUEST message includes the service identifier (IP address) of the server that provides the IP configuration for the client. The DHCP server looks at the server identifier field to determine whether it is selected to provide an IP address for the specified client, and if those dhcpoffer are rejected, the DHCP server cancels the supply and retains its IP address for the next IP lease request. While the client chooses IP, the client chooses an IP address, but there is no IP address configured, and there may be several DHCP servers in a network, so The client still uses the 0.0.0.0 address as the source address, uses the UDP68 port as the source port, uses the 255.255.255.255 as the destination address, and uses the UDP67 port as the destination port to broadcast the DHCPREQUEST information (see figure III). Figure three: Client Select IP4th step: The server confirms the leasethe server confirms the lease, also known as Dhcpack/dhcpnak. after the DHCP server receives the DHCPREQUEST message, it broadcasts a successful acknowledgment to the client as a DHCPACK message that contains a valid lease with an IP address and other potentially configured information. Although the server confirms the client's lease request, but the client has not yet received the server's DHCPAck message, the server still uses its own IP address as the source address, using the UDP67 port as the source port. Using 255.255.255.255 as the destination address, use the UDP68 port as the destination port to broadcast DHCPAck information (see figure IV). when the client receives the DHCPACK message, it configures the IP address and completes the initialization of TCP/IP. if the dhcprequest is unsuccessful, such as when the client attempts to lease the previous IP address, but the IP address is no longer available, or because the client is moved to a different subnet, the IP server broadcasts a negative acknowledgment message Dhcpnak when it is invalid. When the client receives an unsuccessful acknowledgment, it restarts the DHCP lease process. If the DHCP client cannot find the DHCP server, it will be tcp/from the IP Class B segment 169.254.0.0 pick an IP address as its own IP address, continue to try to communicate with the DHCP server every 5 minutes, once contacted with the DHCP server, the client abandons the auto-configured IP address, and uses the IP address assigned by the DHCP server. If a DHCP client has two or more network cards, the DHCP server assigns each NIC a unique and valid IP address. Figure IV: Server Confirmation leaseFigure V: DHCP server logsNote: Because it is a virtual machine, there are some problems with the system time of this DHCP serverFigure VI: DHCP client IP informationyou can see that the IP address that the client obtains is 192.168.1.34; The default gateway is the 192.168.1.10;DHCP server IP is 192.168.1.240; the lease time is 6 hours. DHCP message type
1 DHCPDISCOVER
2 DHCPOFFER
3 DHCPREQUEST
4 DHCPDecline
5 DHCPACK
6 Dhcpnack
7 Dhcprelease
8 DHCPInform

Schematic 4-step lease process for DHCP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.