LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-04-2012, 05:02 PM   #1
blackbrayn
LQ Newbie
 
Registered: Sep 2012
Location: Romania
Posts: 9

Rep: Reputation: Disabled
Dhcpd.leases issue


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:38:03;
ends 2 2012/09/04 20:39:03;
tstp 2 2012/09/04 20:39:03;
cltt 2 2012/09/04 20:38:03;
binding state free;
hardware ethernet 00:a8:59:c8:55:fe;
uid "\001\000\250Y\310U\376";
}

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 .

Thx for reading the long post.
 
Old 09-07-2012, 07:58 PM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
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
 
Old 09-08-2012, 02:59 PM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by blackbrayn View Post
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.
 
Old 09-12-2012, 05:08 PM   #4
blackbrayn
LQ Newbie
 
Registered: Sep 2012
Location: Romania
Posts: 9

Original Poster
Rep: Reputation: Disabled
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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCPD no free leases HiOctane21 Linux - Networking 6 10-02-2013 11:21 PM
Many entries in /var/lib/dhcpd/dhcpd.leases Mouglou Linux - Server 10 06-14-2011 09:56 AM
Delete leases from dhcpd.leases when remove a subnet from dhcpd.conf phongnh Linux - Server 2 10-12-2010 04:49 AM
DHCPD Has No free leases? FishGills Linux - Networking 7 01-24-2009 06:49 PM
dhcpd.leases desertwanderer Linux - Server 0 10-25-2007 03:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration