DBDIR? (and configure question)

Glenn Satchell Glenn.Satchell at uniq.com.au
Tue Jun 19 13:20:02 UTC 2007


>Date: Mon, 18 Jun 2007 17:54:45 -0700
>From: Craig <craig5 at pobox.com>
>To: dhcp-users at isc.org
>Subject: DBDIR? (and configure question)
>
>I just upgraded to 3.0.5 (from 3.0.1) and the only problem I had was the 
>default leases dir was in a different spot.
>
>3.0.1:
>	/var/lib/dhcp/dhcpd.leases
>
>3.0.5:
>	/var/state/dhcp/dhcpd.leases
>
>Now, the big difference is that 3.0.1 was installed via yum (rpm), while 
>3.0.5 was compiled from source. (The point being I don't know what is 
>custom in the rpm.)
>
>2 questions:
>1) Is there a way to change the location of the lease file via 
>dhcpd.conf? (Note, the following does NOT work:
>
>lease-file-name /var/lib/dhcp/dhcpd.leases;
>Error:
># service dhcpd start
>Starting 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/
>/etc/dhcpd.conf line 1: expecting string.
>lease-file-name /
>                 ^
>/etc/dhcpd.conf line 1: expecting a parameter or declaration
>lease-file-name /var/lib/dhcp/dhcpd.leases;
>                                            ^
>Configuration file errors encountered -- exiting
>....
>
>Obviously, it is not expecting a path. Rather this is just a way to 
>change the name of the file itself. (The docs could be a little more 
>clear on that.) (What about adding an entry to /etc/sysconfig/dhcpd? Not 
>sure what option to put in here. RTFM is fine... just point me to the 
>right spot. I couldn't find anything.)

try it with quotes around the string:

lease-file-name "/var/lib/dhcp/dhcpd.leases";

There is a mention in the dhcp-eval man page about what constiitutes a
string:

     string

       A string, enclosed in quotes, may be specified as  a  data
       expression,  and  returns  the  text  between  the quotes,
       encoded in  ASCII.

And the dhcpd man page has an option for changing the lease file name:

     dhcpd [ -p port ] [ -f ] [ -d ] [ -q ] [ -t |  -T  ]  [  -cf
     config-file  ]  [  -lf  lease-file  ] [ -pf pid-file ] [ -tf
     trace-output-file ] [ -play trace-playback-file ]  [  if0  [
     ...ifN ] ]

Remember dhcpd has to work on lots of different types of unix and
linux. Most of these don't have /etc/sysconf/dhcpd. Most distributins
that provide isc dhcpd also have their own customised startup script
that uses the configuration files of that system. Ifyou used a Redhat
rpm then it will usually do all this for you. When you 'roll your own'
you need to do the customising.

>2) How do you change the location at build/compile time?
>(I don't see anything in the configure script.) Do you just set an env 
>var called "DBDIR"?

You can edit includes/site.h and change the definition, or
create a file called site.conf in the top level. Here's the one
I used for 3.0.5 which sets just about everything you'd want to
change. Select the one(s) you need, eg VARDB

$ cat site.conf
# Put local site configuration stuff here to override the default
# settings in Makefile.conf
USERBINDIR = /usr/local/pkgs/dhcp-3.0.5/bin
BINDIR = /usr/local/pkgs/dhcp-3.0.5/sbin
CLIENTBINDIR = /usr/local/pkgs/dhcp-3.0.5/sbin
ADMMANDIR = /usr/local/pkgs/dhcp-3.0.5/man/man1m
FFMANDIR = /usr/local/pkgs/dhcp-3.0.5/man/man4
LIBMANDIR = /usr/local/pkgs/dhcp-3.0.5/man/man3
USRMANDIR = /usr/local/pkgs/dhcp-3.0.5/man/man1
ETC = /usr/local/etc
VARRUN = /var/run
VARDB = /var/dhcp
LIBDIR = /usr/local/pkgs/dhcp-3.0.5.rc2/lib
INCDIR = /usr/local/pkgs/dhcp-3.0.5.rc2/include
CC = gcc -O -D_PATH_DHCPD_PID=\"/var/run/dhcpd.pid\" \ 
-D_PATH_DHCPD_DB=\"/var/dhcp/dhcpd.leases\" \ 
-D_PATH_DHCPD_CONF=\"/usr/local/etc/dhcpd.conf\"
>
>Side question... why isn't autoconf used instead of a custom configure 
>shell script?

That's due to historical reasons. I believe 4.0.0 uses autoconf.

>All said and done, the upgrade was very simple. I just created a symlink 
>to the old dir and everything works just fine. The above is a *very 
>minor* nit! :)

and easily fixed :)

The different unix/linux distributions choose a variety of compile
options to suit their desired behaviour. The defaults are those that
seem sensible for most systems.

regards,
-glenn


More information about the dhcp-users mailing list