Unbound working but not working?

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

If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.

Expected Behaviour:

[ When digging 127.0.0.1#5353 ! should not recieve an error reply...]

Actual Behaviour:

_[Unbound is playing tricks on me. I always recieve this error when digging:
; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> pi-hole.net @127.0.0.1 -p 5335
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 6106
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;pi-hole.net. IN A

;; Query time: 215 msec
;; SERVER: 127.0.0.1#5335(127.0.0.1) (UDP)
;; WHEN: Sat Apr 13 00:12:28 PST 2024
;; MSG SIZE rcvd: 40

I know I configured unbound properly. I tried using 127.0.0.1#5353 as dns and its working. What's up with this error? Or maybe I'm just not able to read this result?]_

Debug Token:

[ https://tricorder.pi-hole.net/LEKpjsHE/]

I don't think this is the case. Your unbound instance is operating on port 5335, not 5353:

*** [ DIAGNOSING ]: Ports in use
    udp:127.0.0.1:5335 is in use by unbound

Your debug log shows that earlier in the day, you were using this port and receiving no replies:

   Apr 13 00:00:05 dnsmasq[9201]: forwarded . to 127.0.0.1#5353
   Apr 13 00:00:05 dnsmasq[9201]: query[PTR] 9.9.9.9.in-addr.arpa from 127.0.0.1
   Apr 13 00:00:05 dnsmasq[9201]: forwarded 9.9.9.9.in-addr.arpa to 127.0.0.1#5353
   Apr 13 00:00:05 dnsmasq[9201]: query[A] services-bingapis-com.e-0001.e-msedge.net from 192.168.80.253
   Apr 13 00:00:05 dnsmasq[9201]: forwarded services-bingapis-com.e-0001.e-msedge.net to 127.0.0.1#5353
   Apr 13 00:00:08 dnsmasq[9201]: query[NS] . from 192.168.80.253
   Apr 13 00:00:08 dnsmasq[9201]: forwarded . to 127.0.0.1#5353

But, later the port was changed to 5335 and replies were received from unbound:

   -----tail of pihole.log------
   Apr 13 00:43:13 dnsmasq[15573]: forwarded dual-s-ring.msedge.net to 127.0.0.1#5335
   Apr 13 00:43:13 dnsmasq[15573]: reply dual-s-ring.msedge.net is <CNAME>
   Apr 13 00:43:13 dnsmasq[15573]: reply s-ring.dual-s-9999.dual-s-msedge.net is <CNAME>
   Apr 13 00:43:13 dnsmasq[15573]: reply dual-s-9999.dual-s-msedge.net is 52.123.129.254
   Apr 13 00:43:13 dnsmasq[15573]: reply dual-s-9999.dual-s-msedge.net is 52.123.128.254
   Apr 13 00:43:13 dnsmasq[15573]: query[A] s-ring.dual-s-9999.dual-s-msedge.net from 192.168.80.253
   Apr 13 00:43:13 dnsmasq[15573]: forwarded s-ring.dual-s-9999.dual-s-msedge.net to 127.0.0.1#5335
   Apr 13 00:43:13 dnsmasq[15573]: reply s-ring.dual-s-9999.dual-s-msedge.net is <CNAME>
   Apr 13 00:43:13 dnsmasq[15573]: reply dual-s-9999.dual-s-msedge.net is 52.123.129.254
   Apr 13 00:43:13 dnsmasq[15573]: reply dual-s-9999.dual-s-msedge.net is 52.123.128.254

This indicates that (at least at that time) unbound was responding to queries.

Let's take a look at two potential causes of unbound errors.

Is the date/time on the Pi correct and matches your local time?

date

Please post the output of the following command from the Pi terminal:

sudo grep -v '#\|^$' -R /etc/unbound/unbound.conf*

1 Like

Here's the output:
Sat Apr 13 07:28:57 AM PST 2024
root@orangepipc:~# sudo grep -v '#|^$' -R /etc/unbound/unbound.conf*
/etc/unbound/unbound.conf:include-toplevel: "/etc/unbound/unbound.conf.d/*.conf"
/etc/unbound/unbound.conf.d/pi-hole.conf.save:server:
/etc/unbound/unbound.conf.d/pi-hole.conf.save: verbosity: 0
/etc/unbound/unbound.conf.d/pi-hole.conf.save: interface: 127.0.0.1
/etc/unbound/unbound.conf.d/pi-hole.conf.save: port: 5335
/etc/unbound/unbound.conf.d/pi-hole.conf.save: do-ip4: yes
/etc/unbound/unbound.conf.d/pi-hole.conf.save: do-udp: yes
/etc/unbound/unbound.conf.d/pi-hole.conf.save: do-tcp: yes
/etc/unbound/unbound.conf.d/pi-hole.conf.save: do-ip6: no
/etc/unbound/unbound.conf.d/pi-hole.conf.save: prefer-ip6: no
/etc/unbound/unbound.conf.d/pi-hole.conf.save: harden-glue: yes
/etc/unbound/unbound.conf.d/pi-hole.conf.save: harden-dnssec-stripped: yes
/etc/unbound/unbound.conf.d/pi-hole.conf.save: use-caps-for-id: no
/etc/unbound/unbound.conf.d/pi-hole.conf.save: edns-buffer-size: 1232
/etc/unbound/unbound.conf.d/pi-hole.conf.save: prefetch: yes
/etc/unbound/unbound.conf.d/pi-hole.conf.save: num-threads: 4
/etc/unbound/unbound.conf.d/pi-hole.conf.save: so-rcvbuf: 1m
/etc/unbound/unbound.conf.d/pi-hole.conf.save: private-address: 192.168.0.0/16
/etc/unbound/unbound.conf.d/pi-hole.conf.save: private-address: 169.254.0.0/16
/etc/unbound/unbound.conf.d/pi-hole.conf.save: private-address: 172.16.0.0/12
/etc/unbound/unbound.conf.d/pi-hole.conf.save: private-address: 10.0.0.0/8
/etc/unbound/unbound.conf.d/pi-hole.conf.save: private-address: fd00::/8
/etc/unbound/unbound.conf.d/pi-hole.conf.save: private-address: fe80::/10
/etc/unbound/unbound.conf.d/pi-hole.conf.save: tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
/etc/unbound/unbound.conf.d/pi-hole.conf.save: forward-zone:
/etc/unbound/unbound.conf.d/pi-hole.conf.save: name: "."
/etc/unbound/unbound.conf.d/pi-hole.conf.save: forward-tls-upstream: yes
/etc/unbound/unbound.conf.d/root-auto-trust-anchor-file.conf:server:
/etc/unbound/unbound.conf.d/root-auto-trust-anchor-file.conf: auto-trust-anchor-file: "/var/lib/unbound/root.key"
/etc/unbound/unbound.conf.d/pi-hole.conf:server:
/etc/unbound/unbound.conf.d/pi-hole.conf: verbosity: 0
/etc/unbound/unbound.conf.d/pi-hole.conf: interface: 127.0.0.1
/etc/unbound/unbound.conf.d/pi-hole.conf: port: 5335
/etc/unbound/unbound.conf.d/pi-hole.conf: do-ip4: yes
/etc/unbound/unbound.conf.d/pi-hole.conf: do-udp: yes
/etc/unbound/unbound.conf.d/pi-hole.conf: do-tcp: yes
/etc/unbound/unbound.conf.d/pi-hole.conf: do-ip6: no
/etc/unbound/unbound.conf.d/pi-hole.conf: prefer-ip6: no
/etc/unbound/unbound.conf.d/pi-hole.conf: harden-glue: yes
/etc/unbound/unbound.conf.d/pi-hole.conf: harden-dnssec-stripped: yes
/etc/unbound/unbound.conf.d/pi-hole.conf: use-caps-for-id: no
/etc/unbound/unbound.conf.d/pi-hole.conf: edns-buffer-size: 1232
/etc/unbound/unbound.conf.d/pi-hole.conf: prefetch: yes
/etc/unbound/unbound.conf.d/pi-hole.conf: num-threads: 4
/etc/unbound/unbound.conf.d/pi-hole.conf: so-rcvbuf: 1m
/etc/unbound/unbound.conf.d/pi-hole.conf: private-address: 192.168.0.0/16
/etc/unbound/unbound.conf.d/pi-hole.conf: private-address: 169.254.0.0/16
/etc/unbound/unbound.conf.d/pi-hole.conf: private-address: 172.16.0.0/12
/etc/unbound/unbound.conf.d/pi-hole.conf: private-address: 10.0.0.0/8
/etc/unbound/unbound.conf.d/pi-hole.conf: private-address: fd00::/8
/etc/unbound/unbound.conf.d/pi-hole.conf: private-address: fe80::/10
/etc/unbound/unbound.conf.d/pi-hole.conf: tls-cert-bundle: /etc/ssl/certs/ca-certificates.crt
/etc/unbound/unbound.conf.d/pi-hole.conf: forward-zone:
/etc/unbound/unbound.conf.d/pi-hole.conf: name: "."
/etc/unbound/unbound.conf.d/pi-hole.conf: forward-tls-upstream: yes

Thank you. I noticed my error earlier and changed the port and rerun debug and resent it again. Sorry for the confusion. Btw, the dig output looking great now I guess I'm just sleepy at that time. Human error😂.

; <<>> DiG 9.18.18-0ubuntu0.22.04.2-Ubuntu <<>> pi-hole.net @127.0.0.1 -p 5335
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2656
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;pi-hole.net. IN A

;; ANSWER SECTION:
pi-hole.net. 300 IN A 3.18.136.52

;; Query time: 47 msec
;; SERVER: 127.0.0.1#5335(127.0.0.1) (UDP)
;; WHEN: Sat Apr 13 07:34:02 PST 2024
;; MSG SIZE rcvd: 56

That output shows that you have duplicated your configuration file, potentially being applied unintentionally.
You should remove the .save file, or move it to a different location.

Complementing the answer:

The .save file extension is usually used for "auto-saved" files when nano (or possibly another text editor) is forced to close before save the file.

From nano manual, section Notes:

In some cases nano will try to dump the buffer into an emergency file. This will happen mainly if nano receives a SIGHUP or SIGTERM or runs out of memory. It will write the buffer into a file named nano.save if the buffer didn’t have a name already, or will add a .save suffix to the current filename. If an emergency file with that name already exists in the current directory, it will add .save plus a number (e.g. .save.1) to the current filename in order to make it unique. In multibuffer mode, nano will write all the open buffers to their respective emergency files.

This file was probably created unintentionally, as suggested above.