From: Robert Lowe (Robert.H.Lowe@lawrence.edu)
Date: Thu Jul 08 2004 - 16:26:53 CDT
Tim Tyler wrote:
Hi Tim!
> Ok, I am interested in this topic as well. I used your script and
> it seems that it may be working fine. I need a couple clarifications
> though.
> 1. Removing leases is one thing, but forcing new registrations is
> another. Do I need to manually delete entries at the bottom of
> dhcpd.conf in order to force new registrations (dhcpd.conf.new,
> dhcpd.conf.bak)? While your script seems to handle dhcpd.leases, its
> not clear how one should handle dhcpd.conf.
>
> 2. While I presume that the input file is /var/state/dhcp/dhcpd.leases
> what is the output file for? Is that what I should use to over write
> dhcpd.leases?
>
> 3. Should dhcpd deamon be shut down while running this script?
I never touch the leases file. Just not a good idea at all, IMO -- better
to let ISC handle it. You must stop the server before you do anything to
the file. Regarding growth, etc., the dhcpd.leases(5) manpage says:
In order to prevent the lease database from growing without bound, the file is
rewritten from time to time. First, a temporary lease database is created and all
known leases are dumped to it. Then, the old lease database is renamed
/var/state/dhcp/dhcpd.leases~. Finally, the newly written lease database is moved
into place.
...
The lease file is a log-structured file - whenever a lease changes, the contents of
that lease are written to the end of the file. This means that it is entirely
possible and quite reasonable for there to be two or more declarations of the same
lease in the lease file at the same time. In that case, the instance of that par-
ticular lease that appears last in the file is the one that is in effect.
You shouldn't have any problems unless you don't have enough addresses to
handle the overlap of old entries and new ones. That case can be handled
by not giving out long leases and dumping old registrations during a slow
period.
Regarding cleaning out old registrations en masse... When I get a bit more
time towards the end of this month, I plan to roll up a new version of the
CIDR kit. In that version, I think I will re-work the registration component
to work with a file to be included into dhcpd.conf[.new] unless someone has
violent objections. I've typically pushed our host entries to an "external"
file, and then included it in dhcpd.conf. With this kind of approach, all
that's needed to dump old registrations is:
1. cp regfile regfile.old
2. cp /dev/null regfile
-Robert
> At 08:17 AM 7/6/2004, you wrote:
>
>> Hi,
>> I wrote a perl script a while back that will clean the lease file.
>> It writes output to a specified file elsewhere. Questions? Write back.
>> Script is attached.
>>
>> Jeff Earickson
>> Colby College
>>
>> On Tue, 6 Jul 2004, David Davis wrote:
>>
>> > Date: Tue, 6 Jul 2004 08:40:35 -0400
>> > From: David Davis <dddavis@rmwc.edu>
>> > Reply-To: netreg@southwestern.edu
>> > To: netreg@southwestern.edu
>> > Subject: NetReg: Deleting Leases
>> >
>> > Morning,
>> >
>> > Is there any easy way to delete all of the leases on NetReg? Can I just
>> > clear the dhcpd entries and force new registrations on the system?
>> >
>> > D. David Davis III
>> > Network Manager
>> > Information Technology Department
>> > Randolph-Macon Woman's College
>> > dddavis@rmwc.edu
>> >
>> >
>
>
> Tim Tyler
> Network Engineer - Beloit College
> tyler@beloit.edu
**********************************************************************
To unsubscribe from this list, send an e-mail message to
majordomo@southwestern.edu containing a single line with the words:
unsubscribe netreg
Send requests for assistance to: owner-netreg@southwestern.edu
**********************************************************************
This archive was generated by hypermail 2.1.4 : Thu Aug 12 2004 - 12:01:46 CDT