On this page
- Why must a hosted AdGuard Home stay private?
- What do you need first?
- How do you install AdGuard Home?
- How do you run the setup wizard safely?
- How do you enable DNS-over-HTTPS and DNS-over-TLS?
- How do ClientIDs keep the resolver private?
- How do you test that filtering works and strangers are refused?
- How do you tune blocklists and maintain the server?
- Questions
Why must a hosted AdGuard Home stay private?
A DNS server that answers anyone is an open resolver, and attackers use open resolvers to amplify floods against third parties. Your server would send large answers to spoofed addresses, burn your monthly transfer and draw abuse reports. The plan in this guide avoids that by design: plain DNS on port 53 is never opened publicly, encrypted DNS answers only the ClientIDs you create, and the admin page sits behind HTTPS with a password. Used this way, AdGuard Home becomes a personal filter that follows your devices on any network, and it pairs well with a WireGuard tunnel whose clients use it as their resolver.
What do you need first?
Use Ubuntu 24.04, Ubuntu 22.04, Debian 12 or Debian 13 with a sudo user, and create A and AAAA records for dns.example.net pointing at 198.51.100.24 and 2001:db8:4f2a::24 (the DNS records tutorial shows how). If Android phones will use the Private DNS setting, also create a wildcard record *.dns.example.net to the same addresses; the reason is explained in the ClientID section. Install the tools used for testing:
sudo apt update
sudo apt install -y curl dnsutils knot-dnsutils certbotHow do you install AdGuard Home?
The project publishes an install script that downloads the current release into /opt/AdGuardHome and registers a systemd service:
curl -sSL https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
sudo systemctl status AdGuardHome --no-pager
/opt/AdGuardHome/AdGuardHome --versionOn Ubuntu, systemd-resolved already holds 127.0.0.53:53, which blocks AdGuard Home from binding port 53. Check with ss -lunp | grep ':53 ', and if resolved appears, switch its stub listener off:
sudo mkdir -p /etc/systemd/resolved.conf.d
printf '[Resolve]\nDNS=127.0.0.1\nDNSStubListener=no\n' | sudo tee /etc/systemd/resolved.conf.d/adguardhome.conf
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl restart systemd-resolvedDebian does not run resolved by default, so this step is usually unnecessary there.
How do you run the setup wizard safely?
The wizard listens on port 3000, and the safest way to reach it is an SSH tunnel so the port never opens in the firewall. From your own computer:
ssh -L 3000:127.0.0.1:3000 deploy@198.51.100.24Open http://localhost:3000. Keep the admin interface on port 3000 and the DNS server on port 53 (all interfaces is fine, because the firewall decides who reaches them). Create an admin user with a long, unique password. Now set the firewall, which leaves 53 and 3000 closed to the world:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 853/tcp
sudo ufw allow 853/udp
sudo ufw enable
sudo ufw status verbosePort 80 is for certificate renewals, 443 carries DNS-over-HTTPS and the admin page, and 853 carries DNS-over-TLS and DNS-over-QUIC. The ufw guide explains each rule.
How do you enable DNS-over-HTTPS and DNS-over-TLS?
Get a certificate, then give its paths to AdGuard Home. For DoH only, a single-name certificate from standalone mode is enough:
sudo certbot certonly --standalone -d dns.example.net --deploy-hook "systemctl restart AdGuardHome"For DoT ClientIDs (needed by Android Private DNS), request a wildcard with a DNS challenge instead, ideally through the certbot plugin for your DNS host so renewals stay automatic: -d dns.example.net -d '*.dns.example.net' --preferred-challenges dns. In the admin page open Settings, Encryption settings, tick Enable encryption, enter dns.example.net as the server name, keep HTTPS on 443 and DNS-over-TLS and DNS-over-QUIC on 853, and set the certificate and key paths:
/etc/letsencrypt/live/dns.example.net/fullchain.pem
/etc/letsencrypt/live/dns.example.net/privkey.pemSave, and from now on open the admin page at https://dns.example.net instead of the tunnel. The deploy hook restarts the service after each renewal so the fresh certificate is loaded.
How do ClientIDs keep the resolver private?
A ClientID is a name you choose per device, carried inside the encrypted request, and an allowlist of ClientIDs turns everything else away. Create clients under Settings, Client settings (for example laptop and phone), then open Settings, DNS settings, Access settings and put those IDs in Allowed clients. Once that list has entries, only matching requests get answers. Devices use these addresses:
- DoH (browsers, iOS, Windows, most apps):
https://dns.example.net/dns-query/laptop - DoT (Android Private DNS, Linux stubs):
phone.dns.example.net, which is why the wildcard certificate and DNS record are needed
If you also want plain DNS from your home router, add its fixed public address (for example 203.0.113.50) to Allowed clients and open port 53 only to it: sudo ufw allow from 203.0.113.50 to any port 53. Never add a general rule for port 53.
How do you test that filtering works and strangers are refused?
Query once with a ClientID and once without; the first should answer, the second should be refused. From any computer with dig 9.18 or newer and kdig:
dig +https=/dns-query/laptop @dns.example.net example.net A
dig +https @dns.example.net example.net A
kdig @dns.example.net +tls-ca +tls-sni=phone.dns.example.net example.net AAAA
dig @198.51.100.24 example.net +time=3 +tries=1The last command, plain DNS from an address that is not allowed, should time out. On the server, the query log in the admin page shows each request with its ClientID, and a blocked tracker domain appears marked as filtered. You can confirm the open-resolver rule from outside with the checks in the blocked ports guide.
How do you tune blocklists and maintain the server?
Add blocklists under Filters, DNS blocklists, write your own rules under Custom filtering rules (||ads.example.net^ blocks a domain and its subdomains, @@||cdn.example.net^ allows one back), and set upstream resolvers under DNS settings, preferably encrypted ones. Shorten the query log retention if you prefer to keep less history. Updates are a single command, or a button in the admin page when a new release appears:
sudo /opt/AdGuardHome/AdGuardHome --update
sudo systemctl status AdGuardHome --no-pagerYour settings live in /opt/AdGuardHome/AdGuardHome.yaml and the data folder beside it; copy both off the server now and then, or enable daily backups. If the service fails to start after a change, journalctl -u AdGuardHome -e names the bad setting, most often a port already in use.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about AdGuard Home DNS filter
Can I share my AdGuard Home server with the public?
Only through encrypted protocols with per-client access, and even then with care. Never expose plain port 53 to everyone; that makes an open resolver used in amplification attacks.
Why does Android Private DNS need a wildcard certificate?
Android sends the ClientID as the first label of the hostname, such as phone.dns.example.net, so the certificate must be valid for every name under dns.example.net.
Does AdGuard Home slow down browsing?
Usually not. It caches answers, so repeated lookups are answered straight from memory, and blocked trackers mean fewer requests for each page.
Can I use it together with my WireGuard VPN?
Yes. Set the WireGuard client DNS line to the server tunnel address, add that tunnel range to Allowed clients, open DNS on the tunnel interface with sudo ufw allow in on wg0 to any port 53, and every device on the VPN is filtered without extra settings.
Which plan fits AdGuard Home?
It is light: A1-1 runs it for a household. Large blocklists use more memory, so choose A1-2 if you load many lists.
Is Pi-hole an alternative?
Yes, Pi-hole does similar filtering; AdGuard Home includes DoH and DoT serving without extra software.
More in VPN and private DNS
- WireGuard VPN server (manual setup)
- wg-easy WireGuard web UI
- WGDashboard for WireGuard
- OpenVPN server with easy-rsa
- Pritunl VPN server
- OpenConnect VPN server (ocserv)
- Pi-hole DNS sinkhole
- Unbound validating resolver
- Technitium DNS Server
- IPsec VPN with strongSwan
- Squid forward proxy with authentication
- Shadowsocks proxy server
- Authoritative DNS with BIND 9