brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: AdGuard Home's blocking mode decides what a blocked domain returns

Network and access
~/tips/tip-adguard-home-blocking-mode

dig @192.168.1.2 doubleclick.net

Explains the answer types AdGuard Home can send for blocked domains and which one to choose.

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_ipv4 and blocking_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

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk Table = off All Network and access tips (163) All topics

Link