OPNsense Forum

English Forums => General Discussion => Topic started by: ciaduck on November 28, 2026, 06:55:57 AM

Title: Actually fixing Unbound SERVFAIL (Hint: DoT and NTP)
Post by: ciaduck on November 28, 2026, 06:55:57 AM
I finally got to the point where I understood this problem, and I believe I have resolved the issue. I've even disabled my hacky monit script to restart unbound.

For the longest time, usually in the middle evening (10PM-12AM), I would be faced with failing DNS queries, and the only recourse I had was to restart the Unbound.

This week I discovered a very handy and important setting.
Services -> Unbound DNS -> Advanced -> Log SERVFAIL
Enabling "Log SERVFAIL" in the advanced settings helped me to determine what was going on.

The root (haha) of the problem:
error: SERVFAIL <ssl.gstatic.com. AAAA IN>: all the configured stub or forward servers failed, at zone . no server to query nameserver addresses not usable have no nameserver names
Servfail logging told me that Unbound was failing to resolve root (.) for all queries against the DNS provider (quad9). This was strange to me, and I began digging around for reasons DNS over TLS would fail. One of those reasons is failing the TLS handshake, possibly due to time being too far off. I don't know what the threshold for this is, but it seemed likely in my setup.

My NTP servers are set to the NIST pool (time.nist.gov). Naturally this requires a successful DNS request to sync/check servers. If DoT has failed TLS, and NTP isn't able to perform a lookup, you can see how it would just continue to fail.

The Fix:
I identified some misconfig in my NTP settings.
1) I made sure that time.nist.gov had "pool" and "prefer" checked (pool was not initially).
2) I also made sure that in my list of servers I gave one that is by IP instead of hostname. The logic here is that if DNS fails for any reason, NTP will still have one server via IP to fall back on.

These two simple changes seem to have resolved my unbound issues, mostly thanks to actually logging the errors. Other ways to avoid this are to have some fallback query forwarding set up in unbound, but I didn't want to have any unencrypted DNS, so my Query Forwarding page only specifies local hosts/domains to target DNSmasq.

I hope someone in the future finds this useful.