OPNsense Forum

Archive => 20.7 Legacy Series => Topic started by: niziak on January 11, 2021, 10:06:05 am

Title: Dynamic hosts from DHCP missing in /var/etc/dnsmasq-hosts
Post by: niziak on January 11, 2021, 10:06:05 am
Sometimes (very rare), I'm observing that I cannot resolve hostname which gets address from DHCP.
Hostname and its IP is  correctly shown on "leases" page. But file /var/etc/dnsmasq-hosts doesn't contain this host in section
Code: [Select]
# dhcpleases automatically entered
I just wondering how to reproduce this problem. Can you check if race is possible when  /var/etc/dnsmasq-hosts is generated (i.e. In case when two hosts refresh their leases in the same time) ?
Title: Re: Dynamic hosts from DHCP missing in /var/etc/dnsmasq-hosts
Post by: thomas.schmid on June 24, 2022, 04:02:05 pm
Hi,
The same here: dynamic addresses issued by DHCP server are listed in its "leases" file, but are not transfered to DNSmasq's "host" file, until 1) some unknown event happens or 2) we restart DNSmasq from OPNsense Web GUI.

The culprit is the "dhcpleases" service, which AFAIK is responsible for transferring the IP/FQDN entries from DHCP "leases" to DNSmasq "hosts". Today, one of our software engineers found out that "dhcpleases" a) is in all practicality unmaintained and b) could be "revived" by attaching "truss" to it for a short time, then detaching it again:

Looks like it repeatedly gets stuck in kqueue (after dhcpd cleans up its leases file, i.e. renames the old one and starts writing to a new one), but it's a Heisenbug, so as soon as you truss it, it resumes operation. So we just temporarily run truss on it and then terminate again.

Ugly, but it seems to work.

So, question: Anybody has a proper solution to this problem ?