What is DHCP (Dynamic Host Configuration Protocol)?
The DHCP service allows clients on the network to be automatically assigned IP addresses. Thus, IP addresses are controlled from a central location, preventing individual IP information to be entered into each client.
For a computer on the network to communicate with other computers and devices on the network, it must have information such as its IP address, subnet mask, and default gateway. Manually entering this information on each computer causes both waste of time and the possibility of being misspelled.
For this reason, automatic IP address assignment with DHCP is a safe and useful method. After DHCP is installed in the system, an IP address range must be defined for the computers. Distributed IP addresses are called scope domains.
DHCP was first introduced in 1993. Established based on the Bootstrap Protocol of 1985, DHCP provides convenience to users with various advantages and helps in updating the DHCP location features that ensure the best use of existing IP addresses.
How Does DHCP Work?
1. Discover
If the client receives an IP address in the network where the DHCP server is active, it first broadcasts the DHCP Discover message on the network via broadcast. It adds its physical (MAC) address to the message.
2. Offer
The DHCP server captures the DHCP Offer message broadcast by the client and broadcasts the DHCPOFFER message via Broadcast to suggest the first available IP address in its database to the client computer. Since this message is sent via Broadcast, it is transmitted to all computers. However, as the client's mac address is added to the message, possible confusion is prevented.
3. Request
The client receives the suggestion message sent by the DHCP server and broadcasts the DHCP Request message via Broadcast, which requests the IP address to the server again. This time the client adds the physical Mac address of the DHCP server into the message.
4. Acknowledgment
The DHCP server broadcasts a DHCP ACK message via Broadcast, indicating that it accepts the request message from the client, and the client acquires its IP address.
Benefits of Using DHCP
A computer or any other device connecting to a network must be properly configured to communicate on that network. Since DHCP allows this configuration to be done automatically, it is used in many devices such as computers, switches, smartphones, game consoles.
Due to this dynamic IP address assignment, the two devices have less chance of having the same IP address; this can be easily encountered when using manually assigned static IP addresses.
Using DHCP also makes managing a network much easier. From an administrative point of view, every device on the network can get an IP address that includes nothing but default network settings that are set to obtain an address automatically. The only other alternative is to manually assign addresses to each device on the network.
Since these devices can automatically obtain an IP address, they can move freely from one network to another and automatically obtain an IP address, which is very useful on mobile devices.
In most cases, if a device has an IP address assigned by the DHCP server, that IP address changes every time the device joins the network. If IP addresses are manually assigned, management not only gives each new client a specific address, it also means that another device must be manually assigned to use the same address for existing addresses already assigned. This is not only time consuming, but manually configuring each device also increases the likelihood of human error.
While there are many advantages to using DHCP, there are definitely some disadvantages as well. Dynamic, changing IP addresses should not be used for devices that need constant and continuous access, such as printers and file servers.
Although such devices are predominantly available in office environments, it is not practical to assign them with an ever-changing IP address. For example, if a network printer has an IP address, it needs to update its IP settings regularly so that every computer connected to it understands how to communicate with it.
This type of setup is very unnecessary and can easily be avoided by not using DHCP for such devices and assigning a static IP address instead.
The same idea comes into play when you need permanent remote access to a computer on your home network. If DHCP is enabled, this computer will obtain a new IP address at some point; this will not be correct for a long time the computer you are recording as on that computer. If you are using remote access software based on IP address-based access, you must use a static IP address for that device.