CentOS 6 or Red Hat 6 | Install DHCP Server

By | 2012/12/10

On CentOS 6 or Red Hat 6, installing a DHCP server is not too difficult. I’ll show you how it works!

First, install the DHCP server:

$ sudo yum install dhcp

The configuration file (blank) is located here:


To copy a sample configuration file over for the production file, use the following command:

$ sudo cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf

Next edit /etc/dhcp/dhcpd.conf as needed, then save:

$ sudo nano /etc/dhcp/dhcpd.conf

For help on the syntax see the Red Hat doc here.

After making changes to the /etc/dhcp/dhcpd.conf file as needed, one other file must be changed to specify the NIC that dhcp listens on.

$ sudo nano /etc/sysconfig/dhcpd

# Command line options here

Finally, cross your fingers, and start DHCP:

$ sudo service dhcpd start

If upon starting the dhcp server it fails, check /var/log/messages to look for what is wrong.

$ sudo service dhcpd start
Starting dhcpd:                                            [FAILED]

$ cat /var/log/messages

Dec 10 08:15:35 centos dhcpd: No subnet declaration for eth0 (

Dec 10 08:21:36 centos dhcpd: bad range, address not in subnet netmask

Good luck!

One thought on “CentOS 6 or Red Hat 6 | Install DHCP Server

  1. Florine K. Guthrie

    Once you have a configuration running, where your two or more computers are setup using manually assigned IP addresses, check your dhcpsrv.ini file once more to make sure that everything that you entered manually appears in the dhcpsrv.ini file. After that, set the “Obtain an IP address from a DHCP server” in the network settings and reboot. If it’s not getting an IP address assigned, you need to compare the IP configuration of the manually configured with the automatically configured system. You can use the ipconfig/winipcfg tools. There has to be a difference! If you found that: try to manipulate the dhcpsrv.ini to let the server assign that option that was different in the two configurations.


Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.