Blocking a domain in DNS sounds like one thing, but the server still has to send something back. AdGuard Home lets you pick what that answer looks like, and I think it’s worth knowing which one you’re running, because it changes how blocked requests behave on your devices.
The setting is Blocking mode under Settings > DNS settings > DNS server configuration (blocking_mode in the filtering section of AdGuardHome.yaml). The options:
- Default: 0.0.0.0 (or
::for IPv6) when an Adblock-style rule blocks it, and the IP address written in the rule when a hosts-style rule blocks it. - NXDOMAIN: the domain does not exist.
- Null IP: always 0.0.0.0 or
::. - Custom IP: an address you choose, set in
blocking_ipv4andblocking_ipv6. - REFUSED: the server refuses to answer.
You can see the difference from any machine with dig:
dig @192.168.1.2 doubleclick.net
With NXDOMAIN you get status: NXDOMAIN and no answer. With Default or Null IP you get status: NOERROR and an A record of 0.0.0.0. The Default mode has one quirk I like to remember: if your blocklists are hosts files that say 127.0.0.1 somedomain, clients get 127.0.0.1 back, which means they try to connect to themselves.
My advice is to stay on Default or Null IP. I’d avoid REFUSED: to a client it looks like a server that won’t do its job, and a device with a second DNS server configured may simply go and ask that one. Custom IP is handy when you run a small local page that says “blocked by AdGuard”.
The caveat is caching. Right next to it is Blocked response TTL, the number of seconds clients may cache a blocked answer. After you change the mode or unblock a domain, devices can keep the old answer until that time runs out, so a test right after saving can fool you.
Further reading: AdGuard Home configuration (wiki)
Going deeper: Guide: AdGuard Home with Unbound: resolve DNS yourself instead of asking Cloudflare or your ISP