All the IP address from the DHCP leases

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

All the IP address from the DHCP leases

shankha
Hi,
I was trying to program DHCP leases and going through the dhcpctl API's

Is there a way I can get a list of all the leases (or the IP address)
from the dhcp server.
I do not know the IP address before hand.

Thanks
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: All the IP address from the DHCP leases

Ryan Gray
Hi Shankha,

I recently took a swing at doing the same using the dhcpdtl APIs. I found the API to be extremely cumbersome (maybe just me). I ended up back at parsing the dhcpd.leases file (ugh). I ended up writing a PHP class that takes in the leases file and parses it, outputting a associative array with everything I needed from it.  It depends on Carbon for dealing with timestamps. It's fairly basic, but you're welcome to take a look at it.  http://pastebin.com/GD2i4i6s

You can disregard the GuzzleHttp usage in there. A previous iteration of this "solution" (I used that lightly) was to use the old dhcpd-pools script on the dhcp server and offer up it's output (json) to my web application. So guzzle was just running over to get that output from the dhcp server.  It isn't necessarily needed in this class.

Good luck.

-goat

On Fri, Feb 26, 2016 at 9:28 AM, shankha <[hidden email]> wrote:
Hi,
I was trying to program DHCP leases and going through the dhcpctl API's

Is there a way I can get a list of all the leases (or the IP address)
from the dhcp server.
I do not know the IP address before hand.

Thanks
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: All the IP address from the DHCP leases

shankha
Hi Ryan,
Thanks.

I ended up writing something you suggested in C++.

I am trying to look at http://dhcpstatus.sourceforge.net/
and long term look at  http://kea.isc.org/wiki

Thanks


On Tue, Mar 1, 2016 at 9:06 AM, Ryan Gray <[hidden email]> wrote:

> Hi Shankha,
>
> I recently took a swing at doing the same using the dhcpdtl APIs. I found
> the API to be extremely cumbersome (maybe just me). I ended up back at
> parsing the dhcpd.leases file (ugh). I ended up writing a PHP class that
> takes in the leases file and parses it, outputting a associative array with
> everything I needed from it.  It depends on Carbon for dealing with
> timestamps. It's fairly basic, but you're welcome to take a look at it.
> http://pastebin.com/GD2i4i6s
>
> You can disregard the GuzzleHttp usage in there. A previous iteration of
> this "solution" (I used that lightly) was to use the old dhcpd-pools script
> on the dhcp server and offer up it's output (json) to my web application. So
> guzzle was just running over to get that output from the dhcp server.  It
> isn't necessarily needed in this class.
>
> Good luck.
>
> -goat
>
> On Fri, Feb 26, 2016 at 9:28 AM, shankha <[hidden email]> wrote:
>>
>> Hi,
>> I was trying to program DHCP leases and going through the dhcpctl API's
>>
>> Is there a way I can get a list of all the leases (or the IP address)
>> from the dhcp server.
>> I do not know the IP address before hand.
>>
>> Thanks
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

Re: All the IP address from the DHCP leases

Ryan Gray
Excellent.  I've still got installs of dhcp-status.cgi around (yuck), and a few uses of dhcpd-pools.  I was super excited about Kea when I heard about it.  On paper, it is everything I've ever wanted - DHCP with a relational database back-end!!  So promising.  Unfortunately, the handful of times that I've approached using it, it has been a disaster.  I tend to do a lot of vendor and option 82 matching, creating classes and pools.  The last time I looked at Kea, those features just weren't there.  I've written a bigger application that actually does store all config information in a MySQL db, but then I'm re-writing the dhcpd.conf file and associated includes upon each change. That also necessitates restarting the daemon with the application. It is kludgy at best, but it works. ISC DHCP is amazing, don't get me wrong. It is so solid. I just wish it had some better tooling.

~Cheers



On Tue, Mar 1, 2016 at 8:27 AM, shankha <[hidden email]> wrote:
Hi Ryan,
Thanks.

I ended up writing something you suggested in C++.

I am trying to look at http://dhcpstatus.sourceforge.net/
and long term look at  http://kea.isc.org/wiki

Thanks


On Tue, Mar 1, 2016 at 9:06 AM, Ryan Gray <[hidden email]> wrote:
> Hi Shankha,
>
> I recently took a swing at doing the same using the dhcpdtl APIs. I found
> the API to be extremely cumbersome (maybe just me). I ended up back at
> parsing the dhcpd.leases file (ugh). I ended up writing a PHP class that
> takes in the leases file and parses it, outputting a associative array with
> everything I needed from it.  It depends on Carbon for dealing with
> timestamps. It's fairly basic, but you're welcome to take a look at it.
> http://pastebin.com/GD2i4i6s
>
> You can disregard the GuzzleHttp usage in there. A previous iteration of
> this "solution" (I used that lightly) was to use the old dhcpd-pools script
> on the dhcp server and offer up it's output (json) to my web application. So
> guzzle was just running over to get that output from the dhcp server.  It
> isn't necessarily needed in this class.
>
> Good luck.
>
> -goat
>
> On Fri, Feb 26, 2016 at 9:28 AM, shankha <[hidden email]> wrote:
>>
>> Hi,
>> I was trying to program DHCP leases and going through the dhcpctl API's
>>
>> Is there a way I can get a list of all the leases (or the IP address)
>> from the dhcp server.
>> I do not know the IP address before hand.
>>
>> Thanks
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users


_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users