“What is DHCP” is an important question for network administrators. DHCP stands for Dynamic host configuration protocol and used to assign IP addresses and other network parameters dynamically to devices attached to network. It is a network management protocol that works on the client and server model. The devices that want to get connected with the network sends a request to the DHCP server for allotting IP addresses, and the DHCP server responds accordingly. DHCP can work well for both small networks as well as large enterprise networks.
For a small network the devices like routers work as DHCP servers, and for large networks, a dedicated server is used. The primary purpose of DHCP is to allocate IP addresses, but it can also perform other tasks like configuring the default gateway, DNS server and subnet mask information on the device.
How DHCP servers work
A DHCP server allocates IP addresses to the nodes connected to a network. There is a pool of IP addresses that are present with the DHCP server, and DHCP server issue these IP addresses to the devices that request for an IP address. The detailed working of the DHCP server is.
- DHCP follow the DORA process in which D stands for discovery, O stands for the offer, R stands for the request and A stands for acknowledgment.
- Whenever a device wants to connect to a network, it broadcast a request for an IP address on the network since it is not yet a part of the network, it cannot unicast a message. The device tries to find the DHCP server in this step, so this forms the discovery part of the DORA process.
- After a request has been broadcasted over the network by the device, it is received only by the DHCP server. There is a separate mechanism why this happens. Once the DHCP server receives the request, it responds with an offer to the requesting device. It offers the device an IP address. It is the offer part of the DORA process.
- After the device has received the offer, it replies with a request to grant that IP address to the DHCP server and similarly this request is also broadcasted. It forms the request part of the DORA process.
- Once the DHCP server receives the request, it broadcast an acknowledgment over the network granting the device an IP address. Since the acknowledgment gets aired over the network, all the other DHCP servers connected to the network can see this acknowledgment, and in this way, they know that this IP address has been assigned to this device.
After the completion of this process, finally, the device is assigned an IP address. The DHCP server maintains the list of the devices and their IP addresses, and once the IP address gets allocated to a new device, it gets automatically added to the list. Now, the device will be able to communicate with all the nodes in the network.
Before the DHCP server starts working, some settings are needed to be configured. DHCP scope is set. DHCP scope is the range of the IP addresses from which the DHCP server is going to assign the IP address. Some mandatory settings that are needed are given below.
- First of all, the range of IP addresses is needed to be provided to the DNS server. From this range, it will issue the IP addresses to its client.
- The next setting is the subnet masking. If subnets are there in the network, then it needs to be explicitly specified.
These two primary settings get configured so that DHCP server start allotting IP addresses to the hosts but there is some extra configuration that can also be done with the DHCP server like providing default gateway address, DNS server address to the server.
There is no way of getting connected to a network without the IP address, and earlier, it was a complicated task for a person to assign these IP addresses. The creation of DHCP solved this problem. There are many benefits of using DHCP, and some of them are listed below.
- DHCP reduces the chance of IP conflicts. Earlier a person has to do the assignment of IP addresses by hands which increased the probability that two devices will get the same IP address.
- Nowadays, nobody has to assign the IP addresses manually which make the administration easier.
- There is no need for a massive pool of IP addresses because it allows multiple devices to connect to a network for a period. For example- suppose there is a pool of 10 IP addresses then 10, 20 or more then that devices can easily connect to the network with those 10 IP addresses because these IP addresses get assigned for some time and if a device gets disconnected then the IP address of that device can be issued to another device.
Other benefits of using DHCP include configuring information about subnet masks, DNS servers and default gateways on the device.
Disadvantages of DHCP
With many useful features that a DHCP provides, there are some downsides to using DHCP.
- Single source of failure- if a single DHCP server is present there in the network and if it stops working, then no device will be able to connect with that network.
The devices with an IP address will request for a new one and device without the IP address will require one. They won’t be able to get anything since the DHCP server is not working therefore they won’t be able to connect to the network.
- Compromised security- if a rogue DHCP server is configured in your network by your ISP. Then they will be able to see what you are searching on the internet compromising your security. It is a type of cyber attack and is called the Man in a Middle Attack.
Over to you on “What is DHCP”
DHCP server forms the basis of the IP address distribution. Before the invent of DHCP, IP address allocation was a manual task for the network administrator but now DHCP servers are doing this work. Though the primary purpose of DHCP is to allocate IP addresses, but it can also perform other tasks like configuring the default gateway, DNS server and subnet mask information on the device. They can do this work in a faster and better way.