About | Home | Search


HOWTO: dhcp
Description: ISC Dynamic Host Configuration Protocol client and server
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# ISC DHCP 3.1.3
# ==============
# Slackware 12.0: dhcp 3.0.5
# Slackware 12.1, 12.2: dhcp 3.0.6
# Slackware 13.0: dhcp 3.1.2p1

# When upgrading from one DHCP version to another, you may need to blow away
# (or modify) your old leases file due file format incompatibilities between
# versions.  Check the release notes for differences between the version
# that you're running and the one you're about to install.

# There are also 4.0.x and 4.1.x releases available, but I'm sticking with
# this one for right now.  I will probably add a 2nd release to this howto
# next time I update it.  Version 3.0.x is EOL as of March 2009.

cd
test -f installed/dhcp-3.1.3.tar.gz &&
 mv installed/dhcp-3.1.3.tar.gz .
test ! -f dhcp-3.1.3.tar.gz &&
 wget ftp://ftp.isc.org/isc/dhcp/dhcp-3.1.3.tar.gz

# Verify tarball w/ md5sum:
# (this came from my gpg-verified tarball)
echo "6ee8af8b283c95b3b4db5e88b6dd9a26  dhcp-3.1.3.tar.gz" | md5sum -c

# Verify tarball w/ sha1sum:
# (this also came from my gpg-verified tarball)
echo "92fea5036c38a840f2f944b6cd1d90b18f950b7c  dhcp-3.1.3.tar.gz" | \
 sha1sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 0B7BAE00 > /dev/null 2>&1 || gpg --recv-keys 0B7BAE00 ) &&
 wget -nc ftp://ftp.isc.org/isc/dhcp/dhcp-3.1.3.tar.gz.sha512.asc &&
  gpg --verify dhcp-3.1.3.tar.gz.sha512.asc dhcp-3.1.3.tar.gz &&
   rm dhcp-3.1.3.tar.gz.sha512.asc

mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "dhcp-*" -exec rm -r {} \;
tar xzvf ~/dhcp-3.1.3.tar.gz
cd dhcp-3.1.3
test $UID = 0 && chown -R root:root .

# Read ./README and ./RELNOTES

./configure
make

# Become root to install it
su

# Back up your existing dhclient.conf, dhcpd.conf, and leases file
# (if it's more than 0 bytes)
mkdir -p -m 0700 ~/backup
test -f /etc/dhclient.conf && cp -a /etc/dhclient.conf ~/backup/
test -f /etc/dhcpd.conf && cp -a /etc/dhcpd.conf ~/backup/
test -s /var/state/dhcp/dhcpd.leases &&
 cp -a /var/state/dhcp/dhcpd.leases ~/backup/

# Remove the Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg dhcp

# You may have an old /etc/dhclient.conf and /etc/dhcpd.conf left
# over from the Slackware package, and the old /var/state/dhcp
# directory will still be there.  removepkg won't remove those.

# Install the new version
make install
touch /var/state/dhcp/dhcpd.leases

# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .

## If you use dhcpd and don't have another script already set to start
## it on boot-up, add something like this to /etc/rc.d/rc.local:
# if [ -s /etc/dhcpd.conf -a -x /usr/sbin/dhcpd ]; then
#   echo "Starting dhcpd..."
#   /usr/sbin/dhcpd -q
# fi  

# Become yourself again:
exit

cd
mkdir -p -m 0700 installed
rm -f installed/dhcp-*.tar.*
mv dhcp-3.1.3.tar.gz installed/

# Check out sample client configuration:
#   ~/src/dhcp-3.1.3/client/dhclient.conf
# Read 'man dhclient' and 'man dhclient.conf'
#
# Check out sample server configuration:
#   ~/src/dhcp-3.1.3/server/dhcpd.conf
# Read 'man dhcpd' and 'man dhcpd.conf'

# Here is a sample /etc/dhclient.conf that I use with dhclient to get a
# dynamic IP address from my cable internet provider (Comcast).
#
# interface "eth0" {
#   supersede domain-name "englanders.us";
#   prepend domain-name-servers 192.168.123.2, 192.168.123.1;
#   require subnet-mask, routers;
# }
#
# It causes a few things to be changed in /etc/resolv.conf  It uses my
# domain instead of theirs, and it lists my internal DNS servers
# (192.168.123.x) before theirs (1.2.3.x).  Here's an example of a
# resolv.conf that it creates:
#
# search englanders.us
# nameserver 192.168.123.2
# nameserver 192.168.123.1
# nameserver 1.2.3.4
# nameserver 1.2.3.5
# nameserver 1.2.3.6

# My dhcp server configuration is way too complicated to post here, I use
# failover, dynamic DNS, etc.  If you'd like to see it, e-mail me and I'll
# send it to you.

# If you ever need to uninstall DHCP, run this:
su
test -f /etc/dhcpd.conf &&
 ( mkdir -p -m 0700 ~/backup ; mv -f /etc/dhcpd.conf ~/backup/ )
rm -f /usr/bin/omshell /usr/local/include/dhcpctl.h /usr/man/man1/omshell.1
( cd /sbin ; rm -f dhclient dhclient-script )
test -d /usr/local/include/isc-dhcp && rm -r /usr/local/include/isc-dhcp
test -d /usr/local/include/omapip && rm -r /usr/local/include/omapip
( cd /usr/local/lib ; rm -f libdhcpctl.a libomapi.a )
( cd /usr/man/man3 ; rm -f dhcpctl.3 omapi.3 omshell.3 )
( cd /usr/man/man5 ; rm -f dhclient.conf.5 dhclient.leases.5 dhcp-eval.5 \
  dhcp-options.5 dhcpd.conf.5 dhcpd.leases.5 )
( cd /usr/man/man8 ; rm -f dhclient.8 dhclient-script.8 dhcpd.8 dhcrelay.8 )
( cd /usr/sbin ; rm -f dhcpd dhcrelay )
test -d /var/state/dhcp &&
 ( cd /var/state/dhcp ; rm -f dhcpd.leases dhcpd.leases~ )
exit
find ~/src -maxdepth 1 -type d -name "dhcp-*" -exec rm -r {} \;
rm -f ~/installed/dhcp-*.tar.*

Back to the list


Last updated: Fri, 26 Mar 2010 13:18:56 -0400
Jason Englander <jason at englanders dot us>