Revision as of 07:20, 12 July 2014 by Craig Peacock (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Internet Systems Consortium (ISC) DHCP

Internet Systems Consortium (ISC) DHCP offers both an IPv4 and IPv6 DHCP (Dynamic Host Configuration Protocol) Client and Server.

The DHCP source includes a copy of ISC Bind and will build the BIND Export Libraries required for DHCP. Cross Compiling the BIND libraries are problematic for two reasons. First, the host and target parameters are not passed to Bind's Configure. Secondly, once BIND has been configured for cross compiling, there is an executable (gen) that is cross-compiled, but executed on the build machine.

To overcome these two issues, two patch files have been created.

To build ISC DHCP, download the source and the patches:

wget ftp://ftp.isc.org/isc/dhcp/4.3.0b1/dhcp-4.3.0b1.tar.gz
wget http://wiki.beyondlogic.org/patches/dhcp-4.3.0b1.bind_arm-linux-gnueabi.patch
wget http://wiki.beyondlogic.org/patches/bind-9.9.5rc1.gen_crosscompile.patch
tar -xzf dhcp-4.3.0b1.tar.gz

Now we patch the makefile that is responsible for building BIND. The patch adds the --host=arm-linux-gnueabi --target=arm-linux-gnueabi --build=i686-pc-linux-gnu parameters to configure, and specifically tells it to use /dev/random:

cd dhcp-4.3.0b1
patch -p1 < ../dhcp-4.3.0b1.bind_arm-linux-gnueabi.patch 

Next we need to correct the makefile responsible for compiling gen.c. As the BIND source has not yet been uncompressed, we must first extract it prior to patching:

cd bind
tar -xzf bind.tar.gz
cd bind-9.9.5rc1
patch -p1 < ../../../bind-9.9.5rc1.gen_crosscompile.patch 
cd ../..

Now we should be all set to configure and cross-compile DHCP:

./configure --host=arm-linux-gnueabi --prefix= --build=i686-pc-linux-gnu ac_cv_file__dev_random=yes 
make
make install DESTDIR=/home/export/rootfs

Configuring DHCP

During install, two sample configuration files will be placed in /etc.

If running DHCPd, it may complain it is unable to open the leases database:

Can't open lease database /var/db/dhcpd.leases: No such file or directory --
  check for failed database rewrite attempt!

If so, create a blank lease file:

touch /var/db/dhcpd.leases

Once your configuration file is ready to go, you can start an IPv4 DHCP server by:

# /sbin/dhcpd -cf /etc/dhcpd.conf
Internet Systems Consortium DHCP Server 4.3.0b1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
Listening on LPF/eth0/00:10:75:2a:71:cc/192.168.0.0/24
Sending on   LPF/eth0/00:10:75:2a:71:cc/192.168.0.0/24
Sending on   Socket/fallback/fallback-net

If you get a message:

irs_resconf_load failed: 30.

Check your /etc/resolv.conf file exists.

Download pre-built binaries

The link below contains a bzip2 tarball of ISC dhcp compiled for ARM: