# ISC DHCP is End Of Life (EOL) as of the end of 2022
# See Kea DHCP
# When upgrading from one DHCP version to another, you may need to blow away
# (or modify) your old leases file due to 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.
# FYI, there are also ESV (extended support versions) now. If you are
# installing this on a server that is neglected most of the time, that
# may be the way to go. Only critical bug and security fixes are added to
# those, so you are less likely to have issues due to new features.
# Get it
cd
test -f installed/dhcp-4.4.3-P1.tar.gz &&
mv installed/dhcp-4.4.3-P1.tar.gz .
test ! -f dhcp-4.4.3-P1.tar.gz &&
wget https://downloads.isc.org/isc/dhcp/4.4.3-P1/dhcp-4.4.3-P1.tar.gz
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "0ac416bb55997ca8632174fd10737fd61cdb8dba2752160a335775bc21dc73\
c7 dhcp-4.4.3-P1.tar.gz" | sha256sum -c
# If you don't have the key and can't get it via --recv-keys below,
# import keys from here:
# https://www.isc.org/pgpkey/
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "dhcp-*" -exec rm -r {} \;
tar xzvf ~/dhcp-4.4.3-P1.tar.gz
cd dhcp-4.4.3-P1
test $UID = 0 && chown -R root:root .
# Read ./README and ./RELNOTES
# The configure here is now an autoconf one
# I use --disable-dhcpv6 below because I don't use IPv6
# If you don't pass --with-srv-lease-file as below, it will end up as
# /var/db/dhcpd.leases
# For chroot: --enable-paranoia and --enable-early-chroot
# To build it against your system-wide libbind (from BIND),
# pass --with-libbind=PATH
# otherwise it will use ./bind/, which may be easier if your includes are
# not in the right places...
# For OpenLDAP support: --with-ldap --with-ldapcrypto
# Back up your existing dhclient.conf, dhcpd.conf, and leases file
# (if it's more than 0 bytes)
mkdir -p -m 0700 ~/backup/dhcp
test -f /etc/dhclient.conf &&
cp -a /etc/dhclient.conf ~/backup/dhcp/dhclient.conf-$(date +%Y%m%d)
test -f /etc/dhcpd.conf &&
cp -a /etc/dhcpd.conf ~/backup/dhcp/dhcpd.conf-$(date +%Y%m%d)
test -s /var/state/dhcp/dhcpd.leases &&
cp -a /var/state/dhcp/dhcpd.leases ~/backup/dhcp/dhcpd.leases-$(date +%Y%m%d)
# 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' in 4.2.4-P2 blew away my /etc/dhcpd.conf, so make sure
# you really did back up yours above before running it
make install
touch /var/state/dhcp/dhcpd.leases
# Make sure your non-root user can remove the source later
chown -R $(logname) .
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
## Make sure you read 'man dhcpd' if you don't want it listening to
## all interfaces, or only specific IPs, to run in the foreground, or
## anything like that.
##
# if [ -s /etc/dhcpd.conf -a -x /usr/sbin/dhcpd ]; then
# echo "Starting dhcpd..."
# /usr/sbin/dhcpd -q
# fi
# Check out sample client configuration - ./client/dhclient.conf
# Read 'man dhclient' and 'man dhclient.conf'
#
# Check out sample server configuration - ./server/dhcpd.conf
# Read 'man dhcpd' and 'man dhcpd.conf'
# Make sure you run 'dhcpd -t' before restarting dhcpd :-)
## Here is a sample /etc/dhclient.conf that I used to use with dhclient to
## get a dynamic IP address from my former Internet provider.
#
# 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
# I change around my DHCP server configuration pretty often. I do not
# currently, but I have at times used dynamic DNS, failover, and other
# total overkill features for my home server. To figure it all out for
# a client is usually why. If you would like to see any of my old
# configurations, e-mail me.
# Become yourself again:
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/dhcp-*.tar.*
mv dhcp-4.4.3-P1.tar.gz installed/
# If you ever need to uninstall DHCP, run this to hopefully cover all bases:
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.*