AGH is your main DNS resolver (port 53), AGH forward local DNS queries to port 54 (dnsmasq) and non-local queries to your upstream resolvers (such as Google DNS).
I see you're also forwarding non-expanded hosts [//] from AGH to dnsmasq:
upstream_dns:
- '[//]127.0.0.1:54'
This is ok and desirable in most cases, but you need to make sure dnsmasq is treating these queries accordingly.
In dnsmasq:
-
Remove 192.168.0.1 from dnsmasq forward list, you should not be forwarding from dnsmasq to AGH.
-
Add expandhosts '1' to make sure non-expanded hosts are expanded to .lan;
-
Add local '/lan/' to make sure all queries *.lan are resolved in dnsmasq;
-
It's good practice to disable caching when using dnsmasq only for local queries, to make sure local queries are always up to date (in case a DHCP lease is renewed with a different IP);
-
Finally, add noresolv '1' to make sure you're not leaking any queries to your ISP DNS servers.
Your dnsmasq config should look like this:
config dnsmasq
option authoritative '1'
option domain 'lan'
option rebind_protection '0'
option localservice '0'
option cachesize '0'
option port '54'
option local '/lan/'
option expandhosts '1'
option noresolv '1'
AGH config:
local_ptr_upstreams:
- 192.168.0.1:54
Change to:
local_ptr_upstreams:
- 127.0.0.1:54
Difference is minimal on most setups, but its always best to use loopback interface where applicable to avoid network overhead.
One question regarding this:
upstream_dns:
- 8.8.8.8
- 8.8.4.4
Is there any specific reason for you to use plain text DNS (unencrypted DNS over port 53)?
If not, I'd change that to not expose your queries in plain text for your ISP, governement or whoever to read.
In terms of encrypted DNS speed, there isn't much practical difference but in theory from fastest to slowest:
DNS over QUIC > DNS over HTTPS/3 > DNS over TLS > DNS over HTTPS/2 > DNSCrypt.
Personally I recommend DNS over QUIC and TLS for privacy reasons, DNS over HTTPS adds unnecessary fingerprints that could be used to identify the source (you).
See this: https://adguard-dns.io/kb/general/dns-providers/