How DHCP Works

What is DHCP

First, let me give you an overview of DHCP.

◆ What is DHCP?

 DHCP is an abbreviation for "Dynamic Host Configuration Protocol" and is a protocol that automatically assigns information such as IP addresses necessary for computers to connect to networks.

The following items can be set automatically using DHCP.

  • IP address
  • sub-net mask
  • default router
  • DNS

*Various information other than the above can be set.

 It is very convenient to be able to automatically configure the client with the information necessary for connecting to the network, such as the IP address. If you have a few clients, this task of assignment is not too difficult, but if you have many clients, it becomes difficult to manage.

 This is because each time the number of terminals connected to the network increases, it is necessary to assign IP addresses, etc. for additional clients.

Then, why not ask the user who uses the client to set it by himself?

 You may think so, but there are various rules for setting network information. For example, there is a rule that IP addresses must not overlap. If you break that rule, you will not be able to communicate as expected.

 Also, if the IP address of the default gateway is assigned to a client by mistake, other clients belonging to the same network as the incorrectly set client will not be able to connect to a different network or the Internet.

 Network settings require a certain amount of knowledge about networks, and it is necessary to set all items correctly without making a single mistake.

 Even if they are all knowledgeable about networks, they are human and can make mistakes. In that sense, DHCP, which can reliably assign network settings, is useful in networks with many clients.

 In this way, using DHCP makes network management easier, and the network administrator can easily centrally manage even a large number of clients.

◆ Client settings

 To enable automatic network setting by DHCP, simply set "Obtain an IP address automatically" on the client side, and the client will be able to automatically obtain an IP address.

For example, on a WindowsXP terminal, set TCP/IP properties to automatic acquisition.

The figure above shows the settings for Windows XP, but basically any OS can be used to make similar settings.

 Portable game consoles such as Nintendo DS, 3DS, PSP, and PS VITA, as well as terrestrial digital TVs, also have a setting item to "Obtain an IP address automatically."

In this way, the settings and work for using DHCP are easy to use and not difficult to do.

DHCP behavior

Here, we will explain the flow of DHCP operation.

The flow of DHCP operation is shown in the figure below.

1. DHCP Discover

The client broadcasts "" and requests to be assigned an IP address.

2. DHCP offers

 The DHCP server receives this request and sends a DHCP Offer to the sender asking, "What about this IP address?" At this time, it will be sent to the MAC address of the source client as the destination MAC address.

3. DHCP Request

 If the client is satisfied with the proposal received in DHCP Offer, it broadcasts a request (DHCP Request) saying "Please let me use that information."


The DHCP server sends an acknowledgment (DHCP ACK) message to the client.

 You may be surprised to see this trend. The reason is that the client receives the DHCP Offer and does not configure with that information immediately.

 This is because it is assumed that there are multiple DHCP servers. This is so that when there are two or more DHCP Offers for one DHCP Discover, the client can select one and send a DHCP Request.

 Also, communication is performed by broadcast between the client and the DHCP server. Therefore, there is a restriction that DHCP cannot be used if there is a DHCP server in the network beyond the router that blocks broadcasts.

*A DHCP relay agent is required to access the DHCP server beyond the router. This feature is usually supported by routers.

◆ DHCP (lease renewal and release)

The assignment of IP addresses by DHCP servers to DHCP clients is called a lease.

 This leased IP address is allowed to be used only within the lease period defined by the DHCP server. A DHCP client cannot use an IP address beyond the lease time.

Therefore, if the DHCP client wants to use the IP address beyond the lease period, it will request renewal of the lease period.

Also, when the DHCP client no longer needs an IP address, such as when the power is turned off, DHCP Release is performed as shown in the figure below.

 In the case of Windows, when half of the lease period has passed, the DHCP server that has leased the IP address is requested to renew the lease period. If this renewal succeeds, the lease will be extended.

 If the DHCP server fails to renew due to reasons such as being down, the DHCP client will further ask another DHCP server to lease the IP address when 87.5% of the lease expiration has passed. , broadcast a DHCP Request.

 If no DHCP server receives permission to renew, the lease expires and the DHCP client stops using the IP address.