Updated August 19, 2023
What is DHCP Server in Linux?
DHCP refers to Dynamic Host Configuration Protocol. Each time the client systems connect to the network, the Dynamic Host Configuration Protocol allows them to get the network configuration information from the DHCP server in linux. The DHCP server is configured with other network configuration parameters required by the clients and the range of IP addresses. Other parameters may include Domain name servers (DNS), Default Gateways, Syslog Hosts, NTP servers, Proxy servers, and X Font servers.
DHCP server maintains the record of all IP addresses and stores them in /var/lib/dhcp directory under the file name dhcpd. leases. This file helps the DHCP server record all the IP addresses in case of reboot or power failure. The DHCP server assigns an IP address to DHCP clients on a lease. The lease time depends on the DHCP configuration or how long the client system needs the connection.
How does DHCP Server Work in Linux?
DHCP server performs a series of steps or a process as it performs its tasks. This process is called the DORA process (Discover Offer Request Acknowledgement).
- When a new system or computer connects to a network, it searches the DHCP server in a network. As it does not have an IP address, it does not find a DHCP server, so it sends the DHCP to discover messages to all the devices connected to the network. This process is known as Broadcasting.
- When the DHCP server receives the DHCP discover message sent by the new system or client, then the DHCP server offers an IP address and broadcast it to all the connected devices.
- The client computer or system receives the IP address and then broadcasts the request that it has accepted the IP address on the network.
- Then the DHCP server acknowledges that the client system can now use the assigned IP address.
- This is the DHCP server’s working process, which is called DORA (Discover Offer Request Acknowledgement).
- DHCP helps in IP address management. It helps to prevent problems related to duplicate IP addresses. Without DHCP, IP addresses need to be assigned manually. During assigning, you need to keep in mind that every client gets a unique IP address, and if the client shifts to another network, then change must be made manually,y which is a difficult joo. DHCP helps to overcome this tiresome job as it assigns and manages the IP addresses without the administrator’s intervention.
- The DHCP server provides support to BOOTP clients, i.e., clients can easily change their network from BOOTP to DHCP. The DHCP server can respond to the requests of both the DHCP clients as well as BOOTP clients. BOOTP clients receive the information and required an IP address to boot from the server.
- DHCP server helps the administrator to set lease time for the allocated IP addresses, whether allocated manually or not.
- Configuring each client manually with the IP address is not required.
- The DHCP server helps detect the unauthorized DHCP server on the network.
- DHCP server helps to associate two or more dynamic IP address pools on different IP networks or subnets.
- The configuration information is stored in the DHCP data store. Hence, logging into the client is unnecessary to modify its configuration. Modifying the information present in the data store allows for making changes. In the absence of a router for the BOOTP relay, configuring the DHCP server to act as a BOOTP relay agent is an alternative option.
- There is no need to use RARP (Reverse Address Resolution Protocol), or bootparams file to obtain the required information to boot from a server on the network, a client can use the DHCP server to perform the task.
- DHCP server allows multithreading to handle many clients simultaneously.
- If any client is offline, then the DHCP server helps to reassign the IP address of that client to another client or computer.
- It helps reduce the time necessary for configuring or reconfiguring the computers on the network.
- Automatic assigning of IP addresses helps avoid configuration errors that mostly arise from entering IP address information manually.
- It is easy to use and supports any operating system that supports DHCP.
How to Configure DHCP Server?
Starting in the privileged EXEC mode, the following commands must be used in sequence to configure the DHCP (Dynamic Host Configuration Protocol) Server:
1. Configure Terminal: This command allows entering the global configuration mode.
2. IP dhcp Pool: This command creates a DHCP server address pool and allows entering DHCP pool configuration mode.
3. Network (Network Number Mask): This command specifies the network number of the subnet and the mask of the DHCP address pool.
4. Domain – Name Domain: This command specifies the client’s domain name.
5. DNS Server Address: This command specifies the IP address of a DNS server available for the DHCP client.
6. Default – Router Address: This command specifies the IP address of the default router of the DHCP client.
7. Exit: This command allows returning to the privileged EXEC mode.
8. Service dhcp Interface Type Number: This command enables the DHCP server on the interface.
In this article, we have discussed the working, advantages, and the way to configure the DHCP server. DHCP server basically allows assigning IP addresses automatically to the client systems present on the network. This is easy and simple to use and reduces the time of configuring and reconfiguring the IP addresses.
We hope that this EDUCBA information on “DHCP Server in Linux” was beneficial to you. You can view EDUCBA’s recommended articles for more information.