I have created a systemd service for the hostapd application on Raspbian Jessie Lite. The source code is similar to this GitHub Gist but with IP addresses ranging in the 192.168.50.x/24.

Everything works and various devices get IP addresses from the DHCP server. However I do not know whether there is a log of all the IP addresses given out to the clients w.r.t. to their MAC Addresses for dnsmasq and/or hostapd.

Is there any way to resolve the handed out IP addresses of the DHCP server? Perhaps they might be logged into a file which I am unaware of. For instance, in verbosity mode I do tend to see messages when a client requests for an IP address, and hence the assumption that this information maybe logged into the file.

2 Answers 2


I believe /var/lib/misc/dnsmasq.leases is the file you want

If not then use dhcp-script= and write your own see manpage

At startup, dnsmasq reads /etc/dnsmasq.conf, The format of this file consists of one option per line, exactly as the long options detailed in the OPTIONS section but without the leading "--".

--dhcp-script= Whenever a new DHCP lease is created, or an old one destroyed, or a TFTP file transfer completes, the executable specified by this option is run. must be an absolute pathname, no PATH search occurs. The arguments to the process are "add", "old" or "del", the MAC address of the host (or DUID for IPv6) , the IP address, and the hostname, if known. "add" means a lease has been created, "del" means it has been destroyed, "old" is a notification of an existing lease when dnsmasq starts or a change to MAC address or hostname of an existing lease (also, lease length or expiry and client-id, if leasefile-ro is set). If the MAC address is from a network type other than ethernet, it will have the network type prepended, eg "06-01:23:45:67:89:ab" for token ring. The process is run as root (assuming that dnsmasq was originally run as root) even if dnsmasq is configured to change UID to an unprivileged user.


As an addendum to Ross' answer, you can specify the lease file in your dnsmasq.conf (or conf file in /etc/dnsmasq.d) file with the option dhcp-leasefile=<lease file>. E.g. dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases

Also, although the lease file will be populated with hostnames in some instances, some random devices like tablets or smart TVs will sometimes not be clearly identifiable from the leases file. In your dnsmasq conf you can add dhcp-host options with the device's MAC address and a friendly hostname that will be displayed in the leases file. E.g.


in dnsmaq.conf looks like this in the leases file:

1502229042 10:08:c1:08:9d:53 LG-TV *

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .