How to set DNS settings from setupVars or commandline?

Please follow the below template, it will help us to help you!

Expected Behaviour:

I would like to set two values to true for my pihole service via the commandline when launching pihole, or as entries in the SetupVars file:

  • Never forward non-FQDNs
  • Never forward reverse lookups for private IP ranges

This is required because in multiple docker deployments, these settings are not persisted through a restart despite all other settings being retained - see Some DNS settings being lost on docker restart for details.

-operating system - Ubuntu 18.04 LTS
-hardware whitebox intel

Actual Behaviour:

Can't see any way to set these manually.

Debug Token:

https://tricorder.pi-hole.net/mobqsdib3h

There is no documentation for that, but looking at the source code you should be able to figure out the commands

Alternatively, you could modify /etc/dnsmasq.d/01-pihole.conf directly (add/remove domain-needed, bogus-priv) and restart pihole dns (pihole restartdns)

I'd be surprised if that is indeed the case.

The settings you mention translate to respective lines in Pi-hole's dnsmasq configuration, and if you did draw on Pi-hole's docker documentation for configuring your Pi-hole container, you'd have defined a bind-mount for /etc/dnsmasq.d/ that will have created that mount in your host's filesystem upon the container's first start.
That way, any changes to those files (as well as to files from /etc/pihole/) would survive a container restart.

There would be no need to fiddle with command line options at all, and I'd advise against doing so, unless we would have confirmed the cause for your observation being outside other mitigation approaches.

One way to mess this up would be by creating and populating those directories manually in your host system independently of a container, which will have Docker obscure those directories' existing contents from your Pi-hole container, quite possibly resulting in behaviour very similar to your observation.

Since you mention multiple docker deployments (of Pi-hole?) and manually adjusting file permissions:
Did you try to share Pi-hole's configuration by copying those host's folders around to start a Pi-hole container on a different machine?

I do have bind mounts, and I described these in Some DNS settings being lost on docker restart - should have repeated it here, but I had abandoned hope on that item :slight_smile:

Every other setting is persisted, all other content is saved between restarts.

I've never shared my configuration - I've started each one from scratch and allowed docker to create the paths. In all cases (docker on Mac, docker on Linux bare metal, docker on Linux KVM guest), the same behaviour occurs - all settings OTHER than these two are persisted and these are lost on each restart.

So I've given up trying to fix the underlying problem, and just want to manually set these now which I think yubiuser has kindly answered.

Ok, since you're sure that pre-creation isn't your issue:
Did you try to set them via Docker environment variables for Pi-hole instead of manipulating the files?

DNS_BOGUS_PRIV and DNS_FQDN_REQUIRED would be the corresponding values.

1 Like

I have not tried those env vars - thanks very much - that'll do it !

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