How To Install And Configure DHCP Server in CentOS 8
How To Install And Configure DHCP Server in CentOS 8

How To Install And Configure DHCP Server in CentOS 8

In this tutorial, we learn about How to Install and configure DHCP Server in Centos 8. As we all know, to connect to a network, every computer requires an IP address. In small networks, it is not a problem to assign manually a different IP address to every computer, but when working with tens or hundreds of network devices, one has to be very careful, in order not to make mistakes. To make things easier, we could delegate this task to the DHCP service. What DHCP does is essentially provide IP addresses to all network devices. In fact, not only can it provide IP addresses, but also parameters, such as default gateway, DNS server, etc.

when the DHCP client boots up, it sends a DHCP to discover a message to the network. By this means, it tries to find an available DHCP server.
If there are one (or more) DHCP servers in the network, it will answer back with a DHCP offer message. When the client receives one of these DHCP offer messages, it will send back a DHCP request to the server.
The server, in turn, replies with a DHCP acknowledge message, and the address is assigned.

Bellow Image Explain About the DORA ( Discover, Offer, Request, Acknowledge)

First, provide a Static IP address to the DHCP server. Check Static IP Address in Centos 8 follow bellow Image.

Server IP Address is

Install DHCP Package:

[root@simi ~ ]# dnf install dhcp-server -y

Check DHCP Server Package Install Or Not.

Check DHCP Package Install Or NOT

Package is not installed, so we want to install packages.

Install DHCP Package

Now Package is Installed .

Displaying Install DHCP Package In CentOS 8

After a fresh install, /etc/dhcp/dhcpd.conf files remain empty now we can configure the file or Overwrite file form. /usr/share/doc/dhcp-server/dhcp.conf.example The easiest way to configure the new DHCP server is probably to overwrite the default (empty) configuration files with the sample files previously mentioned

Over Write Configure File From /usr/share/doc/dhcp-server/dhcp.conf.exampe

[root@simi ~]# cp /usr/share/doc/dhcp-server/dhcp.conf.exampe /etc/dhcp/dhcpd.conf

Over Write Configure File From /usr/share/doc/dhcp-server/dhcp.conf.exampe

This is the server’s main configuration file. This file has to be edit to create DHCP server.

[root@simi ~]# vim /etc/dhcp/dhcpd.conf

 DHCP Main Configuration File.

save and exit from Configuration File :

Option domain-name: Enter the domain name of your server.option domain-name-servers: Enter the DNS Server name OR IP of your server.

Lease time: the DHCP server will reserve the IP address for at least 600 seconds (default-lease-time) and at max 7200 seconds (max-lease-time) for Particulter Device, Other common values would be 86400 (one day), 604800 (one week), and 2592000 (30 days).

Start ,Enable and check the Services of DHCP Server

If firewall service is turned on allow it , DHCP Server use port number 67

[root@simi ~]# firewall-cmd –add-service=dhcp permanent [root@simi ~]# firewall-cmd –reload

Configure DHCP Client to get IP Address from DHCP Server:

First Install dhcp-client packaget if not installed (generally installed by default).

[root@simi ~]# dnf install dhcp-client -y

Install dhcp-client package in Client.Currently showing package installs

To change the network connection type nmtui in Terminal the Bellow screen displayed .

Clicking on the Edit a connection with the help of the keyboard Navigation Key and Press Enter .

Click ON enp0s3 and Hit Enter

Select Automatic as bellow .

Click On OK Button.


The second method is to get the IP Address from the DHCP Server. Type Bellow command .

Configure DHCP Client on Windows computer.

Open the network settings and select Internet Protocol Version 4 (RCP/IPv4) and Click On Properties Button

Check Box In Obtain IP Address Automatically and Click On OK.

Now Got The IP Address From DHCP Server.

This Tutorial we learn About Dhcp Server in Centos and Linux 8 Hopefully, all your doubts will be cleared with this tutorial. For any kind of doubt please comment me.