DHCP Install and Configure



DHCP stands for Dynamic Host Configuration Protocol. It handles the automatic assignment of IP addresses and other configuration settings for devices on your network.

Detail configuration steps (Centos 6.8):

  1. Ensure internet connected for this first time.
  2. Ensure selinux is disabled
  3. Ensure good entries in iptables (FIREWALL) or simply disable firewall
#service iptables stop        => firewall is disabled for now.

#chkconfig iptables off       => iptables will be off on every startup
  1. Update yum repositories and packages by typing the below command
[root@localhost ~]# yum update
  1. Install dhcp server and client using the below command
[root@localhost ~]# yum install dhcp
  1. Assign a static ip (eg: “”) in the same DHCP range for the listening interface ( eg : “eth0” ). Open /etc/sysconfig/network-scripts/ifcfg-eth0file and make the changes as per your requirement.
  1. Now open /etc/sysconfig/dhcpdfile and add the preferred interface name to DHCPDARGS variable as below
# Command line options here
  1. open /etc/dhcp/dhcpd.conffile and paste the below lines and save it.
#specify domain name
option domain-name "samajik.edu.np";

#specify DNS server ip and additional DNS server ip
option domain-name-servers,;

#specify default lease time
default-lease-time 600;

#specify Max lease time
max-lease-time 7200;

#specify log method
log-facility local7;

#Configuring subnet and iprange
subnet netmask {
option broadcast-address;

#Default gateway ip
option routers;
#Fixed ip address based on MAC id
host Printer01 {
hardware ethernet 02:34:37:24:c0:a5;
  1. Check configuration
#dhcpd –cf /etc/dhcp/dhcpd.conf

Above command shows error if configuration file contains any error with line number. If the file is of dhcpd service is just started.

  1. Start dhcpd service
#service dhcpd start          => simply starts dhcpd service

#chkconfig dhcpd on           => starts dhcpd service on every boot

dhcp server should now work

Now we can check dhcp working in live as:

Check log file continuously for latest updates:

By default dhcp server puts its log to messages file in /var/log/messages so,

#tail –f /var/log/messages

We can see updated entries as:


Thank you.

For more reading materials please click here