This guide will walk you through the steps to install DHCP Server & DHCP Client on CentOS 8 / RHEL 8 Linux server. If your question is how do I Install and Configure DHCP Server on CentOS 8 / RHEL 8?, then this guide is for you. A DHCP Server deployed in your organization can really make your network management a breeze. You can put to rest the hurdles of manually assigning IP addresses on every machine in your organization, and let a DHCP Server do this task that can get quite boring and unnecessarily repetitive.

In this guide, we are going to install and configure a DHCP Server and Client in CentOS 8 / RHEL 8 machine. We’ll cover both the server side setup and all the client side configurations required. Let’s start the configuration of DHCP ( Dynamic Host Configuration Protocol ) Server to assign IP addresses to client hosts in our local network.

Step 1: Install DHCP Server on CentOS 8 / RHEL 8

Install DHCP server package using the dnf installer.

sudo dnf -y install dhcp-server 

This will install any dependency required to run DHCP Server on CentOS 8 / RHEL 8.

Step 2: Configure DHCP Server on CentOS 8 / RHEL 8

Edit the DHCP server configuration file on CentOS 8 / RHEL 8.

sudo vi /etc/dhcp/dhcpd.conf 

My configuration file will be populated with these parameters:

  • Domain name:
  • DNS Server:
  • DHCP network:
  • DHCP Subnet mask:
  • Range of IP addresses to allocate:
  • Default gateway:
  • DHCP Lease Time: 600
  • DHCP Maximum Lease Time: 7200

The DHCP server configuration file looks like this:

# Set DNS name and DNS server's IP address or hostname
option domain-name     "";
option domain-name-servers;

# Declare DHCP Server

# The default DHCP lease time
default-lease-time 600;

# Set the maximum lease time
max-lease-time 7200;

# Set Network address, subnet mask and gateway

subnet netmask {
    # Range of IP addresses to allocate
    range dynamic-bootp;
    # Provide broadcast address
    option broadcast-address;
    # Set default gateway
    option routers;

Start and enable the dhcpd service after making the changes in the configuration file.

sudo systemctl enable --now dhcpd

If you have firewalld running, allow the service port to be accessible from your network.

sudo firewall-cmd --add-service=dhcp --permanent 
sudo firewall-cmd --reload

Step 3: Configure DHCP Client

Install DHCP client in your Linux machine to get an IP address automatically.

----------- CentOS 8 / RHEL 8 / Fedora -----------
$ sudo dnf -y install dhcp-client 

----------- CentOS 7/6 -----------
$ sudo yum -y install dhcp-client

Manually request for DHCP IP address

You can use dhclient command to request for an IP address manually.

$ sudo dhclient <interface>
$ sudo dhclient eth0

# Confirm
$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:10:47:63 brd ff:ff:ff:ff:ff:ff
    inet brd scope global noprefixroute dynamic eth0
       valid_lft 3594sec preferred_lft 3594sec
    inet6 fe80::5054:ff:fe10:4763/64 scope link 
       valid_lft forever preferred_lft forever

Persist configurations – CentOS / RHEL / Fedora with systemd

  • Edit configurations with nmcli
nmcli connection modify ${ifname} ipv4.method auto
nmcli connection down ${ifname}; nmcli connection up ${ifname}
  • Manually edit network configuration file
$ sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0

Persist configurations – Debian

$ sudo nano /etc/network/interfaces
iface ens3 inet dhcp

$ sudo systemctl restart [email protected]

Persist configurations – Ubuntu

$ sudo nano /etc/netplan/01-netcfg.yaml
  version: 2
  renderer: networkd
      dhcp4: yes

$ sudo netplan apply 

For Windows users, check Configuring Windows Client to Obtain IP from DHCP Server

Reserving IP address on DHCP Server

You can reserve an IP address for a computer or device in your network if you have its MAC address:

$ sudo vi /etc/dhcp/dhcpd.conf
# Add lines like below for each host
host myserver {
    hardware ethernet 00:50:56:8c:20:fd;

Related guides:

Install and Configure DHCP Server on Windows Server 2019

How To add FTP Site on Windows Server 2019

How To Setup a TFTP server on CentOS 8 / RHEL 8 Linux

How To Configure iSCSI Initiator on CentOS 8 / RHEL 8

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here