What is DHCP? How does the DHCP server work?

In this guide, we'll walk you through everything you need to know about DHCP servers, from how they work to how to set one up on your network. Whether you're a network administrator or just looking to simplify your home network setup, this guide covers you.

Updated: 30 Mar, 23 by Susith Nonis 11 Min

List of content you will read in this article:

An IP network device can access services like DNS, NTP, and any protocol based on UDP or TCP by automatically configuring the Dynamic Host Configuration Protocol (DHCP).

Each device on a network receives a dynamically assigned IP address and other network setup information so they can connect to other IP networks. DHCP is an improvement of the BOOTP protocol from the past. 

Automatic distribution and assignment of IP addresses, default gateways, and other network characteristics to client devices are performed by a DHCP server. 

It uses the widely used Dynamic Host Configuration Protocol or DHCP to reply to clients' broadcast requests.

A DHCP server automatically delivers the necessary network parameters for clients to communicate successfully on the network. 

let’s review the components of DHCP.

DHCP server

The server device is responsible for responding to requests for IP addresses, providing a free IP address, storing it for the duration of the lease, and then renewing it. 

All client devices will be communicated with by it. A computer or a component of the router could function as the server.

DHCP client

This component has to be on the client devices (for example, computers, smartphones, IoT devices, etc.). 

It will request an IP address, communicate with the DHCP server to obtain it along with the other data, and verify the operation.

DHCP scope

This component refers to the IP address range the DHCP server can provide to the clients. Typically, the server will automatically assign addresses, working its way up from the lowest number to the highest.

Subnet

There will be so-called subnets if the network is partitioned into segments.

Lease 

Lease refers to the time frame that shows how long a client's allocated IP address will remain valid before it expires.

DHCP relay

The relay facilitates communication between the client and the DHCP server. 

It will keep an ear out for communications and deliver them where needed.

The DHCP server can be set up in one of three ways:

  • automatic allocation

This one will automatically and permanently assign an IP to each client. The IP address will only be assigned to one device; thus, if any additional devices connect in the future, the server may run out of IP addresses to distribute.

  • dynamic allocation 

The most typical configuration is this one. The server auto-assigns IP addresses to the clients, despite a delay limit. The client must request a new IP address after the timer ends. This will stop the IPs from running out.

  • manual allocation 

The client will receive an IP address manually assigned by the network administrator.

The client and the server are the two key components of a DHCP system. The DHCP server assigns IP addresses while the clients are peripheral devices. 

A device that attempts to connect to a DHCP-enabled network first submits an IP address request. The device adds its MAC address to the message it transmits in search of a server because it initially lacks an IP address.

This address identifies the network card of the device. The DHCP server receives the client's request and immediately provides the device with a free address. 

Additionally, the server keeps track of how the address is used and returns it to the address pool if it is no longer in use or the allotted period has passed.

It is understandable to question how the end device initially connects to the server without using an IP address. Still, a complex system of messages and acknowledgements is used to explain this. 

To begin with, a DHCP client system is installed during manufacturing on all contemporary devices and is turned on by default.

When a computer is turned on, and the operating system is running, the DHCP client, which is present in peripherals and computers, begins to work. As a result, most devices can already locate and join a DHCP network.

Although somewhat complicated, the entire process happens automatically in seconds. Four different message types are used in the initialization procedure. 

DHCP discovery

The discovery message is the first communication sent over the network to which clients are connected. 

Since the client is uninformed of the server's address, the message type DHCPDISCOVER is broadcast widely over the network rather than to a single address.

The discovery message is a packet with a specific destination (often 255.255.255.255), indicating the client is a network member. If specified, the packet might also include a particular subnet broadcast address. DHCP servers can implement the discovery operation if the client is connected to the network.

DHCP offer

The server's response, which it sends after receiving the discovery message, is a DHCP offer.

Any DHCP client linked to the network can receive the DHCPOFFER message type, broadcast broadly over the network using UDP port number 68. 

However, the server targets the message to a single client by including the client's MAC address. When other clients encounter a MAC address that isn't theirs, they ignore the message.

An IP address which a client might accept utilizing is part of the DHCP offer. Additionally, the message provides clients with information on the subnet mask, default gateway, IP address, and lease terms for the DNS server addresses. 

The gadget is fully integrated into the network due to all this information.

DHCP request

A protocol called DHCPREQUEST protects and directs the client in a network of many servers. Several servers, usually found in big networks, may be able to receive the discovery message and provide the client with an offer along with an IP address. 

The DHCP client is designed to send a request message after receiving an offer, which may be the first of many offers because this is possible.

The DHCP request message attests to the client's selection and use of the IP address provided in the offer. The server's IP address is transmitted with the selected offer message as part of the request message.

After receiving the request message, the server that distributed the offer message decides and confirms that the client's IP address is not accessible to other devices. 

The provided IP addresses will be returned to the pool of addresses if other servers send out offer messages, where they will wait for a different device that might require them.

DHCP acknowledgement

The final stage of initialization is DHCP acknowledgement. It's a message delivered by the IP address's supplying server. 

The message, described as "DHCPACK," confirms that the client has successfully leased the relevant IP address. 

The configuration is finished, and the client gets a new, useful IP setting.

Now that you know how DHCP servers work, discuss their importance and advantages. 

Correct IP configuration 

When working with inputs like "192.168.159.3," an error can be made in setting up the IP address settings. Typographical errors are frequently challenging to correct; however, using a DHCP server lowers the risk.

Reduced IP address conflicts 

Each connected machine needs an IP address. A repeat address can only be used once; if one or both machines are unrelated, there will be a dispute. 

This may be conceivable when manually assigned addresses are used, especially when numerous endpoints, including mobile devices, are only sporadically linked. Each address is only used once when DHCP is utilized.

Automation of IP address management 

Without DHCP, network administrators would have to assign and remove emails by hand. When devices require network access and when they disconnect, it can be difficult to keep track of which system has which address. 

DHCP can expedite and centralize this, allowing network specialists to manage every site from a single place.

Effective change management 

Moving addresses, scopes, or endpoints is quite easy with DHCP. For instance, a business might desire to change the IP address scheme from one range to another.

The DHCP server is configured with this most recent data, and new endpoints are given access. Similarly, if a network system has been modified and replaced, no network setup is acceptable.

The most recent versions of DHCP servers come with vital improvements that improve their capacity as an IP control platform. 

Compliance with a request for comments (RFC)

The RFC is a book outlining the standards, technology, and protocols that have governed the internet since its creation. The DHCP standard complies with the RFC and includes three key administrative functions.

Integration of the Domain Name System (DNS)

The integration of DNS into DHCP networks is essential. Clients running older versions of Windows or clients running different operating systems than Windows can update their records automatically using DHCP concurrent with DNS integration.

Active directory integration

Another element of the DHCP standard is Active Directory integration, which enables DHCP servers to be approved within Active Directory. 

Integration with Active Directory makes it easier to weed out illegitimate servers and keep a network with only approved servers. The administrator will have complete control over the servers permitted in the network in this fashion.

The fact that this capability only functions with Windows 2000 DHCP servers is a drawback. 

The implication is that any additional DHCP servers added to the network can bypass the Active Directory authorization procedure.

Vendor-specific options for Microsoft

Microsoft vendor-specific options are another function that DHCP supports. For instance, NetBIOS over Transmission Control Protocol (TCP/IP), often known as NetBT, can be turned off. 

The clients can enable or disable it using this option, which is only available on Windows 2000 DHCP. Early versions cannot turn off NetBIOS, making current versions significantly better.

Microsoft's assistance with multicast IP address distribution

Windows 2000 DHCP protocol is compatible with Multicast Address Dynamic Client Allocation Protocol (MADCAP). 

Multicast clients use the MADCAP to join multicast groups. You should be aware that the multicast scope is separate from the DHCP scope, allowing multicast clients to access both the multicast address and the IP address included in the DHCP scope.

A network management standard called DHCP is used to assign IP addresses to computers and other nodes on a network to improve communication. Although it was initially designed in 1993, it is still a crucial protocol.

Network administrators formerly had to manually give Internet Protocol addresses to all of the network's peripheral devices, which exposed the system to faults and put a significant strain on the administrators, especially in big networks.

Administrators can utilize the DHCP system in big networks like university networks, business networks, WANs, etc., and smaller networks like home networks.

People also read: 

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.