I am using dnsmasq to serve IPs for about 200 vservers.
Leasetime is infinite:
dhcp-range=10.0.1.2,10.0.1.254,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?!
Best Answer
The
dnsmasq.leases
file is like a database fordnsmasq
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 yourdnsmasq.conf
file.I hope this helps.