I see that by default the dnsmasq leasefile is in /tmp/leasefile. This means that on a router restart (which happens rarely when I'm troubleshooting, but it's still something that does happen), because the file is lost, all wifi devices renew dhcp leases but wired ones don't. This has the sideeffect that ethers defined dns addresses such as my-host.lan no longer resolves to the correct ip, even if the host is still holding to that ip, because the leasetime isn't over and it does not need to renew yet.
Moving the leasefile to a non-temporary directory should mean on a reboot it is read, and state is not lost. However, I'm here going, if it was this simple, I feel that'd be the default behavior. Am I missing something here? Would this be a good idea or come with serious downsides? Perhaps another question is, what's the justification for the current setup being the default?
Yes, I am using static leases, as I had mentioned as the ethers file. The issue is that, on a reboot, openwrt loses track of the active dhcp lease, and doesn't actually resolve my-host.lan to the static lease ip, until the host renews the dhcp lease.
A static lease, defined in the ethers file, maps a mac address to a custom name and a static ip. This way, name.lan gets mapped to the ip (as dnsmasq handles both dns and dhcp, it can easily integrate these), as long as there is an active dhcp lease (which is what I discovered at least, and the root of my problem).
The documentation for uci based configuration actually exposes all of these options. Maybe interesting to check (tho it's just examples, not explained in detail. For that, it's best to look into further documentation of the underlying tooling and the generated files)
Because I have some other tools that are looking at /tmp/dhcp.leases and are not set up to follow that config option. But if that same situation doesn’t apply to another, then by all means the config option would be the way to go.
I use option dhcphostsfile '/etc/config/dhcp.hosts' , and when I edit this file, I run a script that copy the entries to /etc/hosts file . This way my dns always translate, with or without an active dhcp lease
In dhcp.hosts, the entry is something like this: XX:XX:XX:XX:XX:XX,192.168.21.141,note