static IP allocations in dynamic ranges -why not?

Simon Hobson dhcp1 at thehobsons.co.uk
Fri Jun 4 17:16:21 UTC 2010


Dorsey, Chris wrote:

>I'm also interested in how folks update 'dhcpd.leases' with the 
>server running without having some kind of contention problems.   Do 
>folks actually do this, or shutdown the server, manually (or maybe 
>scripted) update dhcpd.leases, and the restart the server?

You cannot update the file with the server running.

The normal process is to stop the server, edit the file, then restart 
the server. If you try and edit it with the server running then the 
server is liable to add entries while you are editing (so what 
happens when you save ?), and in particular it's possible that a 
lease you edit is actually replaced by a later version. In any case, 
the server only reads the file once at startup and at no other time. 
It's possible that your edited version would get completely replaced 
by the (by default) hourly cleanup when a new file is written from 
memory and replaces the old one.

I can think of one way to reduce downtime, and that would be to write 
a script that quickly scans the file for leases of interest, modified 
them as required, and appends the the new version to the end of the 
file. Thus you can prepare the update, stop the server, run the 
script, and start the server again - it should only require a few 
seconds from stop to start.
You could in theory prepare the new version of the lease in advance, 
but the real one may get updated by the server between you 
reading/updating it and the server quitting - the result being that 
you'd over-write a newer version of the lease.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list