ISC DHCP Server Configuration

The DHCPD server is a server that allows DHCP clients to connect to the server, and request IP addresses and gateway/DNS information. DHCP is used in most large networks as a means of easily managing IP addresses. Linux has a server of its own, creatively called DHCPD. DHCPD is available from the Internet Software Consortum’s website at The server should also be available from your distribution however, so check with your distribution first.
ISC only supplies standard tarball packages, so if your distribution does not supply the DHCPD package, you will have to use the ISC’s package. Download the file and extract it using the following two commands:

gunzip dhcpd-version.tar.gz
tar -xvf dhcpd-version.tar

Make sure to replace version with the actual version. Now, perform the following commands:

cd dhcpd-version
make install

DHCPD should install flawlessly, if not then you should complain to the mailing list on the ISC’s website. We will only have to perform three tasks with DHCPD, the first is to edit the configuration file. Place the following text in your /etc/dhcpd.conf file:

# /etc/dhcpd.conf by Christopher Pace
ddns-update-style ad-hoc;
default-lease-time 259200;
max-lease-time 300000;
option subnet-mask;
option routers;
option domain-name-servers;
subnet netmask

Of course you will want to substitute the routers, domain-name-servers, netmask, and range with what is for your network. For instance, I have a network that I use DHCP to assign a total of 60 IP addresses. This range is from .20-.40, and from .50-.90. DHCPD will only assign IP addresses within this range, as I like to keep .1-.19, .41-.49, and .91-.254 free for servers and such. The ‘default-lease-time’ and ‘max-lease-time’ settings are used to specify how long the DHCP lease will last if the client doesn’t request extra time (default), and if it requests the max time (max). This time is in seconds. If you want to have a static IP assigned to a host, then you can use the following syntax in your /etc/dhcpd.conf file:

host Joe {hardware ethernet

This will assign the IP of to Joe each time that it requests an IP. The MAC address is the ‘hardware ethernet’ address.

Now then, we move along to the next step, creating the /var/state/dhcp/dhcpd.leases file:

touch /var/state/dhcp/dhcpd.leases

Now, we will start DHCPD, to test it out. First, if you are currently using another DHCP server on your network, disable that one. Next, run the following:


Finally, start up a DHCP client (if you are using Windows 98/2000/XP/NT, you can use the ipconfig command to release the IP and then renew it by typing:

ipconfig /release_all
ipconfig /renew_all

This should take a while, as the DHCP client is searching for the original server. After a while, it will time out, and then query the network for any DHCP servers, finding our Linux one. Now, once you are sure that DHCPD works, we should create an init script for DHCPD. This is used to start, restart, and stop the DHCPD service. Also, this init script will be automatically run at boot to start DHCPD. Place the following text in /etc/init.d/dhcpd:

# /etc/init.d/dhcpd file by Christopher Pace
case “$ 1” in
echo -n “Starting DHCPD Daemon: dhcpd”
start-stop-daemon –start –quiet –exec /usr/sbin/dhcpd
echo “.”
echo -n “Stopping DHCPD Daemon: dhcpd”
killall -9 dhcpd
echo “.”
echo -n “Restarting DHCPD Daemon: dhcpd”
killall -HUP dhcpd
echo “.”
echo “Usage: /etc/init.d/dhcpd {start|stop|restart|reload|force-reload}” >&2
exit 1
exit 0
You should now:
chmod 700 /etc/init.d/dhcpd
update-rc.d dhcpd defaults

If you run a different system then listed, you should check with your distribution on how to properly tell the system to use the init file you just made. On some systems, simply chmod-ing the init file will work. Also, some systems only have a /etc/rc.d directory, where the init file should be placed in the run levels associated with start up, halt, and so forth. Read the FAQs that your distribution has as to which run levels are for which tasks, as some distributions tend to go against POSIX.

DHCP is a useful client, but when routers are shipped with DHCP server capabilities, too often the DHCP server is stripped-down, leaving the many options that DHCPD offers missing. Thus, it is necessary to have DHCPD instead of these stripped-down servers, in order to satisfy particular needs. For instance, I need 60 DHCP-assigned addresses, in two different IP ranges. Thus, I would recommend DHCPD for anyone who needs a truly customizable DHCP server.

Christopher J. Pace is a freelance Linux consultant who has worked with Linux since 2001. Currently, he provides remote Linux consulting services for sick servers.

Leave a Reply

Your email address will not be published. Required fields are marked *

Protected with IP Blacklist CloudIP Blacklist Cloud