Not all static leases are resolved from clients

I must be missing something. I have a number of static leases for hosts on my lan. Each of them has the following form in my /etc/config/dhcp:

config host
        option name 'kiwi'
        list mac 'xx:xx:xx:xx:xx:xx'
        option ip '192.168.1.215'

I can see all of them on Luci in the DHCP and DNS section.

Some hosts in that list will reply just fine on `ping ` but the above does not (as well as a couple of others). The ping on the IP works. I’ve tried adding `.lan` but I don’t have to do that with others. My `/etc/hosts` on my machine has no entry.

This goes on and off. Could it be that kiwi hasn’t re-established an DHCP lease and that’s why its name is not exposed? What am I missing?

Very likely. dnsmasq won’t resolve a local host if it doesn’t see an active lease in its internal database.

You can also add option dns '1' to each lease in order to force it into the router’s hosts file so it will always resolve.

2 Likes

Sweet. Thanks for the quick reply. Is that the recommended approach or am I doing this wrong? My goal is that device that connects with a given mac address gets an IP and have their name exposed on the LAN. Is there another way that’s cleaner?

Does kiwi actually use DHCP, or is the IP manually assigned on the device? Theoretically dnsmasq should only be unaware of the lease after a router reboot when the lease file gets lost from memory and kiwi has not yet renewed its existing lease.

It does use DHCP. After waiting an hour or so it works. So I guess the right option is the following?

config host
        option name 'kiwi'
        list mac 'xx:xx:xx:xx:xx:xx'
        option ip '192.168.1.215'
        options dns '1'

Thanks again!

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

Thanks. Adding the dns option works, including for hosts for which I have a static IP configuration.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.