I am using dnsmasq to serve IPs for about 200 vservers. Leasetime is infinite: dhcp-range=,,infinite

I don't know why, but 1 vserver changed IP. Let's say MAC address changed.

I wanted the vserver to get back his old IP, so i shut down the interface and edited /var/lib/misc/dnsmasq.leases (changed new/old IP)

After reboot vserver had wrong new IP again. So i think /var/lib/misc/dnsmasq.leases is just a log-file?!

I fixed the problem with changing vserver IP on console - after reboot vserver had old IP.

But i want to understand - how does dnsmasq save the information "i want to give this IP to this MAC" and how can i change this?!


The dnsmasq.leases file is like a database for dnsmasq to know what address has assigned along with some other info.

According to sites here and here you cand assign static ip to a host as follows:


Note: if you use the first option, you have to make sure the hostname of the client machine match with the entry --dhcp-host=servername in your dnsmasq.conf file.

I hope this helps.


I forgot to stop dnsmasq service before editing dnsmasq.leases.

From https://wiki.gentoo.org/wiki/Dnsmasq

Clients that had a network interface update which results in a different MAC address might not get the intended IP address immediately. This is because the dnsmasq service has provided this IP address to the old MAC address, and will wait until the lease of this address has expired before re-assigning it.

The dnsmasq service stores its leases in /var/lib/misc/dnsmasq.leases. If the lease needs to be removed faster, shut down the dnsmasq service, remove the lease from the dnsmasq.leases file and start the service again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.