Refreshing dnsmasq from CLI?

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

Expected Behaviour:

Should pihole restartdns w/o options reparse setupVars.conf and update /etc/dnsmasq.d/01-pihole.conf?

How do I use the pihole CLI to reload after manually updating setupVars.conf?

Actual Behaviour:

pihole restartdns (w/o options) does not update /etc/dnsmasq.d/01-pihole.conf.

The Save button under DNS Settings seems to update /etc/dnsmasq.d/01-pihole.conf, but it's not obvious how to do this from the CLI. Similar to this question under Docker.

Debug Token:

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

pihole restartdns might be what you're looking for.

The pihole command - Pi-hole documentation - Pi-hole documentation

In general, you should not edit setupVars.conf manually.
Instead, run pihole -r with Reconfigure .

You may get away with restarting Pi-hole's DNS resolver via Settings | System or pihole restartdns, but Reconfigure may do more than just writing a value to setupVars.conf.
If you go down that road, don't complain if your Pi-hole doesn't behave as expected.

For a Pi-hole Docker container, it's different again:
Just change its environment variables and restart the container.

Yeah, I have a similar question... the UI Save button updates /etc/dnsmasq.d/01-pihole.conf with:

server=1.1.1.1
server=9.9.9.9

But, it's not obvious how to do this from the CLI when manually updating /etc/pihole/setupVars.conf.

pihole restartdns does not update dnsmasq.

Maybe updating upstream DNS servers from the CLI should be a feature request?

Please don't hijack unrelated issues.
I've moved your post to the separate topic you've created.

As for your question, see my answer above.

pihole -r is interactive. How do I programmatically change/update only the Upstream DNS Server(s)? The manual way, obviously, is through the web UI and clicking the Save button. There must be a CLI equivalent of this?

well, risk hijacking a thread or being told did you search existing issues... :sweat_smile:

Unfortunately, pihole restartdns does not update /etc/dnsmasq.d/01-pihole.conf. See above

Answered here:

Not completely.
You may only set a single DNS server, using e.g. pihole -a setdns 127.0.0.1#5335.

Nor is it intended to do so.

/etc/dnsmasq.d/01-pihole.conf:

###############################################################################
#      FILE AUTOMATICALLY POPULATED BY PI-HOLE INSTALL/UPDATE PROCEDURE.      #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#        IF YOU WISH TO CHANGE THE UPSTREAM SERVERS, CHANGE THEM IN:          #
#                      /etc/pihole/setupVars.conf                             #

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