How to Install and Configure DHCP Server on Centos 6

By | February 28, 2016
Install and configure DHCP Server on Centos 6 - #ilovebash

Install and configure DHCP Server on Centos 6 – #ilovebash

How to Install and Configure DHCP Server on Centos 6

DHCP Server – DHCP (Dynamic Host Configuration Protocol) is the protocol used to assign IP addresses (and gateway and DNS servers) to new clients on a specific local network.

Installation of DHCP Server on Centos 6

As a first step you should ensure that your operating system software is up to date using yum –

yum update

Step 2 – Install DHCP Server and client

yum install dhcp

Step 3 – Configuring DHCP interface

You need to ensure that your server has an IPADDR on the network you want to act as a DHCP Server for. Check your interface files in /etc/sysconfig/network-scripts as below –

[root]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

You can see from the above that your interface you want to use is eth0, and that it can provide ip addresses for the network.

Step 4 – Configure DHCP Server to use eth0 as the interface for ip address allocation

Edit the file /etc/sysconfig/dhcpd and set the line as below –


Step 5 – Configure your DHCP Server network, ip range, and gateway

Next file to edit is /etc/dhcp/dhcpd.conf and set the following –

option domain-name "";
option domain-name-servers,;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;

subnet netmask {
option broadcast-address;
option routers;

As you can see the parameters above are pretty self explanatory. In the above example I have specified Google Public DNS servers ( and for convenience, you can just as well specify your own local DNS Servers.

The above example also allocates the ip range from – for the DHCP Server to use to allocate to client connections.

And I have set the option routers to the default route needed (copied from my ifcfg-eth0 file)

One mistake it is easy to make is to forget to put the semi-colon on the end of each line (it will be obvious to you if it fails to start on the next step)

Step 6 – Start the DHCP Server Service

service dhcpd start

Step 7 – And configure DHCP to auto start after a server reboot

chkconfig dhcpd on

Thats it. You can see debug messages as new clients use your DHCP Server in the system messages file /var/log/messages as well as any error messages it encounters.

Check out -  Run cron job every 90 mins (minutes) - Linux Scheduling, Batch Automation, Scheduled Jobs

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.