Editing dhcpd.conf without corrupting leases

Glenn Satchell Glenn.Satchell at uniq.com.au
Wed Apr 15 01:10:25 UTC 2009


I'm surprised no-one has suggested using OMAPI to either add the host
entries or to shutdown the server. Adding host entries is covered in
the omshell man page.

Shutting down the server:

$ omshell
> server localhost
> key OMAPI your_key_from_dhcpd.conf
> connect
obj: <null>
> new control
obj: control
> open
obj: control
state = 00:00:00:00
> set state = 2
obj: control
state = 2
> update
obj: control
state = 2
> exit

and my dhcpd shuts down, eg here's the syslog output:

Apr 15 10:55:45 drill dhcpd: [ID 702911 local7.info] Disabling output on 
DLPI/hme0/08:00:20:b0:eb:e3/192.168.14/24
Apr 15 10:55:45 drill dhcpd: [ID 702911 local7.info] Disabling input on 
DLPI/hme0/08:00:20:b0:eb:e3/192.168.14/24


If you wanted to put this into a shell script:

#! /bin/sh
host=$1:-localhost}

omshell <<EOF
server $host
key OMAPI your_key_from_dhcpd.conf
connect
new control
open
set state = 2
update
EOF

I found the magic number 2 in a very old post:
http://marc.info/?l=dhcp-server&m=100214720631629&w=2

There may be other values that can be used here, I don't know.

regards,
-glenn
--
Glenn Satchell     mailto:glenn.satchell at uniq.com.au | It's a dog  eat dog
Uniq Advances Pty Ltd         http://www.uniq.com.au | world, and by golly,
PO Box 70 Paddington NSW Australia 2021              | we better make sure
tel:0409-458-580  tel:02-9380-6360  fax:02-9380-6416 | we're the dog.

>From: Randall C Grimshaw <rgrimsha at syr.edu>
>To: "'Users of ISC DHCP'" <dhcp-users at lists.isc.org>
>Date: Tue, 14 Apr 2009 13:57:10 -0400
>Subject: RE: Editing dhcpd.conf without corrupting leases
>Thread-Topic: Editing dhcpd.conf without corrupting leases
>Accept-Language: en-US
>Content-Language: en-US
>X-MS-Has-Attach: 
>X-MS-TNEF-Correlator: 
>acceptlanguage: en-US
>X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.7400:2.4.4, 1.2.40, 
4.0.166 definitions=2009-04-14_08:2009-04-13, 2009-04-14, 2009-04-14 
signatures=0
>X-Proofpoint-Spam-Reason: safe
>X-BeenThere: dhcp-users at lists.isc.org
>
>Me too. Both in having built this solution, and in being open to suggestions.
>
>Randy 
>
>-----Original Message-----
>From: dhcp-users-bounces at lists.isc.org 
[mailto:dhcp-users-bounces at lists.isc.org] On Behalf Of John Tabasz (jtabasz)
>Sent: Tuesday, April 14, 2009 1:49 PM
>To: Users of ISC DHCP
>Subject: RE: Editing dhcpd.conf without corrupting leases
>
>This pretty closely describes the solution I came up with to maintain a
>large dhcpd.conf file with statically assigned addresses exclusively. 
>I use the db to add any new servers or change any names or addresses,
>then if a change is made I create a file that contains all of the
>information for all of the servers on the subnet on which the change
>occurred. Not just the changes. If a particular site houses more than
>one subnet, all subnets are included in the new flat file. Then through
>a couple of perl scripts a new dhcpd.conf file is created and tested
>before being scp'd to the appropriate dhcp server. 
>I'm not sure exactly how to modify this to be a db only solution, but
>would be open to suggestions.
>
>John 
>
>-----Original Message-----
>From: dhcp-users-bounces at lists.isc.org
>[mailto:dhcp-users-bounces at lists.isc.org] On Behalf Of
>A.L.M.Buxey at lboro.ac.uk
>Sent: Tuesday, April 14, 2009 1:18 AM
>To: Users of ISC DHCP
>Subject: Re: Editing dhcpd.conf without corrupting leases
>
>hi,
>
>when you get to this sort of large numbers of static hosts and
>modification numbers then the best way is to move all of it to a DB back
>end. generate a dhcpd.conf.new from the DB entries, then do a sanity
>check (hopefully the code producing the config file from the DB will
>stop weird and broken entries anyway!), then diff the new file versus
>the old file - and if its changed, move it across (after backing up the
>old version) and restart the DHCPD process.
>
>alternatively, migrate to a total DB solution and remove the whole
>flat-file thing.
>
>alan
>
>_______________________________________________
>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
>https://lists.isc.org/mailman/listinfo/dhcp-users
>_______________________________________________
>dhcp-users mailing list
>dhcp-users at lists.isc.org
>https://lists.isc.org/mailman/listinfo/dhcp-users




More information about the dhcp-users mailing list