Like Buck says, it's easily found via either the running command line
or the config file.  Mine is in the config, so for example, I can show
lease expiration like this (note that the MACs and DUIDs are fake):

$ grep leasefile /etc/dnsmasq.conf
dhcp-leasefile=/tmp/dhcp.leases

$ cat /tmp/dhcp.leases
1711051828 47:47:d7:37:92:41 10.1.1.144 new-kindle 01:47:47:d7:37:92:41
1711042889 15:a5:65:85:4e:a3 10.1.1.172 enkefalos 01:15:a5:65:85:4e:a3
...

$ printf "%s %s\n" $(eval $(awk '{printf "date -Is -d@%s;\necho
%s;\n", $1, $4}' /tmp/dhcp.leases)) | sort
2024-03-21T10:41:29-07:00 enkefalos
2024-03-21T13:10:28-07:00 new-kindle
...

On Thu, Mar 21, 2024 at 1:03 AM Buck Horn via Dnsmasq-discuss
<dnsmasq-discuss@lists.thekelleys.org.uk> wrote:
>
> On 21.03.24 04:33, Tim Tassonis wrote:
> > What I wonder: Is there a way to find out what hostnames the dhcp
> > server has assigned to what ip addresses dynamically? I know that
> > dnsmasq registers them just fine, but is there a run-time access to
> > that information?
>
>
> dnsmasq stores its currently active lease information in a file
> (dnsmasq.leases), see
>
> https://dnsmasq.org/docs/dnsmasq-man.html#lbAL
>
>
> An explanation of the field format can be found from the mailing list, see
>
> https://www.mail-archive.com/dnsmasq-discuss@lists.thekelleys.org.uk/msg00771.html
>
>
> And of course, if you knew either an IP or a hostname of an active(!)
> dynamic client, you could query dnsmasq for the other.
>
> Kind regards,
>       Buck
>
>
> _______________________________________________
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to