Ping google.com fails and /etc/resolv.conf gets overwritten

Expected Behaviour:

ping google.com and nslookup google.com should work from my pihole after rebooting.
I am running pihole v5.18.3 with Raspbian GNU/Linux 12 (bookworm) on a Raspberry Pi Zero 2W.

Actual Behaviour:

When running ping google.com, I get

ping: google.com: Temporary failure in name resolution

When running ping google.com, I get

;; communications error to 192.168.18.1#53: timed out

My current /etc/resolv.conf is

# Generated by NetworkManager
nameserver 192.168.18.1

When I change it to

domain net
search net
nameserver 192.168.18.13
nameserver 0.0.0.0

as per another post, everything is working until I reboot. What should I do to solve the problem?

Debug Token:

I cannot upload the debug log but here are the problematics lines apparently:

*** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
[✓] brapolice.com is 0.0.0.0 on lo (127.0.0.1)
[✓] brapolice.com is 0.0.0.0 on wlan0 (192.168.18.13)
[✓] doubleclick.com is 142.251.33.174 via a remote, public DNS server (8.8.8.8)

*** [ DIAGNOSING ]: Name resolution (IPv6) using a random blocked domain and a known ad-serving domain
[✓] prof.nieza.site is :: on lo (::1)
[✗] Failed to resolve prof.nieza.site on wlan0 (fe80::3fb5:d480:7ef3:225f)
[✗] Failed to resolve doubleclick.com via a remote, public DNS server (2001:4860:4860::8888)

*** [ DIAGNOSING ]: contents of /etc/lighttpd/conf.d
/etc/lighttpd/conf.d does not exist.


[?] Would you like to upload the log? [y/N] y
    * Using curl for transmission.
    * curl failed, contact Pi-hole support for assistance.
    * Error message: curl: (6) Could not resolve host: tricorder.pi-hole.net

[✗] There was an error uploading your debug log.
   * Please try again or contact the Pi-hole team for assistance.
   * A local copy of the debug log can be found at: /var/log/pihole/pihole_debug.log

There is nothing wrong in the lines above. We need a debut token.

This will temporarily reset the nameserver on the server to bypass Pi-Hole DNS.

sudo nano /etc/resolv.conf

Edit the nameserver line to nameserver 9.9.9.9 or your preferred third party DNS service, save and exit.

Run

pihole -d

Upload the debug log and post here only the Token.

Here is the token: https://tricorder.pi-hole.net/4fllC0Wp/

What is the full output of these commands?

nslookup google.com
nslookup google.com 192.168.18.13

Note:
Ping is not the best tool to test DNS and ping errors may not be related to Pi-hole.

The first command gives me

;; communications error to 192.168.18.1#53: timed out
;; communications error to 192.168.18.1#53: timed out
;; communications error to 192.168.18.1#53: timed out
;; no servers could be reached

The second command gives me

Server:		192.168.18.13
Address:	192.168.18.13#53

Non-authoritative answer:
Name:	google.com
Address: 142.251.41.46
Name:	google.com
Address: 2607:f8b0:400b:803::200e

Your debug log shows that your router is distributing itself as DNS server via DHCP:

*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
   Scanning all your interfaces for DHCP servers
   
   * Received 286 bytes from wlan0:192.168.18.1
     Offered IP address: 192.168.18.13
     DHCP options:
      Message type: DHCPOFFER (2)
      router: 192.168.18.1
      dns-server: 192.168.18.1

This could only be a valid configuration if your router would use Pi-hole as its only upstream DNS server.

At the same time, an nslookup using your router for DNS times out:

This would indicate that your router isn't accepting DNS requests, or not running a DNS server at all.

So obviously, your Pi-hole machine's NetworkManager is picking up 192.168.18.1 as DNS server from your router's DHCP server, but your 192.168.18.1 is not processing DNS.

To mitigate this, you should configure your router to distribute Pi-hole exclusively as local DNS server (commonly, a LAN/DHCP kind of option).

If your router doesn't support that, and you are manually pointing your clients to use Pi-hole for DNS, then you could consider to configure your Pi-hole machine's NetworkManager to use a public DNS server (like 9.9.9.9) instead, e.g. via nmtui.

192.168.18.1 is my router. Apparently, the way I was setting my DNS to 192.168.18.13 (my pi-hole) was incorrect. I found another way to set it in the router and now everything seems to work fine. Thanks!

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