Send dhcp-users mailing list submissions to dhcp-users@lists.isc.org
To subscribe or unsubscribe via the World Wide Web, visit https://lists.isc.org/mailman/listinfo/dhcp-users or, via email, send a message with subject or body 'help' to dhcp-users-requ...@lists.isc.org You can reach the person managing the list at dhcp-users-ow...@lists.isc.org When replying, please edit your Subject line so it is more specific than "Re: Contents of dhcp-users digest..." Today's Topics: 1. Re: Questions about dhcpd.leases file (Klemen Sladic) 2. Re: Questions about dhcpd.leases file (Klemen Sladic) 3. Re: dhclient process lifetime (Lukas Erlacher) ---------------------------------------------------------------------- Message: 1 Date: Thu, 15 Feb 2018 08:50:37 +1300 From: Klemen Sladic <gostur...@gmail.com> To: Users of ISC DHCP <dhcp-users@lists.isc.org> Subject: Re: Questions about dhcpd.leases file Message-ID: <CAN6eUaHi7VCt61UWc3vayg96zVoGHJg=rss7nzna+132kor...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Simon, thank you very much for your explanation, it is really helpful. I may have to slightly re-design my script. Best way I see is using arguments as Bob also suggested. Thanks again. Klemen On Tue, Feb 13, 2018 at 10:57 AM, Simon Hobson <dh...@thehobsons.co.uk> wrote: > Klemen Sladic <gostur...@gmail.com> wrote: > > > 1. What is the difference between dhcpd.leases and dhcpd.leases~ files? > > The latter is the previous file. Periodically (compiled in 1 hour by > default) the server will write out a fresh leases file, move the old one > (that's the one with ~ appended to it's name), and the new file moved into > place. It's done that way so that if an error occurs, you haven't just > over-written the only copy of the file ! > > > 2. My dhcpd.leases parsing script is executed on commit, like: > > > > subnet 192.168.0.0 netmask 255.255.255.0 > > { > > interface "eth0"; > > range 192.168.0.1 192.168.0.100; > > option routers 192.168.0.254; > > on commit { > > execute("/home/user/leases_parse.sh"); > > } > > } > > > > Can I assume that dhcpd.leases has already been updated with latest > lease when my script is executed? > > Don't know. It's required that the leases file is updated before sending > teh packet to the client, but I don't know if it's defined at what point > the on commit is executed. > > > 3. Is a new lease always appended at the end of dhcpd.leases file? > > Yes > > > 4. On renew is a new lease block always added at the end or is existing > block updated? > > Yes. A lease is never updated in-place - a new record is appended to the > leases file which is why you will see several entries for some clients. > Obviously this append only method needs a cleanup from time to time - see 1 > above. > > BTW, there are some things you need to be aware of. > > AIUI "on xxxx" scripts are not executed asynchronously - hence running > your script has the ability to severely compromise the performance of your > DHCP service. > If you are running the script to parse the lease that's just been written, > can you obtain the information from within the server ? Eg build a log > statement and then just tail the log file ? > Can values be passed in the on xxxx call ? I don't know, but if they can > then that might save you have to parse the file. > > _______________________________________________ > dhcp-users mailing list > dhcp-users@lists.isc.org > https://lists.isc.org/mailman/listinfo/dhcp-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20180215/8e9a851c/attachment-0001.html> ------------------------------ Message: 2 Date: Thu, 15 Feb 2018 11:15:47 +1300 From: Klemen Sladic <gostur...@gmail.com> To: Users of ISC DHCP <dhcp-users@lists.isc.org> Subject: Re: Questions about dhcpd.leases file Message-ID: <can6euaflkbzfrtturhki8nezjvdn50+rb9auvec0dosw7a4...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi Bob. You are right. What I need is MAC and IP and may use them as arguments to the script or tailing the dhcpd.leases. Thank you very much. Klemen On Wed, Feb 14, 2018 at 3:16 AM, Bob Harold <rharo...@umich.edu> wrote: > > On Mon, Feb 12, 2018 at 4:57 PM, Simon Hobson <dh...@thehobsons.co.uk> > wrote: > >> Klemen Sladic <gostur...@gmail.com> wrote: >> >> > 1. What is the difference between dhcpd.leases and dhcpd.leases~ files? >> >> The latter is the previous file. Periodically (compiled in 1 hour by >> default) the server will write out a fresh leases file, move the old one >> (that's the one with ~ appended to it's name), and the new file moved into >> place. It's done that way so that if an error occurs, you haven't just >> over-written the only copy of the file ! >> >> > 2. My dhcpd.leases parsing script is executed on commit, like: >> > >> > subnet 192.168.0.0 netmask 255.255.255.0 >> > { >> > interface "eth0"; >> > range 192.168.0.1 192.168.0.100; >> > option routers 192.168.0.254; >> > on commit { >> > execute("/home/user/leases_parse.sh"); >> > } >> > } >> > >> > Can I assume that dhcpd.leases has already been updated with latest >> lease when my script is executed? >> >> Don't know. It's required that the leases file is updated before sending >> teh packet to the client, but I don't know if it's defined at what point >> the on commit is executed. >> >> > 3. Is a new lease always appended at the end of dhcpd.leases file? >> >> Yes >> >> > 4. On renew is a new lease block always added at the end or is existing >> block updated? >> >> Yes. A lease is never updated in-place - a new record is appended to the >> leases file which is why you will see several entries for some clients. >> Obviously this append only method needs a cleanup from time to time - see 1 >> above. >> >> BTW, there are some things you need to be aware of. >> >> AIUI "on xxxx" scripts are not executed asynchronously - hence running >> your script has the ability to severely compromise the performance of your >> DHCP service. >> If you are running the script to parse the lease that's just been >> written, can you obtain the information from within the server ? Eg build a >> log statement and then just tail the log file ? >> Can values be passed in the on xxxx call ? I don't know, but if they can >> then that might save you have to parse the file. >> >> > If you are using the information that you parse to decide what to return > from the on-commit call, what is it that you need that the on-commit does > not already pass to you? > > If you are parsing the information for some other use, then you would > probably be much better to tail the leases file: tail -F dhcpd.leases | > parse-program > That way you will not affect the performance, and the timing of when it > writes the lease file vs the on-commit call won't matter. > > -- > Bob Harold > > > > _______________________________________________ > dhcp-users mailing list > dhcp-users@lists.isc.org > https://lists.isc.org/mailman/listinfo/dhcp-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20180215/372896d9/attachment-0001.html> ------------------------------ Message: 3 Date: Thu, 15 Feb 2018 12:56:10 +1100 From: Lukas Erlacher <erlac...@in.tum.de> To: dhcp-users@lists.isc.org Subject: Re: dhclient process lifetime Message-ID: <d7c90b35-31a6-eafc-bbf0-8a00672f6...@in.tum.de> Content-Type: text/plain; charset="utf-8" Hello, I apologize for the content-less bump, but I'd like to restate my problem, since it seems like it hasn't been seen by anyone. dhclient 4.3.5 (isc-dhcp-client 4.3.5-3 on Raspbian 9.3) does not recognize that another dhclient process is already running. I never see the > dhclient(30189) is already running - exiting Message when invoking dhclient twice with the same pid file. Is this a known bug? Best, Luke -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 5167 bytes Desc: S/MIME Cryptographic Signature URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20180215/1d7e0c6b/attachment.bin> ------------------------------ Subject: Digest Footer _______________________________________________ dhcp-users mailing list dhcp-users@lists.isc.org https://lists.isc.org/mailman/listinfo/dhcp-users ------------------------------ End of dhcp-users Digest, Vol 112, Issue 10 *******************************************