LDAP Patch

Glenn Satchell Glenn.Satchell at uniq.com.au
Tue Aug 4 00:41:22 UTC 2009

The way I do this is to make use of the "include" statement.

In the main dhcpd.conf add a line:

include "/etc/dhcpd_hosts.conf"

Then create a subdirectory, eg /etc/dhcpd/hosts

Your update procedure creates a new little file for each host in
that dorectory containing

host "aa:bb:cc:dd:ee:ff" {
hardware ethernet aa:bb:cc:dd:ee:ff;
fixed-address ...
other options ...

As each file is unique to a single host there should not be any clashes.

The host label should be based on the mac address, or something that is
going to be unique across all your hosts.

Now you write a script, something like, that will contain a list of all
the little hosts files to be included:

if [ ! -f /tmp/lockfile ]; then
	touch /tmp/lockfile
	for h in /etc/dhcpd/hosts/*; do
		echo "include \"$h\";"
	done > /etc/dhcpd_hosts.conf
	dhcpd -t /etc/dhcpd.conf
	if [ $? = 0 ]; then
		restart dhcpd
	rm -f /tmp/lockfile

dhcpd -t tests for valid syntax.

The advantages of this, is that your script is very simple and doesn't
have to deal with arbitrary dhcpd.conf configuration details.

Glenn Satchell     mailto:glenn.satchell at uniq.com.au | I telephoned the
Uniq Advances Pty Ltd         http://www.uniq.com.au | swine flu info
PO Box 70 Paddington NSW Australia 2021              | line and all I got
tel:0409-458-580  tel:02-9380-6360  fax:02-9380-6416 | was crackling.

>From: "Ben Wiechman" <wiechman.lists at gmail.com>
>To: "Glenn Satchell" <Glenn.Satchell at uniq.com.au>, "Users of ISC DHCP" 
<dhcp-users at lists.isc.org>
>Subject: RE: LDAP Patch
>Date: Mon, 3 Aug 2009 12:11:05 -0500
>Content-Language: en-us
>X-BeenThere: dhcp-users at lists.isc.org
>> You can also make an online change using OMAPI, and write the
>> equivalent settings in dhcpd.conf to be read on the next restart.
>> It can be a bit confusing searching through dhcpd.conf and dhcpd.leases
>> to find the host configs if there are more than a few in each file.
>Yes, I can see that would potentially get to be an interesting challenge to
>locate the current source of the configuration. Also ensuring consistency
>when writing updates to both OMAPI and the files.
>Does anyone have a script template they use to update the conf file they'd
>be willing to share? Concerned about issues related to locking and
>concurrent access (don't have a lot of experience working around those
>> regards,
>> -glenn
>> _______________________________________________
>> dhcp-users mailing list
>> dhcp-users at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>dhcp-users mailing list
>dhcp-users at lists.isc.org

More information about the dhcp-users mailing list