What is DHCP? How does it work?

Ever heard about DHCP? It is one of those technical things that keeps the internet working every day, and most people have no idea that it exists, let alone know what it does. However, you may have heard a friend or the IT guy from work mentioning terms like DHCP, DHCP servers, or DHCP clients. Were you wondering what all that gibberish was about? If you want to know what DHCP is, how does DHCP work, and what it's used for, read on. In this article, we explain all that and more:

What is DHCP?

DHCP is an acronym for Dynamic Host Configuration Protocol. It is a network management protocol that's used by servers to automatically assign IP addresses to the computers and devices connected to them.

On local area networks (LANs), such as those in your home or small and medium-sized offices, the servers that provide DHCP are usually run by routers. In large networks, such as those maintained by big companies or government institutions, DHCP can be provided by dedicated servers (specialized computers) instead of simple routers.

DHCP server enabled on a router

Besides IP addresses, DHCP can also be used to automatically assign the subnet mask, default gateway, and DNS servers to the computers and devices inside a given network.

How does DHCP work?

To understand how DHCP works, you must first understand the basics of what IP addresses are. Put simply, IP addresses are unique identifiers of the computers and other devices that are connected to a network. The PCs and other devices (printers, smartphones, etc.) in a network need IP addresses in order to be able to communicate between them, to send and receive data to other devices on the same network or on the internet. IP addresses are for computer networks what street addresses are for towns. You need them to be able to send messages around, to know where they are sent and where they start.

Every computer and device in a network needs a valid IP address to be reachable, and there are two ways in which a computer or device can get one. Computers and devices can use static or dynamic IP addresses. Static IP addresses are not assigned by servers or routers. Instead, they are manually configured by you or by your network's administrator.

Manually setting an IP address on a Windows 10 PC

Dynamic IP addresses, on the other hand, are not assigned manually, hence their name. They are assigned dynamically, or automatically if you prefer. Who or what assigns them? The answer is DHCP, the Dynamic Host Configuration Protocol.

Automatic (DHCP) IP address on a Windows 10 PC

When a computer or device in a network wants to connect to others and communicate with them, either locally or on the internet, there are a few things that take place in a matter of moments:

  1. The computer or device that wants to connect to the network/internet asks its server or router for an IP address. The message that's sent by the host computer or device is called a DHCP discovery request.
  2. When the server/router receives the request, it relays the demand to its DHCP network service. The DHCP service on the server/router looks into the available IP addresses that have not been claimed by other computers and devices. As soon as the DHCP server/router identifies a free IP address, it sends it to the computer or device that requested it. This part of the process is called a DHCP offer.
  3. The PC/device receives the dynamically allocated IP address and sends a message back to the DHCP server/router, acknowledging that it wants to use that IP address. This step is called a DHCP request message because the host actually requests the offered IP address.
  4. When the DHCP server/router receives the request message, it sends a final message to the computer or device that initiated this entire process. This message is called DHCP acknowledgment and contains all the other configuration information needed to grant network/internet access to the computer or device, such as the gateway and DNS servers.
  5. Finally, the DHCP server/router marks the designated IP address as being occupied and in use by the computer or device that requested it, which now can communicate with the other devices on the local network and access the internet if it's available.
Diagram of DHCP running on a home network

What is the DHCP lease time?

Now you know how DHCP assigns IP addresses automatically to computers and devices. However, the IP addresses received from the DHCP server are not permanent, as you might be tempted to think. The IP addresses pool is limited, meaning that there are just so many of them available in a network.

Furthermore, some of the computers and devices connected might not stay on permanently or might not connect to the same network all the time. That means that, if their dynamically allocated IP addresses were permanent, they would occupy them even when they no longer need them. As such, DHCP assigns IP addresses only temporarily for a limited amount of time. That time is called DHCP lease time, and you can learn more about it from this article: How to change the DHCP lease time in Windows 10.

The DHCP lease time setting on a router

In conclusion, DHCP lease time is a feature that allows DHCP servers to reclaim unused IP addresses after a specified period of time passes.

Who invented DHCP?

Although you know now why DHCP was invented and what it's used for, you might also be wondering about how DHCP came to life and who invented it. Its history starts back in 1984, when the Internet Engineering Task Force (IETF), which is the internet's standards authority, created a network protocol called Reverse Address Resolution Protocol (RARP). RARP allowed computers without disk drives (called diskless workstations - they booted by loading an operating system directly from a central server) to automatically receive IP addresses.

However, RARP was difficult to implement and configure, so it was soon improved (in 1985) into another network protocol called BOOTP (Bootstrap Protocol). BOOTP servers could automatically assign IP addresses on more than one subnet.

DHCP was born out of BOOTP but was also able to dynamically assign IP addresses from a specified range, as well as reclaim them when no longer used (DHCP lease time), and provide other configuration options to network computers and devices such as the IP addresses of the gateway or the DNS servers. DHCP was standardized in 1993, and it continued to receive improvements since then.

Do you have any other questions about DHCP?

Now you know what DHCP means and what DHCP does. Isn't it a small wonder of the computer world and networking? Do you have other questions regarding DHCP? If you do, or if you have something to add to our article, feel free to leave a comment below.

Discover: Smarthome Network and Internet System and Security Tutorials Windows Wireless
Join the discussion: See the comments Comment