How do I disable Pi-hole automatic add 127.0.0.1 in resolv.conf

I'm using Debian9 latest Pi-hole ( Not on raspberry PI, on external self-hosted Server )
How can I avoid every time restart pi-hole auto add nameserver 127.0.0.1 inside /etc/resolv.conf

Why do you want to disable this? What other nameserver are you trying to use?

I dont want my server resolve dns from pi-hole, I want it go through Cloudflare or Quad9.
Pi-hole use as DNS caching for others local network clients.

What server are you referring to? I'm not following what you are trying to do here.

I dont want my DNS server do DNS resolution via Pi-hole 127.0.0.1, its very annoyed manually edit resolv.conf to nameserver 9.9.9.9.
I want to know is there an easy way to disable this automation option?

I have client connecting to my Pi-hole server (debian) IP: 192.168.1.2
My point is, on server it self, I dont like pihole always auto edit resolv.conf 127.0.0.1 to do DNS resolution. Anyway to disable or I can config this script?
It just simple for server it self to use 9.9.9.9 or 1.1.1.1 upstream server.
It wont affect those client to use 192.168.1.2 as DNS server.

You will need to change pi-hole/pihole-FTL.service at master · pi-hole/pi-hole · GitHub to use the server you'd like. I'm not sure if we overwrite that file on update, but that should keep it from resetting on every boot or service start.

We've been discussing removing the localhost nameserver on the actual Pi-hole device, but we have not yet come to a decision.

1 Like

Cool. Thanks. :sunglasses:

Sure, that file should be in /etc/init.d/

It works ~~

3 Likes

Yeah me too disagree with putting Pi-hole in resolv.conf.
A server should boot without depending too much on its own services.

Really it was done for people using Rasbpian Stretch Desktop or another GUI on the same Pi-hole and browsing with that same device. It would be nicer to not have that dependency and would save a few issues of having to edit /etc/resolv.conf when things stop working though.

1 Like

A desktop ... on a server :smiley:

I also try on Raspberry PI 3 and Pi-hole itself. I think I prefer in resolv.conf at least has a backup upstream nameserver. When pi-hole down, Raspberry Pi itself still can access to Internet. :thinking:

You cant put in a backup as the host will try to resolve against both DNS servers set in resolv.conf.
So you dont have consistent ad blocking.

Yap I know, for raspberry it self.

Just did a quick search, but I do believe /etc/resolv.conf is strict order and will query in order. There is a rotate option that will distribute queries, but by default it should only be trying the second listed if the first does not respond.

http://www.linuxhowtos.org/Tips%20and%20Tricks/improving_dns_lookups.htm

Yeah it appears so:

pi@noads:~ $ man resolv.conf
[..]
   nameserver Name server IP address
          Internet address of a name server that  the  resolver  should
          query,  either  an IPv4 address (in dot notation), or an IPv6
          address in colon (and possibly dot) notation as per RFC 2373.
          Up to MAXNS (currently 3, see <resolv.h>) name servers may be
          listed, one per keyword.  If there are multiple servers,  the
          resolver  library  queries  them  in the order listed.  If no
          nameserver entries are present, the default  is  to  use  the
          name  server on the local machine.  (The algorithm used is to
          try a name server, and if the query times out, try the  next,
          until  out  of  name servers, then repeat trying all the name
          servers until a maximum number of retries are made.)
[..]
          rotate Sets  RES_ROTATE  in _res.options, which causes round-
                 robin selection  of  name  servers  from  among  those
                 listed.   This  has  the effect of spreading the query
                 load among all listed servers, rather than having  all
                 clients try the first listed server first every time.
[..]
1 Like

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