top of page
Recent Posts

How to Install a DHCP Server in Red Hat Enterprise Linux 7

Updated: Oct 3, 2021

DHCP (Dynamic Host Configuration Protocol) is a network protocol that enables a server to automatically assign an IP address and provide other related network configuration parameters to a client on a network, from a pre-defined IP pool.

There are a lot of use cases for the DHCP service. Let install and configure the DHCP services:

Step1: To Install DHCP server packages

# yum -y install dhcp

Step2: Copy the sample configuration file to /etc/dhcp directory DHCP server

# rpm -qd dhcp
# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf 

Step3: To edit the /etc/dhcp/dhcpd.conf configuration file

# cat /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.example
#   see dhcpd.conf(5) man page

ddns-update-style interim;
default-lease-time 14400;
max-lease-time 14400;

# Specify Default Gateway
	option routers        ;
	option broadcast-address;
	option subnet-mask    ;
# Specify DNS server ip and additional DNS server IP address
	option domain-name-servers;
# Specify Domain Name
	option domain-name              "";
       option domain-search "","";

# Configuring subnet and IP address range
	subnet netmask {
     	pool {
# Static entries for servers
	 host bootstrap1 { hardware ethernet 52:54:00:95:32:cc; option host-name ""; fixed-address; }

# this will not give out addresses to hosts not listed above static entries
	#	deny unknown-clients;

# this will give out addresses to hosts not listed above static entries
		allow unknown-clients;

# this is PXE specific  
		filename "pxelinux.0";  
The man dhcpd.conf: command will help you to understand more on dhcpd.conf file that contains configuration information for dhcpd service.

Step4: To start the dhcpd service and make it start automatically on system reboot

# systemctl restart dhcpd
# systemctl is-active dhcpd

# systemctl enable dhcpd
# systemctl is-enabled dhcpd


1. If Firewalld service is running in the system, we need to open the firewall port in the system to accept the incoming request at the DHCP server.

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

2. If SELinux service is enabled with enforcing mode, and any issues in restarting the DHCP service due to file context.

# restorecon -v /etc/dhcp/dhcpd.conf
And man dhcpd.leases or tailf /var/lib/dhcpd/dhcpd.leases command to verify the DHCP client lease database.

Hope this post will help.

36 views0 comments

Recent Posts

See All


Log In to Connect With Members
View and follow other members, leave comments & more.
bottom of page