different devices getting the same ip address

Simon Hobson dhcp1 at thehobsons.co.uk
Tue Dec 13 16:18:33 UTC 2011

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

dorian wrote:

>Since I am registering (with another tools) all the IPs in the network I
>know that there number of different IPs assigned (whenever) by DHCP
>server is only 30924 which is significantly less than theoretically
>possible 262142.
>I have around 1000 users per day at the hotspot system. Some of them are
>the same users some are 'accidental' ones.
>The config lease times are following:
>default-lease-time 86400;
>max-lease-time 86400;
>which means 24h
>Since working hours of the hostpot are 8:00 - 22:00 and lease time is
>24h and the number of users is ~1000/day  I do not understand why
>sometimes a host obtains IP address being in use.

Have you looked at the leases for these duplicate IPs ? The answer 
given to the OP was that the IP was leased to two "different" devices 
because as far as DHCP is concerned, they are the "same" client 
because they have the same Client ID.

>BTW: the current dhcpd.leases file contains 503007 entries  (entries not
>Does it mean the file contains whole 'history' of the leases whenever
>given? What for?

Firstly, the leases file is a "log database" where updates are 
performed by writing a new record at the end o the file - this makes 
it fast and easy to do "safe" updates which are easily (and cheaply) 
synced to disk as required by the RFCs. Thus an active lease may have 
more than one entry - the last one is the correct version.
To counter the file growing indefinitely until disk space is 
exhausted, it is rewritten periodically (every hour unless you change 
the code and recompile) with a fresh copy - at which point there will 
be exactly one record per lease.

The second feature is that every lease ever given out is kept until 
such time as the address is re-used. Thus, if you had 1000 users one 
day, then a different 1000 users/devices the next day, you'd have 
2000 leases in the database. This too is required by the RFCs which 
specify that as far as is possible, a device should be given an 
address previously leased to it. Note that some other DHCP servers do 
not do this.
it sounds like you have a high churn rate, and so lots of new users. 
Each of these will still have a lease recorded.

If you wanted to override this, then there are a couple of things you could do.
One is to stop the server, and write a script to clean out old 
records from the leases file.
Another is to "rotate" the pool periodically. When the server starts 
up, any leases not within a defined range will be deleted. Thus if 
you had a range of say one week, and the 
next week changed this to then all the 
leases in the 172.16.n.n bock would get deleted.

And on this, there is a performance issue you might wish to be aware 
of. On startup, the server will create in-memory records for every IP 
address in every range defined. Thus in your case, you are creating 
tables to track over half a million addresses - while your 
requirement seems to be only around 1000 per day. Memory requirements 
and startup times would be improved by creating a range that's better 
sized to your requirements - a few (tens of) thousands would seem 
more appropriate.

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