Thursday, 8 January 2015

Quick Start: Setup CentOS 7 as a DHCP Server

Quick Start: Setup CentOS 7 as a DHCP Server

In our EARLIER POST, we saw how to configure a DNS server on a CentOS 7 system. In this post, we will look at few simple steps that will help you create and configure a functional DHCP Server on your CentOS 7 system.

System Details:
Base OS:        CentOS 7 64 Bit (Minimal ISO)


First of all, make sure your system has a static IP address assigned to it and a fully qualified domain name.

Next, install the DHCP packages

# yum install dhcp

Edit the dhcpd.conf file and paste the contents as shown below:

# vi /etc/dhcp/dhcpd.conf

# 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 to be declared valid
# specify network address and subnet mask
subnet netmask {

# specify the range of lease IP address
range dynamic-bootp;

# specify broadcast address
option broadcast-address;

# specify default gateway
option routers;
Edit the values highlighted in RED and replace them with your own values. Save and exit the editor once done.

Start and enable the DHCP Service

# systemctl start dhcpd

# systemctl enable dhcpd

You can test your DHCP Server by spinning up another system on the same network. By default, the Network Interface is always set to DHCP so if your settings are right, you should automatically see the IP address for your new system as shown below.

There you have it! A simple DHCP server based on CentOS 7.. Hope this tutorial helps you out.. stay tuned for lots more coming your ways soon!!