Dynamic Host Configuration Protocol DHCP

Source: Internet
Author: User
Tags domain name server

1. Introduction

To make protocol software generic and portable, protocol software writers will not fix all the details in the source code. Instead, they parameterized the protocol software. In this way, the same compiled binary code can be used on many computers. Many differences between one computer and another can be reflected by different parameters. Each parameter must be assigned a value before the protocol software runs.

The action assigned to these parameters in protocol software is called Protocol configuration. Projects that need to be configured for the software connecting to the Internet include:

① IP Address

② Subnet Mask

③ Default vro IP Address

④ (Local) Domain Name Server IP Address

2. DHCP

Assigning values to the preceding parameters manually is troublesome and error-prone. Therefore, Dynamic Host Configuration Protocol DHCP (Dynamic HostConfiguration Protocol) is used ).

DHCP uses the client-server mode. When a host requires an IP address, it wants the DHCP server to broadcast the DHCPDISCOVER packet. This is the client that the Host becomes DHCP. Broadcast discovery packets use restricted broadcast 255.255.255.255 because the host does not know where the DHCP server is, and the host does not have an IP address at this time, therefore, set the source IP address of the detected message to 0. After DHCP receives the detection message, the DHCP server first searches for the configuration information of the computer in its database. If no IP address is found, an IP address is allocated to the computer from the IP address pool (addresspool) of the server. The answer packet of the DHCP server is DHCPOFFER ).

However, we do not want to set up a DHCP server on every network, so there are too many DHCP servers. Therefore, each network has at least one DHCP relay proxy (usually a vro), which configures the IP address of the DHCP server, that is, it knows where the DHCP server to provide services for the network is. When the relay proxy receives the discovery packet sent by the host broadcast, the relay proxy forwards the packet to the DHCP server in Unicast mode and waits for the response. After receiving the DHCP packet, it is forwarded to the requesting host. For example:

The IP address assigned to the client by the DHCP server is temporary, which is called the lease period. The specific lease period is determined by the DHCP server, the inode packet sent by the DHCP server provides the lease value.

It should be noted that there may be more than one DHCP server that receives the found message. All DHCP servers that receive the found message will send the packet to the customer. The DHCP Client selects one from several provided packets, and send the request message (DHCPREQUEST) to the selected DHCP server ).

Then the selected DHCP server sends a confirmation packet (DHCPACK ). The DHCP client can use the IP address at this time. At this time, the DHCP Client sets two timers. If the lease period is T, the two timers are T1 = 0.875 T and T2 = T, respectively.

If the time T1 expires, the DHCP client sends a request message requesting an update of the lease period. If the DHCP server agrees, the request message is sent, and the timer is reset. If the DHCP server does not agree, then, a denial packet (DHCPNACK) is sent. At this time, the DHCP Client must immediately stop using the original IP address and apply for a new IP address.

If DHCP does not respond to the request message when the lease period is over half, when the second timer arrives, the DHCP server must send a request message to update the lease period.

Of course, DHCP customers can terminate the lease period provided by the server at any time. In this case, they only need to send the release packet (DHCPRELESEASE) to the DHCP server.

Blog: http://blog.csdn.net/sicofield/article/details/9716293

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.