list leases for isc-dhcp-server

I would like to interactively look at the leases from my DHCP server just for auditing purposes. There is a post here:
https://forums.freebsd.org/threads/how-to-get-a-list-of-connected-clients-from-my-dhcp-server.33240/

However, it doesn't appear to be answered or answer my question.

I see the lease file here:
/var/db/dhcpd.leases
/var/db/dhcpd/dhcpd.leases

However, both contain just a header indicating the server-duid.

Is there an option that would prevent the server from writing the leases? I was also using this as a reference:
https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcpdconf
https://kb.isc.org/docs/isc-dhcp-44-manual-pages-dhcp-options

It basically seems to say that a long as the file exists, the DHCP server will update it. But in my case, I don't see any updates to it.
 
I ended up writing a small shell script that uses net/fping. I grep out the range(s) from dhcpd.conf and run fping -a -g $RANGE. I get the MAC address of each response via arp and then cross reference the MAC against the last entries in /var/db/dhcpd/dhcpd.leases. Script spits out IP, MAC, and hostname for each IP range. The caveat is that the device responds to ICMP, so your mileage may vary.
 
Thanks for your reply, the problem is that my /var/db/dhcpd/dhcpd.leases is empty (other than the header). Is it possible to get the leases written to that file?
 
I deleted the /var/db/dhcpd.leases and restarted isc-dhcpd and I can see that /var/db/dhcpd/dhcpd.leases is the one being used. I would guess that I must have had the other dhcpd server installed when I first set up the router, then started that, removed it, and finally installed isc-dhcp44-server (which remains what I use today).

I will tail that lease file to see if it does grow.
 
It's going to depend on the DHCP clients if it's going to include more information. As far as I know the dhclient(8) on FreeBSD sends the client's hostname with the DHCP request, so that information should show up in the leases. But I honestly can't remember what it shows by default (I have BIND and DHCP linked to get dynamic DNS registrations).
 
Back
Top