what part of dhcpd.leases file is moved (or copied) to dhcpd.leases~?
Luc T.
taoh666 at yahoo.com
Mon Jan 22 15:07:59 UTC 2007
thanks for the explanation, which is very clear.
It seems to me that the isc dhcp server very much relies on the system time. If I change the machine time backward for a couple days (e.g. change the time of today to Jan 1st, 2007), will those expired records be treated as a still assigned ip ? ( the expiration time is still later than the "current" machine time) Will this cause a shortage of ip address?
Simon Hobson <dhcp1 at thehobsons.co.uk> wrote:
Luc T. wrote:
>what part of dhcpd.leases file is moved (or copied) to dhcpd.leases~?
Every lease record held in memory - including expired leases.
> I am always confused with this question, as I can see new (in term
>of starting time) leases in dhcpd.leases~, while older leases are
>still sitting in dhcpd.conf.
>
> From the man dhcpd.leases, it says
>
> "First, a temporary lease database is created and all
>known leases are dumped to it. Then, the old lease
>database is renamed /var/lib/dhcp/dhcpd.leases~. Finally, the
>newly written lease database is moved into place."
>
> It seems to me that
>
> 1. when this happens, the new dhcpd.leases should be almost empty
>or contain only a few records.
No - you are assuming that only current leases are copied.
> 2. the dhcpd.leases and dhcpd.leases~ can be linked together to
>form a more complete, bigger leases file.
No, once the new leases file is made active, the old file is
redundant. It will contain nothing that is not in the current file
other than superceded records.
> Am I right?
No, as stated above. What I think you are missing is that the server
does not delete lease records when they expire - it simply marks them
as free for reuse. This is done to minimise address churn/increase
stability, as in a client may disappear from the network for a while
and then return. With the ISC server, the client will get the same
address unless it has had to be reused - with other servers, client
may well get a different address each time they come back to the
network.
Also, to answer another thread, when the new leases file is written,
only one record/lease is written and it does not matter what order
they appear. Hence it is quite possible that as you follow the
physical order of records you will find that they aren't in
chronological order. Actaully, due to the way the leases are indexed
in different lists (depending on state) and using a hashing function,
it's highly likely that they will NOT be written in chronological
order.
Once the server starts amending lease records however, all NEW
records will be appended in chronological order - it is only when you
have two or more records for a specific lease that the order becomes
important.
Luc
More information about the dhcp-users
mailing list