Foreword

This chapter mainly introduces how to use DHCP technology to realize the automatic allocation of P addresses, and how to configure network DNS for clients through DHCP. It explains in detail the working principle, configuration and application of DHCP in enterprises. Mastering DHCP will be able to realize IP addresses for medium and large enterprises The automatic and intelligent management greatly reduces the management difficulty of P address resources and improves management efficiency.

Key points of this chapter
The working process of DHCP
Install and configure DIHCP service
Client configuration
1. Overview of DHCP
DHCP (Dynamic Host Coofiguration Protoool. Dynamic Host Configuration Protocol) is designed and developed by the Intermet work and living team, and is specially used to automatically assign TCP/IP parameters to computers in the TCP/P network.
The DHCP service not only avoids errors caused by manually setting IP addresses, but also avoids address conflicts caused by assigning one IP address to multiple workstations.
DHCP provides safe, reliable and simple TCP/IP network setup, reducing the burden of configuring IP addresses.

1. Benefits of DHCP service
Reduce administrator workload.
Avoid the possibility of input errors.
Avoid guard address conflicts.
When the network changes the P address segment, there is no need to reconfigure the IP address of each user.
The utilization rate of the P address is improved.
Convenient client configuration.
2. The working principle of DHCP
1. DHCP distribution method
In the working principle of DHCP, the DHCP server provides three IP address allocation methods

① Automatic distribution

After the DHCP client successfully obtains an IP address from the DHCP server for the first time, it will use this IP address permanently.

②Manual distribution

The P address is specially assigned by the DHCP server administrator.

③Dynamic allocation

Dynamic allocation means that after the DHCP client obtains the IP address from the DHCP server for the first time, it does not use the address permanently. Instead, after each use, the DHCP client will release the IP address for use by other clients.

2.DHCP lease process
The process that the client obtains the P address from the DHCP server is called the DHCP lease process, and the lease process is divided into four steps.

Request a P address for the client (the client sends a DHCP Discover broadcast packet)
The server responds (the server sends a DHCP Offer broadcast packet).
The client selects the P address (the client sends a DHiCP Pequest broadcast packet).
The server determines the lease (the server sends a DHCP ACX broadcast packet)

1. The client requests an IP address
When a DHCP client computer is started, the client computer does not have a P address, so the client computer needs to obtain a legal IP address through DHCP. At this point, the DHCP client sends DHCPDiscover discovery information in broadcast mode (because the P address of the DHCP server is unknown to the client) to find the DHCP server. The MAC address and computer name of the DHCP client are included in the broadcast information, so that the DHCP server can determine which client sends the request.

2. Server response
When the DHCP server receives information from a client requesting a P address, it searches its own P address pool to see if there is a legal IP address provided to the client. If so, the DHCP server will mark the IP address and add it to the DHCP Offer message, and then the DHCP server will broadcast a DHCP Offer message containing the following information.

MAC address of the DHCP client.
Legal P address provided by the DHCP server.
subnet mask.
Default gateway.
The term of the lease.
IP address of the DHCP server.

3. The client selects the IP address
The DHCP client extracts the IP address from the first DHCP Offer message received, and the DHCP server that issued the IP address reserves the address, so that the address cannot be assigned to another DHCP client.
After the client computer receives the DHCPOffer message from the first DHCP server and extracts the IP address, the client computer broadcasts the DHCP Request message to all DHCP servers, indicating that it accepts the offered content.
The DHCP Request message includes the service identifier (server P address) of the server that provides the IP configuration for the client. The DHCP server looks at the server identifier field to determine whether the offered P address is accepted.
If the DHCPOffer is rejected, the DHCP server cancels and reserves its IP address to provide for the next IP lease request.

4. The server determines the lease
After receiving the DHCP Request message, the DHCP server broadcasts a successful confirmation to the client in the form of a DHCP ACX message. Should
The message contains the effective lease of the P address and other configurable information. Although the server confirms the lease request of the client, the client
The client machine has not received the DHCP ACK message from the server. When the client receives a DHCP ACK message. It is configured with an IP address. Complete the initialization of TCP/P. As shown in Figure 1.6.

5. Log in again
Every time the DHCP client logs on to the network again, it does not need to send the DHCP Discover information, but directly sends the DHCP Request request information containing the IP address allocated last time.
After the DHCP server receives this information, it will try to allow the DHCP client computer to continue using the original IP address, and answer a DHCP ACK confirmation message.
If this P address can no longer be assigned to the original DHCP client (such as the IP address has been assigned to other DHCP clients), the DHCP server will reply a DHCP Nack deny message to the DHCP client.
When the original DHCP client receives the DHCPNack deny message, it must resend the DHCP Discover message to request a new IP address.

6. Renew lease
When the |P address leased by the DHCP server to the client reaches 50%, the lease needs to be renewed, and the client directly sends a DHCP Request packet to the server providing the lease, requesting to renew the existing address lease.

By hmimcu