Install and configure DHCP server on CentOS / RHEL / Scientific Linux

Posted: February 17, 2014 in DHCP
Tags: ,

DHCPDynamic Host Configuration Protocol (DHCP) is a client/server protocol that automatically provides an Internet Protocol (IP) host with its IP address and other related configuration information such as the subnet mask, default gateway and DNS details automatically to the clients. We need a DHCP Server configured for offering IP address to the clients when they required.

1. Provides automatic configuration of IPv4 clients
a. IPv4 address
b. Subnet mask
c. Default gateway
d. DNS Servers
e. NTP Servers
f. WINS Servers
2. Leases the address and related information bassed o predefined values:
a. 1 day
b. 1 week
c. 1 month
3. DHCP uses UDP Protocol and layer-2 information to request/assign addresses
4. DHCP Process – DORA

a. Discovery – client broadcasts on the local subnet for a DHCP Server
b. Offer – returned by the DHCP Server
c. Request – formal address request by client
d. Acceptance – Acknowledgement occurs
Note: DHCPD records leases in: /var/lib/dhcpd/dhcpd.leases
Step 1 : Install the DHCP server and client using the below command
[root@webmail ~]# yum install dhcp

Step 2 : After installing dhcp server packages along with dependencies. Assign a static ip (eg: “″) in the same DHCP range for the listening interface ( eg : “eth0″ ). Open /etc/sysconfig/network-scripts/ifcfg-eth0 file and make the changes as per your requirement .


Step 3 : Now open /etc/sysconfig/dhcpd file and add the preferred interface name to DHCPDARGS variable as below

# Command line options here

Step 4 : open /etc/dhcp/dhcpd.conf file and paste the below lines and save it.

subnet netmask {# — default gateway
option routers                 ;
option subnet-mask         ;
option nis-domain                      “”;
option domain-name                  “”;
option domain-name-servers,;range dynamic-bootp;
default-lease-time 21600;
max-lease-time 43200;
# we want the nameserver to appear at a fixed addresshost ns {
hardware ethernet 12:34:56:78:MN:MD;



Step 5 : Now start the service

[root@webmail ~]# service dhcpd start

and type this below command to start dhcp service automatically while booting.

[root@webmail ~]# chkconfig --levels 235 dhcpd on

That’s it .Clients can now get IP from DHCP server.

  1. […] Install and configure DHCP server on CentOS / RHEL / Scientific Linux […]

  2. Abhiram says:

    Hello There,

    In debt to you for making my learning on the Install and configure DHCP server area so hassle-free! I lay my faith on your writings.

    When I first got Linux Ubuntu 12.04 LTS it used to only display on the VGA connection and not HDMI, a few days later when I discovered how to install my video card’s drivers for Linux, I installed it and it immediately switched to the HDMI connection….

    It was cool to see your article pop up in my google search for the process yesterday. Great Guide.
    Keep up the good work!

    Thank you,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s