Linux Commands

What Is DHCP and How Does It Work

While there are several network management protocols today, DCHP remains one of the most popular options. DCHP, an acronym for Dynamic Host Configuration Protocol, automates the often daunting task of configuring or setting up the devices on IP networks. The essence is to allow the devices to use the network services like NTP, DNS, and other communication protocols based on TCP or UDP.

This protocol comes in handy in dynamically setting up or changing the configuration parameters of internet hosts. Once DHCP assigns each device on your network the relevant network configuration parameters, the device will be able to communicate with other IP networks.

Of course, these parameters include the netmasks, IP addresses, DNS servers, and default routers. And like most network management protocols, DHCP features a client-server model. It is a better version of the obsolete BOOTP and is an integral component of the DDI solution including DNS-DHCP-IPAM.

This article sheds light on DHCP. The introductory write-up explains what DHCP is as well as how DHCP works on Linux setups. Read on!

The Dynamic Host Configuration Protocol Overview

As a network management protocol, DHCP eliminates the need for the network managers to set up the network devices manually. It automatically assigns the configuration parameters to computers and other network devices.

It features two components—a server instance and a client instance. The server-side is often the centrally installed network center, while the client instances are the individual computers or devices.

This protocol defines how the devices communicate within a local network and across networks over the internet. For instance, a DHCP server manages the IP settings for devices within its local network by automatically and dynamically providing the IP addresses or other configuration parameters.

Notably, the configuration parameters assigned by DHCP are only valid for limited durations. This duration is called the DHCP lease, while the validity period is the DHCP lease time. A client will no longer use the IP address or assigned parameter once the lease expires. The implication is that they need to stop the communication with the network.

However, clients can still request a lease rent extension through the stipulated DHCP lease renewal cycle. The renewal process provides a robust and automatic IP address allocation to devices.

How DHCP Works and Its Usage Scenarios

DHCP is a client-server protocol and certainly have both components. Thus, whenever a device attempts to initiate a connection to a network, the DHCP client software automatically sends a query broadcast requesting for a specific information.

The DHCP server receives this request. And since it manages a conglomeration of IP addresses and other information relating to the client configuration such as domain names, default gateways, time servers, and name servers, it reviews and responds to the client query.

The response may be based on previous administration configuration, a predetermined specific address, or any valid information for the network. DHCP clients request or query this information as soon as it boots and from time to time before it expires.

Ideally, you can deploy the DHCP on small residential networks and large multilevel networks that comprise several servers. A single server can still offer services to the large networks with numerous links when helped by the DHCP relay agents at the routers.

The following are the primary DHCP usage scenarios:

    • Initial Client Connection – A client computer or device initiates a request or query seeking an IP address and other configuration parameters from the DHCP server.
    • IP Usage Extension – The client uses this scenario to request an extension to use the IP address and other configuration parameters from the DHCP server. This scenario comes in handy when the lease time elapses.
    • Client Connection After a Reboot – The client requests permission to use the same IP address and parameters used before the reboot.
    • Client Disconnection – Irrespective of which scenario the client leveraged for connection, the client will finally request the server to release the provided IP address and parameters. This scenario also ends the communication.

DHCP Linux Example

Ideally, Linux users can start a DHCP server with the dhcpd command. This utility prompts the server to read the /etc/dhcpd.conf file which contains all the information on the available IP addresses and other configuration information.

An example of the configuration file looks like the following:


DHCP sounds pretty straightforward. However, implementing it is rather involving. This article introduces you to DHCP. In our subsequent write-ups, we will be a bit more detailed to provide you with a step-by-step guide on how to set up a DHCP client and server.

About the author

Kennedy Brian

Brian is a computer scientist with a bias for software development, programming, and technical content development. He has been in the profession since 2015. He reads novels, jogs, or plays table tennis whenever not on gadgets. He is an expert in Python, SQL, Java, and data and network security.