DHCP Server V3.0.5 No BPF under chroot. Works normally otherwise.

Martin McCormick martin at dc.cis.okstate.edu
Wed Mar 7 12:29:44 UTC 2007


	I also posted this message to the FreeBSD Questions list
since the problem may be FreeBSD specific as to how I am setting
up the bpf device.


	I found some cook-book instructions for running dhcpd in
a chroot environment.  The article is 4 years old and appears to
be set up for FreeBSD5x, but it isn't far off for FreeBSD6.2
which is what I need dhcpd to run on.

	Dhcpd runs fine when started normally as in
/usr/local/sbin/dhcpd.  I haven't yet gotten it to launch as the
chroot'ed version.  When one starts it, here is what happens:

   chroot /usr/local/chroot/dhcpd /usr/local/sbin/dhcpd

Internet Systems Consortium DHCP Server V3.0.5
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
WARNING: Host declarations are global.  They are not limited to the scope you d
eclared them in.
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
No bpf devices.   Please read the README section for your operating system.

	If I do a ls, everything looks identical:

cd /usr/local/chroot/dhcpd/dev
ls -l bpf*
crw-------  1 root  wheel    0,  96 Mar  6 11:44 bpf0
crw-------  1 root  wheel    1,  97 Mar  6 11:44 bpf1

cd /dev
ls -l bpf*
crw-------  1 root  wheel    0,  96 Mar  5 21:00 bpf0
crw-------  1 root  wheel    0,  97 Mar  5 21:00 bpf1

The part of the script that makes those devices is as follows:

BPF="`ls -l /dev/bpf0 | awk '{ print $6; }' | sed -e 's/,//g'`"
export BPF
BPF1="`ls -l /dev/bpf1 | awk '{ print $6; }' | sed -e 's/,//g'`"
export BPF1
cd /usr/local/chroot/dhcpd/dev
mknod bpf0 c 0 $BPF
mknod bpf1 c 1 $BPF1
chmod 0600 bpf*

	I will post the script when it works since it appears to
be about 90% good.  It needs a little touch-up to make it work
for FreeBSD6.

	My guess is that there is something else I need in the
chroot environment since the bpf appears to work normally when
dhcpd is run from root in the traditional way.

	My thanks and a lot of credit to the person who
originally wrote this script which can be found at

   Linkname: Screaming Electron Forums - How to chroot your existing
          isc-dhcpd server on freebsd

        URL:
          http://screamingelectron.org/forum/archive/index.php/t-837.html

Martin McCormick WB5AGZ  Stillwater, OK 
Systems Engineer
OSU Information Technology Department Network Operations Group


More information about the dhcp-users mailing list