Written by 1:21 pm Servers • One Comment

What is DHCP? How does the DHCP server work?

The DHCP server has changed the lives of all administrator forever. It has given them the commodity of automatic IP assignment. After the introduction of DHCP, there was no need for some IT specialists to spend countless hours providing IPs for every device connected to the network device. But how exactly does DHCP work? Let’s find out!

What is DHCP and DHCP server?

DHCP – Dynamic Host Configuration Protocol is a network management protocol that we use on TCP/IP networks. The DHCP server, automatically assigns IP addresses and other network configurations like subnet mask, default gateway, DNS server, and more to the connected devices so they can exchange information. DHCP lets the hosts get the necessary TCP/IP configuration data from the DHCP server.

A device makes a request for an IP address if it wants to gain access to a network that’s utilizing DHCP. The server replies and provides an IP address to the device. After that, it monitors the use of the address, and when a defined period expires, or the device shuts down, it takes it back to its pool of available IP addresses. It is kept until it has to be reassigned to a different device that wants to access the network.

Using this protocol, the network administrators don’t need to set a static IP for each device, and later reassign it to another and keep an eye on all the available IPs. They will just set up the DHCP server with all the additional network information, and it will do its work dynamically.

Why is DHCP important?

DHCP is important because it makes it really easy for network administrators to provide IP addresses to client devices on the network. It manages the pool of IP addresses automatically.
The client also does not need to do anything at all. The newly connected device will automatically ask for an IP address and get it. The person behind the device does not need to make any configurations.
Every device on a network needs the address as identification. And two devices can’t have the same IP because this will make them both unusable.

Brief History of DHCP

The Dynamic Host Configuration Protocol (DHCP) was developed in the early 1990s as a solution to the growing complexity of IP address management. Before DHCP, administrators had to manually assign static IP addresses, which was time-consuming and prone to errors, especially as networks expanded. DHCP evolved from earlier protocols like BOOTP (Bootstrap Protocol), which provided limited functionality, such as assigning IP addresses to diskless workstations.

The Internet Engineering Task Force (IETF) standardized DHCP in 1993 with the release of RFC 1531. The new protocol significantly improved BOOTP by enabling automatic, dynamic, and temporary IP address assignments, as well as better management of network configurations like subnet masks, gateways, and DNS settings. Since its introduction, it has become a fundamental part of modern network infrastructure, significantly simplifying network administration and supporting the explosive growth of devices on the internet.

Experience Industry-Leading DNS Speed with ClouDNS! 

Ready for ultra-fast DNS service? Click to register and see the difference!

Components of DHCP

Several important components work together to ensure smooth operation:

  • DHCP server. The server device is in charge of answering an IP address request, providing an available IP address, storing it for the time of the lease and renewing it later. It will handle the communication with all the client devices. The server could be a computer or a part of the router.
  • DHCP client. It must be present on the client devices (computer, mobile, IoT device, etc.). It will request an IP address and communicate with the DHCP server to get it with the rest of the data and confirm the process. 
  • DHCP scope. This is the range of IP addresses that the DHCP server can offer to the DHCP clients. Usually, the server will auto-assign addresses, starting from the smallest number, and going to the highest. 
  • Subnet. If the network is divided into pieces, there will be so-called subnets.
    Lease. That is the time period that indicates how long a client can use the assigned IP address before it expires. 
  • DHCP relay. The relay is in charge of communication between the DHCP server and the client. It will listen for messages and pass them to the right place. 

How does DHCP work?

Imagine we have a network of connected devices and a DHCP server that manages the IP addresses.

  • Step 1: DHCP Discover

When you connect a new device, it still does not have an IP address. It will search for an IP address. It will call over the network for a DHCP server. This request will arrive to all of the devices, and the server will also get it.

  • Step 2 DHCP Offer

The DHCP hears the call, and answers with an IP address, which it оffers to the newly connected device. 

  • Step 3 DHCP Request

The IP address arrives at the device. The device will accept it and will send a request to use it.

  • Step 4 DHCP Pack

The server gets the accepting message from the device. It will provide the IP address to the device, together with the subnet mask and the DNS server. It will write a record with the information of the newly connected device that usually includes the MAC address of the connected device, the IP address that was assigned, and the expiration date of that IP address. The DHCP leases the IP address for a limited time only. After the time passes, the IP address will go back to the IP pool of available IP addresses and can be assigned to a new device again.

The UDP port for the communications is usually port 68 for clients and port 67 for servers. There might be some differences, depending on the vendors of network equipment, but this is how it functions in general.

How does DHCP work

IP address allocation mechanisms of DHCP

There are three ways that you can configure the DHCP server:

  1. Automatic allocation. This one will automatically assign an IP per client permanently. The IP address will be designated for just one device, so if, in the future, many new devices get connected, the server could run out of IP addresses to give.
  2. Dynamic allocation. This is the most common configuration. The server auto-assigns IP addresses to clients, but there is a time period. After the time expires, the client needs to ask for a new IP address again. This will prevent the running out of IPs.
  3. Manual allocation. Manually the network administrator will assign the IP address to the client. 

DHCP lease duration times

In the world of networking, DHCP lease duration is a crucial concept. It simply refers to how long a device can use an IP address assigned by a DHCP server without needing to renew it. Here’s the key terminology:

  • Lease allocation: When a device joins a network, the DHCP server grants it an IP address for a specified time (the lease duration).
  • Lease renewal: As the lease period nears its end, the device can either renew the lease or let it expire.
  • Importance: Lease duration impacts IP address management and network stability. Short leases are suitable for dynamic networks, while longer ones provide stability.
  • Configuration: Network administrators can adjust lease durations to suit their network’s needs, balancing IP address management and network stability.

Understanding DHCP lease duration helps ensure efficient IP address allocation and network performance.

Benefits of DHCP

Some of the main advantages are the following:

  • IP address configuration on which you can rely

DHCP makes very few errors regarding the IP address configuration. There might be some occasional errors related to the network typographic and IP conflicts when the DHCP server assigns the same IP to different devices.

  • Less work for the network administrators

There are few features that admins really like about it because it makes their job easier.

You can automate the TCP/IP configuration. This can be done from one central location, without the need to move to different devices.

Additional options. It can change various additional network settings.

DHCP handles IP address changes for some users, like the laptop owners. They need to connect and disconnect more often than a desktop PC. This is not a problem for the protocol.

  • Scalability

As businesses and networks grow, DHCP scales effortlessly. Whether a network has tens or thousands of devices, DHCP can manage IP address allocation seamlessly. Therefore, it is essential for large enterprise networks or public Wi-Fi networks where a vast number of devices connect and disconnect constantly. Its scalability helps maintain an efficient network even as the number of devices expands.

Disadvantages of DHCP (security concerns)

The primary goal of DHCP was mainly focused on making an IP address assignment a quick and efficient task. That was successfully achieved, yet a compromise was also made with security and authentication.

The DHCP server doesn’t require authentication when providing a lease. That way, if there is not a firewall working, someone can get the data from the network. The majority of large enterprises have many authentication requirements for users in order for them to access their network resources. However, that is still not enough and leaves the DHCP server in a weak spot in the security chain.

Rogue DHCP server. If such a server gets connected to the network, it can start assigning IPs to the devices. These devices will share data with it, and their information can be seen by the server. It means that hackers can steal the data that way. There is a possibility a cybercriminal to spoof or take control of the DHCP server. Then, as a result, it can give out dangerous data to legitimate end users, directing them to a bogus website. In another scenario, unauthorized users can receive legitimate IP addresses, which is a prerequisite for man-in-the-middle attacks and Denial-of-Service (DoS) attacks.

Troubleshooting with DHCP

As with any technology, DHCP can sometimes run into issues. When your device can’t connect to a network, DHCP might be the culprit. Here are a few common problems and their solutions:

  • IP address conflict: If two devices on the same network end up with the same IP address, they can’t communicate properly. To fix this, the conflicting devices need to be assigned different IP addresses.
  • DHCP server unavailability: If the DHCP server goes down, devices won’t be able to get IP addresses. Ensuring server uptime and redundancy is essential.
  • Lease expiry: If your device can’t connect, it might be because its DHCP lease expired. You can manually release and renew the lease to get a new IP address.

Conclusion

Now and then, there comes a technology that makes our lives easier. Maybe it is not so visible, and just a few people know that it exists, but the DHCP deserves our “thank you.”

It has its downsides, but the time it saves is far more valuable.

(Visited 29,563 times, 9 visits today)
Enjoy this article? Don't forget to share.
Tags: , , , Last modified: September 11, 2024
Close