OPNsense Forum

Archive => 17.7 Legacy Series => Topic started by: ziel on November 23, 2017, 05:01:46 pm

Title: /var/etc/dnsmasq-hosts is overwritten on dnsmasq restart
Post by: ziel on November 23, 2017, 05:01:46 pm
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?
Title: Re: /var/etc/dnsmasq-hosts is overwritten on dnsmasq restart
Post by: fabian on November 23, 2017, 05:26:40 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).
Title: Re: /var/etc/dnsmasq-hosts is overwritten on dnsmasq restart
Post by: weust on November 23, 2017, 05:27:40 pm
Wrong expectations.
That file is overwritten on boot.
Edit dnsmasq from the webGUI.
Title: Re: /var/etc/dnsmasq-hosts is overwritten on dnsmasq restart
Post by: franco on November 23, 2017, 07:09:00 pm
We should start from the top: what are you trying to do? :)


Cheers,
Franco
Title: Re: /var/etc/dnsmasq-hosts is overwritten on dnsmasq restart
Post by: ziel on November 27, 2017, 04:20:23 pm
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>

 
Title: Re: /var/etc/dnsmasq-hosts is overwritten on dnsmasq restart
Post by: fabian on November 27, 2017, 06:28:48 pm
You may want to read this ticket: https://github.com/opnsense/plugins/issues/229

In includes links and comments which may help you.