What Is DHCP? Dynamic Host Configuration Protocol Explained

5 min read
17 February 2022
Mindaugas Kubilius

Learn more about the Dynamic Host Configuration Protocol, how it works and what its key components are. Also, discover the advantages and disadvantages of DHCP.

A router between a laptop and a server form a DHCP connection.

The Dynamic Host Configuration Protocol (DHCP) is a network management protocol that dynamically assigns Internet Protocol (IP) addresses (both IP version 4 and 6) and other network configuration parameters to devices within a network. DHCP works also as a communications protocol as it handles requests between a server and a client.

When new devices appear on the network, they receive unique IP addresses. The addresses can be assigned by the network administrator manually or dynamically. However, when the local network has multiple devices, it becomes inefficient to allocate IP addresses by hand; thus, the DHCP protocol comes to the rescue. 

On a residential network, a router is a DHCP server that uses DHCP to assign IPs and send important information. Meanwhile, large enterprises set up dedicated computers for implementing DHCP servers. 

DHCP is an Internet Engineering Task Force (IETF) standard based on the Bootstrap Protocol (BOOTP). These two protocols share similar functionalities. Both DHCP and BOOTP acquire IP addresses and client configuration parameters. The main difference is that DHCP assigns IP addresses dynamically, and BOOTP supports static configuration.

The Dynamic Host Configuration Protocol is an important resource that can save time, money and increase security. Continue reading to learn more about DHCP. 

What are the components of DHCP server?

Before diving deeper into the technicalities of DHCP, it’s important to understand its components. Let’s overview them briefly.

  • DHCP server: A DHCP server can be either a server, dedicated computer or router that manages network configuration information, including IP addresses.
  • DHCP client: A DHCP client is a network device that communicates with the DHCP server to receive the configuration information.
  • DHCP relay agent: A DHCP relay agent is a host or a router that sends requests and replies between the local DHCP clients and a remote DHCP server. A relay agent handles all networks’ requests when only a single DHCP server is present for several LANs.
DHCP server, DHCP client and DHCP relay agent communicate.
DHCP client, DHCP relay agent and DHCP server at work
  • Default gateway address: A default gateway, also known as the gateway address, is the node that forwards information between local networks or local subnets and the internet.
  • IP address pool: An IP address pool is a list of all IPs that are available for allocation. 
  • Subnet mask: Subnet masks are the segments of an IP address. IP addresses are divided into subnet masks to differentiate between network and host bits. Thus, a subnet mask allows a host to determine the exact network it currently exists in.
  • DHCP options: DHCP has numerous configurations, which are called options. Some of the more common DHCP options include:
    • Option 3 (router option)
    • Option 6 (DNS server option)
    • Option 33 (static route option) 
    • Option 51 (IP address lease option)
  • Lease Time: The lease time defines the period, during which the client can use the IP address that was assigned to it.

What is DHCP lease?

Whenever a DHCP server allocates a new IP address to the device that joined a network, the device can only use that IP for a specific time. As you now know, this period of time is known as DHCP lease.

If the DHCP client wants to prolong its IP lease, it has to send a DHCP request to the server. Otherwise, the server performs an IP address release procedure at the end of the lease term.

How does DHCP work?

When assigning IP addresses for network devices, the Dynamic Host Configuration Protocol performs four stages of operations. These stages are abbreviated as DORA: discovery, offer, request and acknowledgment.

DHCP performs 4 stages of operations: discovery, offer, request and acknowledgment.
Dynamic Host Configuration Protocol stages: discovery, offer, request and acknowledgment.

Server discovery

Before it can access network services, the client broadcasts DHCP messages to find authoritative DHCP servers. If a client and DHCP servers exist on different LANs, DHCP relay agents relay messages to facilitate communication. 

IP address lease offer

DHCP responds to the discovery message by broadcasting a DHCP offer message. The offer message contains configuration information such as the client’s MAC address, specific IP address offered, subnet mask, default gateway IP address, DNS server IP address, lease time and the DHCP server IP address. 

IP lease request

After the client receives IP configuration information, it sends a DHCP request message for the offered IP address. If it receives multiple offers from several DHCP servers, the client only accepts one offer. Then, the client performs a gratuitous ARP (Address Resolution Protocol) request to see if no other hosts are using the chosen IP address. 

The client must include which server’s offer it has selected in the request message and inform others to withdraw their offers. 

IP lease acknowledgment

DHCP responds to the request during this final stage by resending the IP address information. The client performs configurations, and then it can connect to the internet with its unique IP address.

What are the benefits of DHCP?

DHCP has several important benefits. The Dynamic Host Configuration Protocol can:

  • Improve IP management
  • Prevent IP address conflicts
  • Increase efficiency
  • Save time and money
4 DHCP benefits include improved IP management and IP conflict prevention.
The benefits of DHCP

The main reason network administrators implement DHCP is to simplify IP address management. When a new device joins the network, DHCP allocates the IP addresses automatically, which means that the network administrator doesn’t need to manually configure each device. 

Compared to manual IP allocation, DHCP helps save a lot of time, especially for large enterprises. It also saves money and other resources because companies are not required to have a dedicated expert constantly overseeing IP management and allocation.

Furthermore, when network administrators assign IPs manually, the chances of IP conflicts increase. It is particularly common when a static IP address is in use. No two hosts can have the same IP address on one network, and DHCP performs requests to ensure that IP conflicts don’t happen. A human can easily make this mistake and assign the same IP address twice. 

In addition, DHCP can implement dynamic IP addresses. You have this kind of IP address assigned temporarily, and DHCP changes it automatically, which is why it is considered to be more secure than a static IP address.

What are the downsides of DHCP?

While DHCP can increase security by dynamically changing IP addresses, it is worth noting the protocol itself has a security flaw. The protocol allows new devices to join the network quickly by forgoing the authentication process. In other words, verifying that a DHCP server a device connects to is secure may be problematic.

This poses a risk of numerous security threats. For instance, a lack of authentication can cause IP depletion because unauthorized clients can be assigned IP addresses. Additionally, DHCP is prone to such cyberattacks as DoS (Denial-of-Service) or MITM  (Man-on-the-Middle).

A diagram of a DHCP-related cyberattack.
DHCP-related cyberattack

Conclusion

The Dynamic Host Configuration Protocol can dynamically assign IP addresses to ensure that the IP addressing is optimal. DHCP ensures this by performing four stages of operations: discovery, offer, request and acknowledgment.

During the discovery stage, a device attempts to find DHCP servers. The process moves to the offer stage when a dedicated DHCP server sends back the IP configuration information. It includes the device’s MAC address, offered IP address, subnet mask, gateway address, the domain name server address, lease time and the DHCP server IP address. 

To accept the new IP address, the device has to send DHCP requests for it. Then, the server responds by resending the configuration information again. 

Implementing the DHCP service is beneficial because it improves IP management, prevents IP address conflicts, increases efficiency, saves time and money. That is why DHCP is beneficial for both enterprises and small networks. 

About the author

Mindaugas Kubilius

Network Administrator

Mindaugas is a Network Administrator at IPXO with more than 15 years of experience in the IT field. He specializes in building and maintaining various network infrastructures, as well as presenting top-notch engineering solutions to the public. After work, Mindaugas spends his time in nature.
Table of contents

Related reading

IPv4 packet header
2 August 2022   •   Internet Protocol, Networking Protocols

IPv4 Packet Header: Format and Structure

When you think about it, the IPv4 packet format is truly fascinating. Learn about the elements at play with this comprehensive guide.

Read more
Two computers exchanging files with FTP sign above them.
12 July 2022   •   Network Engineering, Networking Protocols

File Transfer Protocol Explained

What does FTP stand for? What is the importance of this protocol? How does it work? Read this post to learn all about the File Transfer Protocol.

Read more
TCP/IP model determining how devices connect to the internet.
7 June 2022   •   Internet Protocol, Networking Protocols

TCP/IP: What Is It And How Does It Work?

The Transmission Control Protocol and the Internet Protocol create what is known a TCP/IP model. Learn how it works and what functions it serves.

Read more

Subscribe to the IPXO email and don’t miss any news!