Network-wide DNS filtering is the foundational layer of digital privacy. While cloud services like NextDNS provide effortless ad interception away from home, self-hosting AdGuard Home paired with a local Unbound recursive DNS resolver guarantees that 100% of your domain queries remain on your local hardware. In this deployment guide, we build a production-grade Docker Compose stack featuring native DNS-over-QUIC (DoQ) encryption, 0-RTT session resumption, and authoritative root recursive resolution.

1. The Two-Tier DNS Architecture Explained

Standard router DNS forwards all lookup requests unencrypted to your ISP or commercial servers. Our hardened homelab stack divides responsibilities across two isolated containers on an internal Docker bridge network:

  • Frontend Filter (AdGuard Home - Port 53 / 853): Listens on port 53 (plain DNS) and port 853 (DNS-over-QUIC / DNS-over-TLS). Matches incoming queries against blocklists, intercepts telemetries, and returns 0.0.0.0 for ad domains in 1.4 milliseconds.
  • Backend Recursive Resolver (Unbound - Port 5335): Only accessible internally by AdGuard Home. Instead of forwarding queries to Google (8.8.8.8) or Cloudflare (1.1.1.1), Unbound iterates directly from the 13 global DNS root servers down to authoritative TLD name servers with strict DNSSEC verification.

2. Production Docker Compose Configuration

Create a directory named adguard-unbound and save the following docker-compose.yml file:

services:
  unbound:
    image: mvance/unbound:latest
    container_name: unbound
    restart: unless-stopped
    networks:
      adguard_net:
        ipv4_address: 172.20.0.5
    volumes:
      - ./unbound/unbound.conf:/opt/unbound/etc/unbound/unbound.conf:ro
    ports:
      - "127.0.0.1:5335:53/tcp"
      - "127.0.0.1:5335:53/udp"

  adguard:
    image: adguard/adguardhome:latest
    container_name: adguardhome
    restart: unless-stopped
    depends_on:
      - unbound
    networks:
      adguard_net:
        ipv4_address: 172.20.0.6
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "853:853/tcp"
      - "853:853/udp"
      - "3000:3000/tcp"
      - "8080:80/tcp"
    volumes:
      - ./adguard/work:/opt/adguardhome/work
      - ./adguard/conf:/opt/adguardhome/conf

networks:
  adguard_net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.20.0.0/24

3. Configuring Unbound as Upstream in AdGuard Home

Once both containers are launched with docker compose up -d, complete the initial AdGuard Home web setup at http://<server-ip>:3000. Then navigate to Settings → DNS Settings:

Upstream DNS Servers:
172.20.0.5:53
(This points directly to the internal IP address of the Unbound container over the Docker bridge network).

4. Enabling Native DNS-over-QUIC (DoQ) Encryption

To allow your mobile devices and laptops to connect securely over port 853 when away from home:

πŸš€
Interactive Tool

RAM Speed & True Latency Calculator

Calculate exact real response times in nanoseconds (ns) and dual-channel bandwidth for AMD Ryzen & Intel PC builds.

Calculate Latency →
  • Navigate to Settings → Encryption Settings.
  • Check Enable Encryption.
  • Enter your server domain name (e.g. dns.yourdomain.com) and provide your Let's Encrypt certificate and private key.
  • Ensure UDP port 853 is forwarded on your firewall to permit QUIC handshakes.

Compare this deployment with our full guide on Pi-hole vs NextDNS vs AdGuard Home to review protocol latency and memory benchmarks.

Unbound Root Hints & DNSSEC Validation Matrix

Running Unbound as a recursive resolver on port 5335 eliminates upstream dependency on commercial DNS providers (Cloudflare 1.1.1.1 or Google 8.8.8.8). Instead of forwarding all household DNS queries to a single third party, Unbound walks the authoritative DNS hierarchy directly from the 13 root servers down to the TLD and authoritative nameservers, caching responses in local RAM with prefetching enabled.

Configuration ParameterRecommended ValueLatency & Security Impact
prefetch: yesEnabled (TTL < 10%)Refreshes popular domains asynchronously before cache expiry, keeping median lookup latency at 0–1 ms.
qname-minimisation: yesRFC 9156 StrictSends only the minimal required domain label to each upstream root/TLD nameserver to prevent metadata leakage.
serve-expired: yesTTL 86400sContinues serving cached DNS records during transient ISP upstream outages while refreshing in background.
so-rcvbuf / so-sndbuf4m / 4mPrevents UDP socket buffer drops during high-concurrency container or smart-home DNS bursts.

Verifying DNSSEC & Zero-Leak Resolution

After starting both containers, run dig sigfail.verteiltesysteme.net @127.0.0.1 -p 5335 on your Docker hostβ€”Unbound should return SERVFAIL, proving cryptographic DNSSEC validation is active. Next, query dig +short txt qnamemintest.internet.nl @127.0.0.1 -p 5335 to confirm RFC 9156 QNAME minimization returns HOORAY - QNAME minimisation is enabled. For a side-by-side comparison of network-wide blockers, read our NextDNS vs Pi-hole v6 vs AdGuard Home benchmark.