FreeBSD DHCP work process

Source: Internet
Author: User

Set DHCP

Dynamically host Configuration Protocol (Dynamic host Configuration PROTOCOL,DHCP) is a protocol used to centrally assign IP addresses and IP address-related information to multiple client computers so that the IP address and TCP/IP settings can be managed uniformly. and avoid unnecessary address conflicts, so often used in the network management of many dos/windows computers, saving the network administrator to manually set up and address the problem.

In addition to being able to facilitate management, DHCP can achieve the goal of saving IP addresses slightly. Suppose there are 50 computers in the network, but only 40 IP addresses, but these 50 computers will not start at the same time, the IP address should meet the requirements. If you use static IP address settings, or you will encounter the difficulty of assigning addresses, because the use of computers is random, no matter how the allocation of addresses can not avoid conflict phenomenon, and the use of DHCP can avoid this problem. DHCP can also be used to unify other IP settings, such as default routing, DNS servers, and so on, which can reduce the administrative tasks of a large network.

DHCP was developed from the original BOOTP protocol, the original purpose of which is to assign IP addresses to diskless workstations, and more currently for centralized management of IP addresses. However, the DHCP protocol has its drawbacks, for example, a DHCP client computer does not have a fixed IP address, and the frequently changing IP address is not appropriate for servers that provide network services. and the current DNS protocol does not collaborate with DHCP to provide a direct host name resolution task for DHCP clients.

The working process of DHCP

When DHCP works, the client and server are required to interact, and the client initiates a request for an IP address from the server by broadcast, and the server assigns an IP address and other TCP/IP settings information. The entire process can be divided into the following steps:

IP address Lease Request: When TCP/IP for a DHCP client is first started, the DHCP client is executed for TCP/IP settings. Since TCP/IP is not set up at this time, the DHCP Request packet can only be sent by radio, broadcast packets are sent using UDP ports 67 and 68, and broadcast information includes the hardware address and computer name of the client's network interface to provide the DHCP server for allocation.

IP address Lease offers: When a DHCP client is received broadcast information, all DHCP servers assign the client a suitable IP address, which is sent back to the DHCP client by the hardware address provided by the DHCP client, such as IP addresses, netmask, lease time, and so on. There is no limit to the client computer for the DHCP server during this process, so the client can receive multiple IP addresses to provide information.

IP address Lease Selection: Because the client receives multiple IP addresses sent by multiple servers to provide information, the client selects an IP address and rejects the other provided IP address so that these addresses can be assigned to other customers. The client sends the selected lease information to the server to which it chooses.

IP address Lease Confirmation: The server will receive the customer's choice of information, if there is no exception, will respond to a confirmation message, this IP address is really assigned to this client. The client can use this IP address and related TCP/IP data to set up its own TCP/IP stack.

Update Lease: In DHCP, each IP address has a certain lease period, if the lease period has arrived, the DHCP server can reassign this IP address to other computers. Therefore, each client computer should continue to lease its leased IP address in advance, and the server will respond to the client's request and update the client's lease settings. Once the server returns information that cannot be renewed, the DHCP client can only discard the original IP address when the lease arrives and reapply for a new IP address. In order to avoid problems, the renewal will start when the lease reaches 50%, and the renewal request process will continue if it is not successful.

Free IP address lease: Client can voluntarily release their IP address request, also can not release, but also does not renew the lease, waits for the lease expiration to release the occupied IP Address resource.

Because DHCP relies on broadcast information, it is common for clients and servers to be within the same network. However, you can set up routers in your network to forward BOOTP broadcast packets so that servers and clients can be located on two different networks. However, configuring forwarding broadcast information is not a good solution, a better way to use a DHCP relay computer, where the DHCP relay computer and the DHCP client are located on the same network, back and forth to the client's lease request, but it does not maintain DHCP data and have IP address resources. It simply forwards the request over TCP/IP to a DHCP server located on another network for actual IP address assignment and acknowledgement.

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.