DHCP on CentOS 7/RHEL 7

In this Tutorial we are going to install DHCP (Dynamic Host Configuration Protocol) on CentOS 7.

What is DHCP?

DHCP Stands for Dynamic Host Configurations Protocol that is used to dynamically assign IP Addresses to Clients, on every device attached on network requires an IP Address to communicate with other devices.
If you notice when you connect to a network and you get an IP address automatically that is given by DHCP Server.



DHCP is a Service which is maintained by a server that could be Windows Server, Linux or your home router.
Note: Before going to jump in make it sure you already setup a static ip address on your computer which you are going to promote as DHCP server for your network.
Find out how to set up static ip address and Hostname in your linux Box.
How to set an ip address in CentOS
How to set Host name In CentOs

Step – 1

Open the terminal window and install DHCP package using yum command.

yum install dhcp -y


Edit the configuration file.

vi /etc/etc/dhcp/dhcpd.conf

Copy and paste below code into ‘/etc/dhcp/dhcpd.conf’ file, and change according to your desired settings.

# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.example
# see dhcpd.conf(5) man page
# Option definitions common to all supported networks
# Specify domain name
option domain-name “”;
# Specify name server’s hostname or IP address
option domain-name-servers;
# Default lease time
default-lease-time 600;
# Max lease time
max-lease-time 7200;
# This DHCP server Authoritative server in the Network.
subnet netmask {# Specify the range of lease IP address
range dynamic-bootp;
# Specify broadcast address
option broadcast-address;
# Specify default gateway
option routers;

Now Save and Exit the file.



Now its time to Enable and start the DHCP Service.

systemctl enable dhcpd

Start the service

systemctl start dhcpd

If you didn’t miss anything clients machines on your network now able to get automatic ip addresses from your DHCP server.
So, setup your client machine on “Obtain an IP Address Automatically” it should get an automatic ip addresses from the specified range in the DHCP server.

Here you can download the configuration file from below link.

Download : dhcpd.conf

Watch video version of this article

Hope it will help you out, if you have any question please speak in the comment box below.

Similar Posts