Linux Server How To

How To Setup, Configure, Manage and Secure a Linux Server


Linux Server How To - Compile DHCPD From Source


Download the DHCPD Source Distribution

Compiling DHCPD from source is not much harder than using a package manager such as apt-get. Log into your Linux server with your user account and create a directory that you can download the source distribution for DHCPD to, unpack it and compile it.

Download the source distribution from www.isc.org into your working directory.

$ wget http://ftp.isc.org/isc/dhcp/dhcp-3.1.3.tar.gz

Unpack the source distribution.

$ gzip -cd dhcp-3.1.3.tar.gz | tar xvf -

Change into the directory that contains the uncompressed source code and compile DHCPD.

$ cd dhcp-3.1.3
$ ./configure
$ make
$ su root
password:
# make install

This will install the DHCP daemon onto your Linux server as /usr/sbin/dhcpd and it can be configured by editing /etc/dhcpd.conf. The DHCP server can be started by typing-

# dhcpd

Quick Configuration

Once you have compiled DHCPD and attempted to start it you most likely found that it did not work! Although Linux Server How To features a more thorough guide to configuring your Linux DHCP server on Configuring DHCPD the example dhcpd.conf below will get your installation started with some basic parameters.

ddns-update-style none;

# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers 192.168.10.100, 192.168.10.110;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# 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 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.150 192.168.10.200;
option routers 192.168.10.1;
}

The above example dhcpd.conf will work quite acceptably and supplies the basic information required to get your DHCP clients accessing the internet via a gateway. You will have to change the IP addresses specified here to suit your network.