What Is the Dynamic Host Configuration Protocol?
Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol) is a standard protocol defined by RFC 1541 (which has been replaced by RFC 2131), which allows the server to dynamically assign IP addresses and configuration information to clients.
- Chinese name
- Dynamic Host Configuration Protocol
- Foreign name
- Dynamic Host Configuration Protocol
- Definition
- Computer Internet Protocol Configuration Protocol
- Nature
- Standard protocol defined by RFC 1541
- Dynamic Host Configuration Protocol (Dynamic Host Configuration Protocol) is a standard protocol defined by RFC 1541 (which has been replaced by RFC 2131), which allows the server to dynamically assign IP addresses and configuration information to clients.
- The DHCP protocol supports a C / S (client / server) structure, which is mainly divided into two parts:
- 1. DHCP client: Usually it is a PC, printer, and other terminal devices on the network. It uses the IP information allocated from the DHCP server, including IP addresses, DNS, and so on.
- 2. DHCP server: All IP network setting information is centrally managed by the DHCP server and processes the client's DHCP request.
- DHCP uses UDP as the transmission protocol. The client sends a message to port 67 of the DHCP server, and the server returns a message to port 68 of the client.
- The DHCP server usually provides at least the following information to the client:
- 1.IP address
- Subnet mask
- 3.Default gateway
- You can also provide other information, such as the address of a Domain Name Service (DNS) server and the address of a Windows Internet Name Service (WINS) server.
- The DHCP server assigns IP addresses to clients in three forms:
- 1. The administrator assigns an IP address to a client.
- 2. Randomly assign addresses permanently to clients.
- 3. Randomly assign addresses to clients for a period of time.
- The third is the most common form of use. The valid period of use of the address is called the lease period. Before the lease expires, the client must request the server to continue the lease. The server can only continue to use it after accepting the request, otherwise it will give up unconditionally.
- By default, the router isolates broadcast packets and does not send received broadcast packets from one subnet to another. When the DHCP server and the client are not on the same subnet, the router acting as the client's default gateway sends broadcast packets to the subnet where the DHCP server is located. This function is called DHCP relay.
- The types of packets involved in DHCP and their functions are as follows:
- 1. DHCP DISCOVER: The first message that the client starts the DHCP process is a broadcast message requesting the IP address and other configuration parameters.
- 2. DHCP OFFER: The server's response to the DHCP DISCOVER message is a unicast (or broadcast) message containing a valid IP address and configuration.
- 3. DHCP REQUEST: The client's response to the DHCP OFFER message indicates that it accepts the relevant configuration. This message is also sent when the client renews the lease of the IP address.
- 4. DHCP DECLINE: When the client finds that the IP address allocated by the server is unavailable (such as an IP address conflict), it will send this message to inform the server that the use of the IP address is prohibited.
- 5. DHCP ACK: the server's response to the client's DHCP REQUEST message. After receiving the packet, the client actually obtains the IP address and related configuration information.
- 6. DHCP NAK: The server rejects the DHCP REQUEST message from the client. After receiving the message, the client will restart the new DHCP process.
- 7, DHCP RELEASE: The client actively releases the IP address assigned by the server. When the server receives this message, it reclaims the IP address and can assign it to other clients.
- 8. DHCP INFORM: After the client obtains the IP address, it sends this message to request some other network configuration information of the server, such as DNS.
- Generally, the IP address leased by the DHCP server to the DHCP client has a lease period. After the expiration, the DHCP server will recover the leased IP address. In order to continue using the original IP address, the DHCP client sends a lease renewal request to the DHCP server.
- The workflow of DHCP lease renewal is described as follows:
- 1. The client sends a unicast DHCP REQUEST message to the server to renew the lease at the last 50% of the lease period.
- 2. If a DHCP ACK message is received from the server, the lease period is extended accordingly and the lease renewal is successful. If no DHCP ACK packet is received, the client continues to use this IP address. At the time when 87.5% of the lease period has passed, a broadcast DHCP REQUEST message is sent to the server to renew the lease period.
- 3. If a DHCP ACK message is received from the server, the lease period is extended accordingly and the lease renewal is successful. If no DHCP ACK packet is received, the client continues to use this IP address. When the lease expires, the client automatically gives up the use of this IP address and starts a new DHCP process.