Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi, everything works as intended with my dhcp server but i use a php script to keep track of the leases , in the leases file i see "duplicate" entries like this:
lease 10.240.21.36 {
starts 2 2012/09/04 20:37:32;
ends 2 2012/09/04 20:38:32;
cltt 2 2012/09/04 20:37:32;
binding state active;
next binding state free;
hardware ethernet 00:a8:59:c8:55:fe;
uid "\001\000\250Y\310U\376";
yes , there are diferent states and practicaly dhcpd writes a log in a cronologic order , but , even after some time these remain there like in a log file even if the clients are not present anymore .
This behavior is documented in the dhcpd.leases man :
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 particular lease that appears last in the file is the one that is in effect.
And now the question is: can we alter this behavior or the time after dhcpd decides to clean it?
Please don't tell me to put a cron job to clear the file , that's not a solution .
this file intended to be handled automatically, so generally you cannot shrink it whenever you want; also doing that with a cron job is not a trivial task as well
This behavior is documented in the dhcpd.leases man :
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 particular lease that appears last in the file is the one that is in effect.
In the next section it’s mentioned to use { deleted; }, maybe you have to create host specific entry for this MAC address, so that it can be removed from the dhcpd.leases file.
thx for you time , after all i decided to leave the dhcpd.leases untouched and work on the php interface that reads from it and displays the leases in a web page.
Anyway just to mention , old logs from the dhcpd.leases get cleaned after a restart (isc-dhcp server restart).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.