[Dnsmasq-discuss] dnsmasq command to add dhcp-host record?
Jelle de Jong
jelledejong at powercraft.nl
Sat Jan 9 15:06:41 GMT 2021
On 1/7/21 11:44 AM, Dominik wrote:
> Hey,
>
> On 06.01.21 21:00, Jelle de Jong wrote:
>> dnsmasq inotify is trigger happy and it would be nice to have a second
>> or so delay in the actual re-scanning, that would help a lot...
>>
>> currently when ansible places the file dnsmasq tries to read the
>> config file, but the content is not always there yet and then it is
>> messed up.
>
> dnsmasq configured the inotify watchers to trigger on either
> file-close-after-write or file-moved-into-directory. There should be no
> way to write to the file without dnsmasq noticing this, EXCEPT, if the
> file is not closed after having done the writing. I just tried the
> following:
>
> 1. Created an empty file in my hostsdir (hostsdir=/etc/hostsdir) directory:
>
> The dnsmasq log said:
>
> Jan 7 11:36:03 dnsmasq[494780]: inotify, new or changed file
> /etc/hostsdir/something
> Jan 7 11:36:03 dnsmasq[494780]: read /etc/hostsdir/something - 0 addresses
>
> 2. Wrote some content into the file (echo "127.1.2.3 somebody" | sudo
> tee /etc/hostsdir/something):
>
> The dnsmasq log said:
>
> Jan 7 11:37:49 dnsmasq[494780]: inotify, new or changed file
> /etc/hostsdir/something
> Jan 7 11:37:49 dnsmasq[494780]: read /etc/hostsdir/something - 1 addresses
>
>
> On 06.01.21 21:00, Jelle de Jong wrote:
>> currently when ansible places the file dnsmasq tries to read the
>> config file, but the content is not always there yet and then it is
>> messed up.
>
> Can you be a bit more specific about this messing up?
>
>
> On 06.01.21 21:00, Jelle de Jong wrote:
>> I need to rewrite the scripts to work in some notification bus
>
> dnsmasq's dbus option may be something for you if you want to go down
> this road.
>
>
> Overall, I'd first check if Ansible closes the file correctly. dnsmasq
> doesn't really have any other way to detect reliably when writing is
> done. As you can see in my example above, everything works as expected
> when doing things manually. Maybe there is another option specifically
> for committing (writing + closing) the file in Ansible?
not an inotify issue here, just the flow of dnsmasq that keeps throwing
me off..
How can I force a new macaddr to an excising IP lease....
Jan 9 15:50:27 firewall01 dnsmasq[3180]: inotify, new or changed file
/etc/dnsmasq.d/dhcp/samba01.powercraft.lan.conf
Jan 9 15:50:27 firewall01 dnsmasq-dhcp[3180]: read
/etc/dnsmasq.d/dhcp/samba01.powercraft.lan.conf
Jan 9 15:50:27 firewall01 dnsmasq[3180]: duplicate dhcp-host IP address
192.168.25.23 at line 1 of /etc/dnsmasq.d/dhcp/samba01.powercraft.lan.conf
There is no duplicated dhcp-host IP address , just a replaced file with
a different macaddr with the same ip...
systemctl stop dnsmasq
vim /var/lib/misc/dnsmasq.leases
# remove all old ip leases releated to the old mac and ip
systemctl start dnsmasq
Kind regards,
Jelle de Jong
More information about the Dnsmasq-discuss
mailing list