Learn about DHCP server configuration Basics

Source: Internet
Author: User

In the networking configuration, We need to configure multiple Server protocols. Here we will focus on the DHCP protocol and related content of the DHCP server. For TCP/IP networks, basic network configurations, such as IP addresses, subnet masks, default gateways, and DNS, must be configured for each workstation to be interconnected with other computers. For a small network, it may be acceptable to configure this attribute for each computer. However, for a network with hundreds or thousands of machines, this part of work is simple, however, when the workload is quite large, the network administrator may not have time and energy to configure so many computers one by one. In this case, we usually use DHCP to automatically assign IP addresses to clients.

DHCP stands for the Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol). It aims to reduce the planning, management, and maintenance workload of TCP/IP networks, address the lack of IP address space because after this configuration, only the user who actually connects to the IP address is allocated at each time to reduce the occupation of the IP address ).

DHCP is divided into two parts: one is the server side and the other is the client side. All IP network configuration information is centrally managed by the DHCP server and is responsible for handling the DHCP requirements of the client. The client uses the IP Environment Information allocated from the server. DHCP uses the "lease" concept to efficiently and dynamically allocate TCP/IP settings for clients.

Dhcp ip Address Allocation Method

For IP Address allocation through DHCP, at least one DHCP server must work on the network. It listens to all DHCP requests on the network and negotiates the TCP/IP setting environment with the client. It provides two IP address locating methods:

Automatic Allocation of Automatic Allocation)

The allocation method is as follows: Once the DHCP Client successfully rents the IP address from the DHCP server for the first time, it will always use this address.

Dynamic Allocation)

The allocation method is: after DHCP is rented from the HDCP server for the first time to the IP address, it is not permanently used. As long as the lease term expires, the client must release the release IP address, for other workstations. Of course, the client can take precedence over other hosts to continue the lease or lease other IP addresses.

Dynamic Allocation is obviously more flexible than automatic allocation, especially when your actual IP address is insufficient. For example, an ISP can only provide 1000 IP addresses for access users, but it does not mean that you can only have a maximum of 1000 customers, because your customers are basically not likely to access the Internet at the same time. In this way, you can lease the 1000 addresses to the connected customers in turn, so that the number of customers you allow is greatly more than 1000. The same is true for enterprise lan. For example, although some departments have a large number of users, a small part of them usually access the Internet, such as the marketing department ), DHCP can be used for automatic allocation when the IP address is insufficient, which can save a lot of IP Address resources.

In addition to setting IP addresses dynamically, DHCP can also retain some IP addresses for some machines for special purposes, that is, static IP addresses of some clients can also be set dynamically. It is usually bound with the host Nic's physical address MAC address, which gives you a larger design space. DHCP can also help clients specify attributes such as router, netmask, DNS Server, and WINS Server. In this way, in addition to the DHCP option, there is almost no need to set any other IP environment, which greatly improves the setting efficiency and reduces the workload.

The role of the DHCP protocol can be explained in the following three aspects:

Centralized management of TCP/IP subnet. The IP addresses of all clients and their configuration parameters are stored in the central database of the DHCP server.

Automatically allocates and configures TCP/IP IP addresses for clients. When the customer's computer starts and accesses the network for the first time, it is automatically assigned an IP address, subnet mask, default gateway, and WINS Server IP address. When the client moves between subnets, such as hosts, the initial IP address and related configuration information are released back to the initial available IP address pool, the customer re-allocates the new IP address and related configuration information when the system starts.

Unused IP addresses are returned to the available IP address pool to improve IP address usage efficiency. Generally, the IP addresses are statically allocated by the Administrator and stored on a piece of paper or in a local database, however, when a customer moves or assigns multiple new IP addresses without modifying the IP address table column, the table often becomes expired. This also means that some IP addresses will be lost and cannot be reused. DHCP uses a time-based mechanism called Lease Term Lease to facilitate regular updates. If the lease term is full but the customer does not update its IP address, the IP address is returned to the available IP address pool.

The automatic IP Address Allocation Process of DHCP usually goes through the following phases:

Initial Stage

When starting a customer's TCP/IP group, because each machine in the IP network needs an address, the TCP/IP group is bound with address 0.0.0.0. Then it sends a DHCP Discover packet to its local subnet. This information packet is sent to UDP port 67, that is, the broadcast information packet of the DHCP/BOOTP server port.

Discovery phase

That is, the DHCP client is looking for a DHCP server. The DHCP Client sends DHCP discover discovery information to find the DHCP server in broadcast mode because the IP address of the DHCP server is unknown to the client. That is, it sends specific broadcast information to the IP address 255.255.255.255. Each host installed with the TCP/IP protocol on the network will receive this broadcast information, but only the DHCP server will respond.

Provision stage

Each DHCP server in the local subnet receives a DHCP Discover packet. Each DHCP server that receives the request checks whether it has a valid idle address for the requesting customer. It then responds with the DHCP Offer information package, which includes valid IP addresses, subnet masks, IP addresses of DHCP servers, lease term, and other detailed configurations related to DHCP ranges. All servers that send DHCP Offer packets retain the IP addresses they provide. The address cannot be assigned to other customers until it is no longer retained. DHCP Offer information broadcast is sent to UDP port 68, that is, DHCP/BOOTP client port. It must be sent in broadcast mode because the customer does not have an IP address that can be directly addressed.

Select stage

That is, the DHCP Client selects the IP address provided by a DHCP server. If Multiple DHCP servers provide information to DHCP offer, the DHCP client accepts only the information provided by the first DHCP offer, then, it answers a DHCP request information in broadcast mode, which contains the content that requests IP addresses from the selected DHCP server. The answer is broadcast to notify all DHCP servers that they will select the IP address provided by a DHCP server.

Validation phase

That is, the DHCP server confirms the stage of the provided IP address. The customer usually responds to the first proposal and sends a DHCP Request packet as a response in broadcast mode. This information package tells the server "yes, I want you to provide services to me. I receive the lease term you have given me ". In addition, once the packet is broadcast, all DHCP servers on the network can view the packet, DHCP servers that are not recognized by the customer propose to return the reserved IP address to the available address pool. You can also use DHCP Request to ask other configuration options of the server, such as DNS or gateway address.

Logon again

In the future, each time a DHCP client logs on to the network again, it does not need to send the DHCP discover discovery information, but directly sends the DHCP request information containing the previous IP address. When the DHCP server receives this information, it will attempt to allow the DHCP client to continue using the original IP address and answer a DHCP ack confirmation message. If the IP address cannot be assigned to the original DHCP client, then the DHCP server returns a DHCP nack denial message to the DHCP client. When the original DHCP client receives the DHCP nack denied information, it must resend the DHCP discover information to request a new IP address.

Update lease phase

When the customer notices that the lease period has reached more than 50%, the lease period will be updated. At this time, it sends a direct UDP packet to the server that obtains its original information. This information package is a DHCP Request information package used to ask whether TCP/IP configuration information can be maintained and update its lease period. If the server is available, it usually sends a DHCP Acknowledge information package to the customer to agree to the customer's request.

Rebind phase

When the lease period reaches nearly 87.5% of the expiration time, if the customer fails to update the lease period in the previous request, he will attempt to update the lease period again. If this update fails, the client tries to contact any DHCP server to obtain a valid IP address. If another DHCP server can assign a new IP address, the client enters the binding status again. If the current IP address of the client expires, the client must discard the IP address and re-enter the initialization status. Then, repeat the entire process.

Note: The DHCP Service can be configured not only on the host, but also on devices such as routers. The most common service is the Broadband Router, through its DHCP service, the client can also provide automatic IP Address Allocation, reducing the burden on the server host.

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.