/var/etc/dnsmasq-hosts is overwritten on dnsmasq restart

Started by ziel, November 23, 2017, 05:01:46 PM

Previous topic - Next topic
OpnSense Version 17.7.8

Steps to reproduce:
1) ssh
2) su
3) Edit /var/etc/dnsmasq-hosts
4) write file
5) restart dnsmasq in web-GUI

Results:
- in dnsmasq-log "/var/etc/dnsmasq-hosts 0 addresses

Expected results:
- dnsmasq loads addresses from /var/etc/dnsmasq-hosts

Is there a bug or do I have wrong expectations?

Quote from: ziel on November 23, 2017, 05:01:46 PM
Is there a bug or do I have wrong expectations?

Probably the latter, as OPNsense ensures that the content of the configuration files matches the settings you add via the GUI (files are written at many times).

Wrong expectations.
That file is overwritten on boot.
Edit dnsmasq from the webGUI.
Hobbyist at home, sysadmin at work. Sometimes the first is mixed with the second.

We should start from the top: what are you trying to do? :)


Cheers,
Franco

What I wanted to do: have a list of over 3000 hosts, mostly advertising related (adclick etc. taken from https://pgl.yoyo.org/adservers/) that I want to redirect to an internal Adress (where I have set up a black-hole server wich simply logs all requests but returns 404). I would be very time expensive to add all those hosts manually over GUI (https://<opnsense>/services_dnsmasq.php) so I thought I can simply add the host-list to the file mentioned.

OK, I think I understand that the system is working as designed - somehow (I still do not see behind the curtain..)
Maybe I should post a feature-request to be able to upload a list of hosts?

Or is it possible to add the dnsmasq-config -option (probably this directive is use to point to /var/etc/dnsmasq-hosts)

# or if you want it to read another file, as well as /etc/hosts, use
# this.
addn-hosts=<some-other-file>


You may want to read this ticket: https://github.com/opnsense/plugins/issues/229

In includes links and comments which may help you.