Send dhcp-users mailing list submissions to

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to

You can reach the person managing the list at

When replying, please edit your Subject line so it is more specific
than "Re: Contents of dhcp-users digest..."

Today's Topics:

   1. Re: Questions about dhcpd.leases file (Bob Harold)


Message: 1
Date: Tue, 13 Feb 2018 09:16:54 -0500
From: Bob Harold <>
To: Users of ISC DHCP <>
Subject: Re: Questions about dhcpd.leases file
Content-Type: text/plain; charset="utf-8"

On Mon, Feb 12, 2018 at 4:57 PM, Simon Hobson <>

> Klemen Sladic <> wrote:
> > 1. What is the difference between dhcpd.leases and dhcpd.leases~ files?
> The latter is the previous file. Periodically (compiled in 1 hour by
> default) the server will write out a fresh leases file, move the old one
> (that's the one with ~ appended to it's name), and the new file moved into
> place. It's done that way so that if an error occurs, you haven't just
> over-written the only copy of the file !
> > 2. My dhcpd.leases parsing script is executed on commit, like:
> >
> > subnet netmask
> > {
> >    interface "eth0";
> >    range;
> >    option routers;
> >    on commit {
> >       execute("/home/user/");
> >    }
> > }
> >
> > Can I assume that dhcpd.leases has already been updated with latest
> lease when my script is executed?
> Don't know. It's required that the leases file is updated before sending
> teh packet to the client, but I don't know if it's defined at what point
> the on commit is executed.
> > 3. Is a new lease always appended at the end of dhcpd.leases file?
> Yes
> > 4. On renew is a new lease block always added at the end or is existing
> block updated?
> Yes. A lease is never updated in-place - a new record is appended to the
> leases file which is why you will see several entries for some clients.
> Obviously this append only method needs a cleanup from time to time - see 1
> above.
> BTW, there are some things you need to be aware of.
> AIUI "on xxxx" scripts are not executed asynchronously - hence running
> your script has the ability to severely compromise the performance of your
> DHCP service.
> If you are running the script to parse the lease that's just been written,
> can you obtain the information from within the server ? Eg build a log
> statement and then just tail the log file ?
> Can values be passed in the on xxxx call ? I don't know, but if they can
> then that might save you have to parse the file.
If you are using the information that you parse to decide what to return
from the on-commit call, what is it that you need that the on-commit does
not already pass to you?

If you are parsing the information for some other use, then you would
probably be much better to tail the leases file:  tail -F  dhcpd.leases |
That way you will not affect the performance, and the timing of when it
writes the lease file vs the on-commit call won't matter.

Bob Harold
-------------- next part --------------
An HTML attachment was scrubbed...


Subject: Digest Footer

dhcp-users mailing list


End of dhcp-users Digest, Vol 112, Issue 9

Reply via email to