The acronym DHCP stands for Dynamic Host Configuration Protocol. Unlike some other computer acronyms, this one is fairly self-descriptive. In essence, DHCP is a process by which a network creates and distributes unique IP addresses for connected devices. However, DHC is also used for configuring subnet masks, default gateways, and DNS server information.
On the network, one device is used as a kind of “aircraft” controller called the DHCP server. The DHCP server creates and assigns (distributes) IP address “on the fly” (otherwise known as dynamically) as needed in order to configure and manage the network. In a home network, the router works as the DHCP server. When your computer attempts to connect to the router, the router will assign a dynamic IP address to your computer.
More specifically, once a computer is turned on and has activated network interface controller (i.e. the Wi-Fi for a home network), it will send a request to the DHCP server called “DHCPDISCOVER.” Once the DHCP server receives this request, it will assign an IP address (based on certain protocols) to the computer via a command called DHCPOFFER. The computer will then reply back with DHCPREQUEST that effectively says “I accept your IP address, now please let me join the network.”
The DHCP server should then send a message called ACK to the computer, effectively green-lighting internet access. The DHCP server will also begin a countdown clock for which the IP address is available. If the DHCP server somehow decides that the computer cannot have an IP address, it will send a command called NACK. When the time limit for the IP address has expired, the DHCP server will re-initiate the “handshake” protocol and then assign a new IP address to the connecting device.
DHCP is a protocol that forms part of the application layer of internet access, different from the transport layer (how data is formatted when it is sent), the internet layer (how data is sent over the internet) or the link layer (identifying hardware and peer-to-peer connections).
The way that DHCP servers come up with IP addresses to then assign to network devices (like your computer) is by sending a request to the internet service provider (ISP). The ISP will then inform the DHCP server of available IP addresses, and the DHCP server will then select one of these and assign it to the requestor (i.e. the computer). However, in some cases, a DHCP server may be absent, in which case the device which wants to connect to the internet (i.e. the computer) will have to be assigned an IP address manually by a (human) network administrator. In some versions of the Windows operating system, the computer will create a special kind of IP address for temporary use if the DHCP server is unable to assign one.
It’s also worth noting that DHCP servers can also function inside smaller networks that aren’t necessarily connected to the internet. For instance, you may have an office network that connects to one computer. In this situation, a DHCP server can assign IP addresses for devices connecting to the office network rather than directly to the internet.
The “dynamic” part of DHCP is essential because it allows for flexibility in assigning IP addresses in order to reduce the risk of two different devices being assigned the same IP address. In some earlier online networks, ISPs were issuing static (i.e. unchanging) IP addresses, which led to a lot of confusion if two different devices with the same IP address were simultaneously sending requests to the network.
Despite this flexibility, in some cases, assigning new IP addresses to the same devices may be inadvisable. Fixed devices like network-connected printers are better off with permanent (or “static”) IP addresses so that every computer on the network can find it without having to first be updated as to the address of the printer. Likewise, a private remote connection that allows a laptop or smartphone to connect to and access a home computer will benefit from having the remote device (in this case, the home computer) being assigned a static IP address.
The advent of the DHCP server makes network management much simpler. Instead of having to create lists of acceptable IP addresses, the DHCP server handles this task automatically. Furthermore, the DHCP server ensures that the IP addresses that it assigns adhere to the network’s setting. And because the DHCP server does this work rather than the device (i.e. a computer or a smartphone), devices can then easily switch to other networks. In other words, your smartphone never has to worry about setting its IP address when switching between your home network or the network at your favorite coffee shop because each individual network’s DHCP server will handle that task.
What makes DHCP particularly interesting is that it does not require a physical connection between the two devices. In a home network, for instance, the router (functioning as the DHCP server) will continuously broadcast its presence. A computer can use its WI-Fi controller to send out a request to the DHCP server, and after the prescribed messages have been exchanged, access will be granted to the internet.
As previously stated, DHCP can also be used to manage subnets or networks that have separate access to the internet. DHCP servers will both assign IP addresses dynamically as well as assign which particular subnet the requesting device is permitted to connect to. Similarly, if a given network has multiple different ways of connecting to the internet (called gateways), the DHCP server can handle the tasks of processing access requests and assigning the requisite login and identification controls (including the IP address).
Most DHCP servers assign IP addresses with a built-in expiration date. This helps improve security as no device can remain permanently connected to the internet. Likewise, reinstating the “handshake” protocol periodically wherein the requesting device is vetted and controlled by the DHCP server ensures that the given device continues to have authorized access to the internet (or network).
Interestingly, however, the information exchanged by devices and the DHCP server are not authenticated which can lead to vulnerabilities in network security. Unauthorized or malicious DHCP servers can intercept requests and provide false information to the requesting devices and/or access the data that the network device (i.e. computer) is sending and receiving over the internet (known as a “man in the middle” attack). Other malicious options available with unauthorized DHCP servers is by preventing devices from connecting, for instance, preventing people from connecting to a website by interrupting their internet connection.
Another malicious option for using unauthorized DHCP servers is to make numerous requests for an IP address and thus use up all of the available IP addresses, thus preventing other DHCP gateways from access the network. Fortunately, there are some methods of mitigating malicious uses of DHCP servers, including adding tags to DCHP messages as a kind of authorization token.
DHCP servers identifying requesting devices by their MAC addresses in order to ensure that it does not assign the same IP address to two different devices. Of course, since MAC addresses can be “spoofed” (faked), it is also possible to cause DHCP errors by using an identical MAC address as an existing, authorized network device. This is one method of getting around MAC filtering or MAC whitelists where only a pre-determined list of authorized MAC addresses are allowed to access the network.
DHCP was first developed in 1985 as an improved version of an existing IP management protocol called the Bootstrap Protocol (or BOOTP). Because of this, DHCP servers can also handle BOOTP requests from devices. DHCP, however, is a more advanced protocol, particularly because it is designed to automatically ensure that assigned IP addresses adhere to network configuration settings. Furthermore, BOOTP had no way of re-using previously used but expired IP addresses.
In technical terms, any device that requests access to the internet (or network) is called a DHCP client while the device that manages and assigns IP addresses is called the DHCP server.