What is DHCP - Dynamic Host Configuration Protocol?
Dynamic Host Configuration Protocol or abbreviated to DHCP is an application layer protocol built on the client-server model, it allows network administrators to automate the allocation of IP address and dynamically deliver other configurations parameters: such as the default gateway.
Goals DHCP aims to accomplish include:
- DHCP Clients should require no manual configuration from the client user, the client should be able to discover and apply configurations from a DHCP server.
- DHCP must not require a server on each subnet, DHCP should work through routers or using a relay agent.
- DHCP must coexist with statically configured, non-participating host and with existing network protocol implementations
- DHCP must be compatible with BOOTP (a legacy protocol with a similar purpose; the differences may be explored in a future post) and hosts that rely on BOOTP for their configuration parameters.
- DHCP must retain client configurations in the event of a client or server reboot, and whenever possible, should assign the same configuration parameters as it had done before the reboot.
How does DHCP work?
As mentioned earlier, DHCP operates on the client-server model, the server maintains a pool of IP addresses which it is able to allocate to hosts on the network and the established clients send a request to the DHCP server requesting for configuration parameters (such as IP addresses and default gateways).
On the other hand, new client on the network send a broadcast (DHCPDISCOVER) query on the network, DHCP servers on the network then respond to this broadcast request and establish themselves as a DHCP server to the client (DHCPOFFER), the client then may choose to request configuration parameters (DHCPREQUEST) which the server than provides as response (DHCPACK).
A diagram depicting how a new host on the network can get their IP address from the DHCP server
An important fact to note is that most of the time, when an IP address is allocated to a host it is leased and thus not permanent, this is especially helpful when some nodes may only temporarily use the network (this is most common on wireless networks).
To ensure clients receive the same configuration parameters post-outages or reboot, DHCP servers reserves the client’s configuration parameters for the duration of the client’s lease. When the client returns online and requests for the DHCP information again, the DHCP server can reply with the same configuration parameters.
Why was DHCP not decentralised?
A decentralised DHCP may have had higher performance or offer better reliability but there were two major reasons why DHCP ended up being a centralised protocol, those reasons are:
- Administrative Load: A centralised server is far easier to administer and control than hundreds of nodes negotiating IP addresses themselves and configuration parameters themselves.
- Nodes would have needed to defend their IP address: DHCP having a central authority manage the pool of IP addresses ensures that the server will not hand out the same IP addresses to multiple hosts, without a central authority, nodes would have needed a mechanism to defend their IP addresses, which would transform computer networks into the wild west.
Conclusion
In this post, we understood what DHCP is, How it functions and why it wasn’t decentralised, I hope you enjoyed reading this post as much as I enjoyed writing it, hope you have a great day ahead!