Setting up dhcp server on linux according to your way

You will need dhcp3-server installed on Linux.

apt-get install dhcp3-server

The pool of your dhcp3-server can be configured in /etc/dhcp3/dhcpd.conf file. You can read the examples described in the configuration file. If you do not wish to modify this configuration file you can create one your self.

touch /home/dhcpd/dhcpd.conf

chown dhcpd:dhcpd /home/dhcpd/dhcpd.conf

nano /home/dhcpd/dhcpd.conf

Write the following according to your needs:

ddns-update-style none;

default-lease-time 600;

max-lease-time 7200;

authoritative; #if the Linux dhcp server is the official server on your local network.

log-facility local7;

subnet netmask {

option routers;

option domain-name-servers; #If your router is also your dns server.


Save the file ctrl+x.

If you want to use your own log for dhcpd in /tmp/

touch /tmp/dhcpd.log

chown dhcpd:dhcpd /tmp/dhcpd.log

If you want to create and use your own created pid location instead of /var/run/dhcp3-server/:

mkdir -p /var/run/dhcpd

chown -R dhcpd:dhcpd /var/run/dhcpd

touch /var/lib/dhcp3/dhcpd.leases

This makes the sub directory dhcpd as well as the contents inside owned by owner dhcpd and group dhcpd.

To start dhcp3-server according to your way:

dhcp3 -f -cf /home/dhcpd/dhcpd.conf -lf /tmp/dhcpd.log -pf /var/run/dhcpd/pid eth0

-f : run as a process

-cf : location of the config file

-lf : location of the log file

-pf : location of the process id file


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 )

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