Detailed DHCP protocol (on)

  

In common small networks (such as home networks and student residences), network administrators use manual methods to assign IP addresses. This is not the case for medium and large networks. In medium and large networks, especially large networks, there are often more than 100 clients, and the method of manually assigning IP addresses is not appropriate. Therefore, we must introduce an efficient IP address allocation method. Fortunately, DHCP (DynamicHostConfigurationProtocol) solves this problem for us.

Advantages and Disadvantages of DHCP

Advantages of DHCP Service: Network administrators can verify IP addresses and other configuration parameters without having to check each host; DHCP does not lease the same IP at the same time. The address is given to two hosts; the DHCP administrator can restrict the specific computer to use a specific IP address; many options can be set for each DHCP scope; the client does not need to reset the IP address when moving between different subnets.

But there are also many shortcomings: DHCP can't find the IP address that the non-DHCP client is already using on the network; when there are multiple DHCP servers on the network, one DHCP server can't find out that it has been used by other servers. The IP address that is leased out; the DHCP server cannot communicate with the client across routers unless the router allows BOOTP to forward.

Workflow

The working process of the DHCP service is this:

1. The discovery phase, the phase in which the DHCP client looks for a DHCP server. The DHCP client sends the DHCPdiscover discovery information in a broadcast mode (because the IP address of the DHCP server is unknown to the client) to find the DHCP server, that is, to send specific broadcast information to the address 255.255.255.255. Every host on the network that has TCP/IP installed will receive this broadcast information, but only the DHCP server will respond (Figure 1).

2. The provision phase, the phase in which the DHCP server provides the IP address. The DHCP server that receives the DHCPdiscover discovery information in the network responds by picking one of the IP addresses that have not been leased to the DHCP client, and sending a DHCPoffer providing information containing the leased IP address and other settings to the DHCP client. (Figure 2).

3. The selection phase, which is the phase in which the DHCP client selects the IP address provided by a DHCP server. If there are multiple DHCP servers providing information to the DHCP client sent by the DHCP client, the DHCP client only accepts the first received DHCPOffer information, and then it broadcasts a DHCP request request message, which contains the information. The DHCP server it selected requests the contents of the IP address. The reason for answering by broadcast is to notify all DHCP servers that he will select the IP address provided by a DHCP server (see Figure 3).

4. The confirmation phase, which is the phase at which the DHCP server confirms the IP address provided. When the DHCP server receives the DHCP request request message from the DHCP client, it sends a DHCPack confirmation message containing the IP address and other settings it provides to the DHCP client, telling the DHCP client that it can use the IP address it provides. . The DHCP client then binds its TCP/IP protocol to the network card. In addition, except for the server selected by the DHCP client, the other DHCP servers will reclaim the IP address provided (Figure 4).

5. Log in again. Each time the DHCP client re-logs into the network, it does not need to send DHCPdiscover discovery information, but directly sends the DHCP request request information containing the previously assigned IP address. When the DHCP server receives this message, it attempts to have the DHCP client continue to use the original IP address and answer a DHCPack confirmation message. If this IP address can no longer be assigned to the original DHCP client (for example, this IP address has been assigned to other DHCP clients), the DHCP server answers the DHCP client with a DHCPnack denial message. When the original DHCP client receives this DHCPnack denial message, it must resend the DHCPdiscover discovery message to request a new IP address.

6. Update the lease. The IP address that the DHCP server leases to the DHCP client generally has a lease term. After the expiration, the DHCP server will reclaim the leased IP address. If a DHCP client wants to extend its IP lease, it must update its IP lease. When the DHCP client starts and the IP lease expires by half, the DHCP client automatically sends a message to the DHCP server to update its IP lease.

For the sake of understanding, we compare the DHCP client to the guest in the restaurant, the DHCP server to the waiter (there can be multiple waiters in a restaurant), and the IP address is better than the food the customer needs. Then you can describe the whole process like this: the guest walks into the restaurant and asks: “Is there a waiter? & rdquo; (DHCPdiscover), multiple waiters at the same time replied: "Yes, I have chicken wings" & rdquo; ", I have a burger" (DHCPoffer). The guest said: "Well, I want a burger" (DHCPrequest, this guest is rather rigid, always choose the food I heard for the first time), the waiter with the burger responded: "Come on" (DHCPack), and bring the food to the guests for their enjoyment (bind the network card and IP address). The next time you come, you will go directly to the waiter who ordered your favorite burger (DHCPrequest). If there is a hamburger, the waiter will confirm and serve again (DHCPack), and if it is sold out, the waiter will tell Guest: & Sorry, I have sold out & rdquo; (DHCPnack). Of course, the waiter will pick up the table every once in a while, unless the guest specifically states that the dish will continue to be eaten, and the waiter will take the leftovers.

Copyright © Windows knowledge All Rights Reserved