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 DHCP server to keep the record of all the IP addresses in case of reboot or even power failure. The DHCP server assigns an IP address to DHCP clients on a lease. The lease time depends upon the DHCP configuration or on 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 so 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 it broadcasts the request that it has accepted the IP address on the network.
- Then the DHCP server acknowledges the client system that it can now use the assigned IP address.
- This is the working of the DHCP server and this process is hence 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 need to make manually which is a difficult job to do. 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 to detect the unauthorized DHCP server present on the network.
- DHCP server helps to associate two or more dynamic IP address pools on different IP networks or the subnets.
- The configuration information is stored in the DHCP data store. Hence there is no need to log into the client to modify its configuration. Changes can be made by modifying the information present in the data store.
- If the router for the BOOTP relay is not present then the DHCP server can also be configured to act as a BOOTP relay agent.
- 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 to reduce the time necessary for configuring or reconfiguring the computers present on the network.
- Automatic assigning of IP addresses helps to avoid configuration errors that mostly arise due to 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 domain name of the client.
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.
4.5 (3,163 ratings)
This is a guide to DHCP Server in Linux. Here we discuss how to configure DHCP Server, advantages, and disadvantages of DHCP Server. You can also go through our other suggested articles to learn more –