"Computer network" DHCP: Dynamic Host Configuration Protocol

Source: Internet
Author: User
Tags failover

DHCP (Dynamic Host Configuration Protocol) is a LAN protocol that uses UDP to work with two main purposes: assigning an IP address to an internal network or network service provider automatically, For users or internal network administrators as a means of central management of all computers, in RFC 2131 is described in detail. DHCP has 3 ports, where UDP67 and UDP68 are normal DHCP service ports, respectively, as service ports for DHCP server and DHCP client, and port No. 546 for DHCPV6 client instead of DHCPV4, which is for DHCP Failover service, which is a service that needs to be opened specifically, the DHCP failover is used to do "hot standby for two machines".

DHCP (Dynamic Host Configuration Protocol) is commonly used in large local network environment, the main role is centralized management, assigning IP address, so that the host in the network environment to obtain the dynamic IP address, The gateway address (the default gateway) and the local DNS server address , and can increase the utilization of the address. The DHCP protocol adopts the client/server model , and the dynamic assignment task of host address is driven by the network host. When the DHCP server receives the information from the network host request address, it sends the related address configuration information to the network host to realize the dynamic configuration of the network host address information.

  

The DHCP work process is mainly divided into the following steps:

1. The first task of the newly arrived host is to discover a DHCP server to interact with. This is done through the DHCP discovery message (DHCP discover message), where the client sends the discovery message to port 67 in the UDP packet. But who does this data give? The host does not even know the IP address of the network it is linked to, let alone the DHCP server address for that network. In this case, the DHCP client generates an IP datagram containing the DHCP discovery message, which uses the broadcast destination address 255.255.255.255 and uses the "this host" source address 0.0.0.0. The DHCP client passes the IP packet to the link layer, and the link layer broadcasts the frame to all the subnets that are associated with that subnet.

2. When the DHCP server receives a DHCP discovery message, it responds to the client with a DHCP delivery message (DHCP offer message) and still uses the IP broadcast address 255.255.255.255. Why use a broadcast address? Because there may be more than one DHCP server in the subnet, these DHCP servers emit a DHCP reply to the Thermos. The client selects only one of the DHCP server's reply messages, which is usually the first one to arrive.

3. The client chooses one from one or more servers and responds to the selected server with a DHCP request message (DHCP requests message), and the DHCP client issues a broadcast DHCP request message, which in the option field is added to the selected DHCP The IP address of the server and the IP address required.

4. After the DHCP server receives the DHCP request message, it determines whether the IP address in the Options field is the same as its own address. If not, DHCP server does not do any processing to clear only the corresponding IP address assignment records, and if the same, DHCP server responds to a DHCP ACK message to the DHCP client and adds the use lease information for the IP address in the option field.

5. After the DHCP client receives the DHCP ACK message, check that the IP address assigned by the DHCP server is available. If it is available, the DHCP client successfully obtains an IP address and automatically initiates the renewal process based on the IP address using the lease; If the DHCP client discovers that the assigned IP address is already in use, the DHCP client sends a DHCP decline message to the DHCPServer , notify DHCP server to disable this IP address, and then DHCP client to start the new address application process.

6. After the DHCP client obtains the IP address successfully, it can release its IP address at any time by sending the DHCP release message, and the DHCP server will reclaim the corresponding IP address and redistribute it after receiving the DHCP release message.

When using leases for more than 50% hours, the DHCP client sends a DHCPREQUEST message to the DHCP server in unicast form to renew the IP address. If the DHCP client successfully receives a DHCP ACK message sent by DHCP server, the IP address lease is extended at the appropriate time, and the DHCP client continues to use this IP address if it does not receive a DHCP ACK message sent by DHCP server. When using leases for more than 87.5% hours, the DHCP client sends a DHCPREQUEST message to DHCP server to renew the IP address in broadcast form. If the DHCP client successfully receives a DHCP ACK message sent by DHCP server, the IP address lease is extended at the appropriate time, and the DHCP client continues to use this IP address if it does not receive a DHCP ACK message sent by DHCP server.   Until the IP address usage lease expires, the DHCP client sends a DHCP release message to the DHCP server to release the IP address and start the new IP address application process. It should be noted that the DHCP client can receive DHCPOFFER packets from multiple DHCP servers, and then may accept any one of the dhcpoffer packets, but the client usually only accepts the first DHCPOFFER packet received.   In addition, the address specified in the DHCP server dhcpoffer [1] is not necessarily the final assigned address, and typically the DHCP server retains that address until the client makes a formal request.   Formally requests that the DHCP server assign address DHCPREQUEST the broadcast packet, so that all other DHCP servers that send DHCPOFFER packets will be able to receive the packet, and then release the IP address that has been offered (pre-allocated) to the client. If the address sent to the DHCP client is already in use by another DHCP client, the client sends a DHCPDECLINE packet to the server to refuse to accept the assigned address information. During the negotiation process, if the address information in the request message sent by the DHCP client is incorrect, such as if the client has migrated to a new subnet or the lease has expired, the DHCP server sends a DHCPNAK message to the DHCP client, which causes the client to re-initiate the address request process.

  

Resources:

1. Http://baike.baidu.com/item/DHCP

2. "Computer network-top-down approach"

"Computer network" DHCP: Dynamic Host Configuration Protocol

Related Article

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.