Install and Configure DHCP Server on CentOS 6.x – RHEL 6.x

Updated on October 3, 2015
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)

What is DHCP?
DHCP stands for Dynamic Host Configuration Protocol. DHCP is a standardized network protocol used on Internet Protocol networks for dynamically distributing network configuration parameters, such as IP addresses for interfaces and services.

DHCP is configured in a server-client model. DHCP server is the one assigning IP Addresses to client computers on the network. Each client is assigned a unique IP Address. DHCP server has a number of IP Addresses available in it’s pool.

In this video tutorial, we will see how to install and configure DHCP Server on CentOS 6.x or RHEL 6.x

How to Install and Configure DHCP Server on CentOS 6 and RHEL 6

Related Article  Installing Red Hat Enterprise Linux 6.4 (RHEL 6.4) in VMware Workstation 9.0.2


1. Install DHCP
yum install dhcp
rpm -qc dhcp
/etc/dhcp/ – container for DHCPD configuration
/etc/dhcp/dhcpd.conf – IPv4 config
/var/lib/dhcpd – container for leases
/var/lib/dhcpd/dhcpd.leases – IPv4 leases

2. Enable DHCPD service
chkconfig dhcpd on

3. View dhcpd.conf file
cat /etc/dhcp/dhcpd.conf

4. Copy sample conf file to /etc/
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf

5. Edit the dhcpd.conf file and comment out unnecessary things
Configure scope for: – Usable IP Address

Note: Alter DHCPD to log using a different facility: i.e. ‘local6’ because boot messages are logged via: local7

6. Start DHCPD service
service dhcpd start

7. Release client’s IP configuration
dhclient -r or dhclient -r eth0 or ifdown eth0

Related Article  Install and Configure Secondary (Slave) BIND DNS Server - RHEL 6 - CentOS 6

8. Renew client’s IP configuration

dhclient or dhclient eth0 or ifup eth0
or service network restart

9. Show DHCP server that client gets its IP configuration
cat /var/lib/dhclient/dhclient.leases

  • hassan

    thank you

  • Julieto Asenjo

    I want to know what is the problem if the dhcp server steup does not run it is failed?

  • Ella Lenteria

    the problem arises that I can’t myself install dhcp using the command…PYCURL ERROR!!let me understand all this,thank you so much..I all had the entire time finding the solutions but it seemed that the situation’s far from being resolved.

  • Ella Lenteria

    merci beaucoup,this article be a great help!Godspeed.

  • John

    Hello I followed the instructions and even used the install script provided.
    In the end I got dhcpd to run but when I start another pc it does not get the ip assigned by my dhcp server.
    I am new to this and learning how to install a dhcp server that works for a school assignment.
    If anyone can help I will be so grateful because I am running out of time to finish this assignment and I really don?t get why it is not working.
    Here is my dhcp.conf:
    # /etc/dhcp/dhcpd.conf created by GeekPeek.Net scripts
    # Check /usr/share/doc/dhcp*/dhcpd.conf.sample for additional configuration parameters!

    # option definitions common to all supported networks…
    option domain-name “centos.local”;
    option domain-name-servers,;
    default-lease-time 600;
    max-lease-time 7200;

    # Use this to send dhcp log messages to a different log file (you also
    # have to hack syslog.conf to complete the redirection)
    log-facility local7;

    # This is a very basic subnet declaration.
    subnet netmask {
    option routers;

    I only have one CentOS 6.5 server running and one windows 7 pc running both I made with Vmware player and they both get use the Nat option on the network card in Vmware player.

    My CentOS 6.5 server has the following ip :
    And my win 7 :
    I am running both on my laptop.
    Here is the ifconfig on my CentoOS server:
    [root@localhost centos]# ifconfig
    eth0 Link encap:Ethernet HWaddr 00:0C:29:43:6A:38
    inet addr: Bcast: Mask:
    inet6 addr: fe80::20c:29ff:fe43:6a38/64 Scope:Link
    RX packets:481 errors:0 dropped:0 overruns:0 frame:0
    TX packets:358 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:137335 (134.1 KiB) TX bytes:31845 (31.0 KiB)
    Interrupt:19 Base address:0x2000

    lo Link encap:Local Loopback
    inet addr: Mask:
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:67 errors:0 dropped:0 overruns:0 frame:0
    TX packets:67 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:3510 (3.4 KiB) TX bytes:3510 (3.4 KiB)
    Here is the route command :
    [root@localhost centos]# route
    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface * U 1 0 0 eth0
    default UG 0 0 0 eth0

    here is the dhclient.leases :
    [root@localhost centos]# cat /var/lib/dhclient/dhclient.leases
    lease {
    interface “eth0”;
    option subnet-mask;
    option routers;
    option dhcp-lease-time 1800;
    option dhcp-message-type 5;
    option domain-name-servers;
    option dhcp-server-identifier;
    option broadcast-address;
    option domain-name “localdomain”;
    renew 2 2014/04/29 11:41:48;
    rebind 2 2014/04/29 11:54:38;
    expire 2 2014/04/29 11:58:23;
    Please help me understand why it is not assigning the dynamic ip to the win 7 that is within my range of
    range but instead it gives it
    I tried to used also other ip schemes such as 255.255.2550
    But then the dhcpd would fail with the following error :
    Apr 30 02:51:45 localhost dhcpd: No subnet declaration for eth0 (
    Apr 30 02:51:45 localhost dhcpd: ** Ignoring requests on eth0. If this is not what
    Apr 30 02:51:45 localhost dhcpd: you want, please write a subnet declaration
    Apr 30 02:51:45 localhost dhcpd: in your dhcpd.conf file for the network segment
    Apr 30 02:51:45 localhost dhcpd: to which interface eth0 is attached. **
    Not configured to listen on any interfaces!

    Hopefully someone can find out where I went wrong and point me in the right direction to get this working.
    Yours sincerely John.