Workload · Filtering DNS for your own devices

An AdGuard Home server your devices can use from anywhere, locked to you

An AdGuard Home server on a machine with a public address gives your phone and laptop ad and tracker filtering on any network, as long as they reach it over DNS-over-TLS or DNS-over-HTTPS and nobody else can use it. The setup is quick; the part that matters is keeping plain DNS on port 53 closed to the internet, so the box never becomes an open resolver for strangers.

The short version
  1. Filtering follows your devices onto mobile data and hotel Wi-Fi
  2. Encrypted DNS only: port 53 and the setup wizard stay behind the firewall
  3. ClientIDs on an allowlist, so only your devices get answers
  4. Small enough for a Cloud VPS; a whole server when it shares the box

What the job asks of a machine

AdGuard Home is a single program that answers DNS queries, blocks the ones on its filter lists, and forwards the rest to an upstream resolver you choose. The project's documentation publishes no minimum memory or processor figure, and it runs on Linux, Windows and macOS. What it needs from a remote server is a public IP address, a domain name you control, a certificate for that name, and a firewall you can trust.

The ports below are the ones the official Docker image lists. Only the encrypted ones should face the internet.

PortWhat it carriesOpen to the internet?
53 TCP/UDPPlain DNSNo: this is what makes an open resolver
3000 TCPFirst-run setup wizardNo: reach it through an SSH tunnel
80 TCPAdmin dashboard over plain HTTPNo
443 TCPDashboard over HTTPS, plus DNS-over-HTTPS at /dns-queryYes, if you use DoH
853 TCPDNS-over-TLSYes, for Android Private DNS and similar
853 UDPDNS-over-QUICOnly if a client of yours uses it
67-68 UDPDHCP serverNo: a remote server should not hand out addresses

The HTTPS port serves the admin dashboard and DoH together, so opening 443 puts your login page on the internet. Use a long, unique password, or offer DNS-over-TLS alone and leave 443 shut.

Why a server beats the box under the TV

A filter at home only filters at home. The moment a phone switches to mobile data, it stops asking your living-room resolver anything. Put AdGuard Home on a server with its own address and the same phone can point Android's Private DNS, or an iOS profile, at it and keep the filtering everywhere.

A Primcast Cloud VPS suits this well. It is a virtual machine in New York with root access, its own IPv4 address and an IPv6 /96, and a console in your browser for the day SSH won't answer. That console matters here: a firewall rule typed wrong is the most common way to lock yourself out, and the console gets you back in without writing to anyone.

Traffic is a non-issue for a handful of devices: only what the machine sends counts toward its monthly allowance, and what it receives is free.

The machine that fits

  • Just your own devices, or a small team: a Cloud VPS on Ubuntu or Debian. Start small; you can move up to a bigger size later and keep your files and IP addresses.
  • Users far from New York: the Cloud VPS runs in New York only. A whole machine from the dedicated server catalog can sit in Miami, San Francisco, Amsterdam or Bucharest, closer to the people asking.
  • DNS filtering beside other work: if the same box will also run a VPN, a mesh network like self-hosted NetBird or a set of containers, a whole server gives every core to you, on a port nobody meters.

Up and running in an evening

You need a domain name such as dns.example.com pointed at the server's address. The steps assume Ubuntu and the native install; the Docker image works too, but Docker's documentation warns that published container ports bypass ufw rules, which defeats step 2.

  1. Order the server with your SSH key and log in as root.
  2. Fence it before installing anything. SSH goes first, then the two encrypted DNS ports, then the firewall is switched on. ufw denies incoming traffic by default and covers IPv6 unless IPV6=no is set in /etc/default/ufw; check that line still reads yes.
  3. Run the official install script. It puts AdGuard Home in /opt/AdGuardHome and registers it as a service.
  4. Open the setup wizard through an SSH tunnel, not the open internet. Until the wizard is finished it has no login, so whoever reaches port 3000 first would create the admin account. From your own computer run ssh -L 3000:127.0.0.1:3000 root@your-server-ip and browse to http://127.0.0.1:3000.
  5. In the wizard, create the admin user with a strong password. If it reports port 53 already taken, that is systemd-resolved's stub listener: the wizard's Fix button handles it on a native install. When it finishes, the dashboard moves to the admin port you picked (80 by default). Reach it the same way, with ssh -L 8080:127.0.0.1:80 root@your-server-ip and http://127.0.0.1:8080, and never open port 80 in the firewall.
  6. Get a certificate. The documentation shows Certbot with a DNS challenge, sudo certbot certonly --manual --preferred-challenges=dns --preferred-chain="ISRG Root X1". When it asks for names, give both dns.example.com and *.dns.example.com: the wildcard is what lets each device carry its own ClientID.
  7. Under Settings, Encryption settings, enable encryption, enter dns.example.com as the server name, paste fullchain.pem and privkey.pem, keep the HTTPS port at 443 and DNS-over-TLS at 853, and save.
  8. Under Settings, Access settings, put one ClientID per device in Allowed clients, for example phone and laptop, and add 127.0.0.1 and ::1 so the server can still resolve names for itself. With entries there, AdGuard Home answers only those clients.
  9. Point the devices at it: on Android 9 or later, Private DNS with phone.dns.example.com; on iOS 14 or later, the profile from Setup Guide, DNS Privacy; in a browser, https://dns.example.com/dns-query/laptop.
sudo ufw allow 22/tcp && sudo ufw allow 853/tcp && sudo ufw allow 443/tcp && sudo ufw enable
curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v

Certbot's manual DNS challenge does not renew by itself. Note the expiry date it prints, repeat the same procedure before then, and put the new files into Encryption settings.

Never an open resolver

An open resolver is a DNS server that answers anyone on the internet. Strangers scan for them and use them to bounce floods of traffic at other people's networks, and the abuse reports land on your address. The IETF's best-practice document on recursive nameservers says plainly that they should answer only the clients they are meant to serve.

  • Keep port 53 out of the firewall rules. AdGuard's own security guide suggests disabling plain DNS or making it unreachable from outside when your clients all speak encrypted DNS.
  • Use the Allowed clients list with ClientIDs, which the same guide recommends for public instances whose clients are known.
  • Leave the rate limit on. Its default is 20 queries per second, and anything above it is silently dropped.
  • Set the server name. Without it, AdGuard Home cannot read ClientIDs from hostnames such as phone.dns.example.com, so DNS-over-TLS devices would fail the allowlist.

To check from outside, ask your server for any name over plain DNS from another network. No answer is the result you want.

Keeping it healthy

  • Updates: the dashboard's Update Now button, or ./AdGuardHome --update from /opt/AdGuardHome. The previous program and config are kept in the agh-backup directory inside /opt/AdGuardHome.
  • Backups: your setup lives in AdGuardHome.yaml in the install directory. Copy it off the server after every change you would hate to redo, and copy your certificate files with it.
  • Permissions: the security guide wants the install directory and program owned by root:root and writable only by root.
  • Logs and statistics: the query log and statistics keep whatever window you set, from one hour to a year. A shorter window keeps less of your browsing history on the server.
  • Lost password: generate a new bcrypt hash with htpasswd -B -C 10 -n admin, which asks for the password instead of taking it on the command line, paste the hash into the users section of AdGuardHome.yaml while the service is stopped, then start it again.

When this is the wrong setup

If every device you care about stays at home, a filter on the home network is simpler and needs no certificate. Smart TVs and game consoles that only speak plain DNS cannot use a remote encrypted resolver at all, unless your router forwards their queries over DoT for them.

Running a public filtering service for anyone who finds it is a different job, with abuse handling and capacity planning this page does not cover. And remember that your upstream resolver still sees every query that is not blocked, now coming from your server's address; pick an encrypted upstream under Settings, DNS settings.

Questions people ask

Is a small VPS enough for AdGuard Home?
For your own devices or a small team, usually yes. AdGuard Home publishes no minimum memory figure, and what grows with use is mostly the filter lists and the query log. Start on a small Cloud VPS and move up a size if the dashboard shows it straining; the machine keeps its files and IP addresses.
Should I open port 53 so older devices can use it?
Not on a server with a public address. Plain DNS on port 53 has no way to tell your devices from strangers' except by IP address, and phone addresses change all the time. Keep it closed and use DNS-over-TLS or DNS-over-HTTPS with ClientIDs instead.
Do I need a domain name?
Yes, in practice. Android's Private DNS setting asks for a hostname, and per-device ClientIDs need a name to hang subdomains on. Certificates for a bare IP address exist but are short-lived, so a domain is the practical route. A wildcard certificate for the name lets each device use its own ClientID as a subdomain.
Can I run it with Docker instead?
You can; the official image is on Docker Hub. Be aware that Docker publishes container ports around ufw, so a firewall rule you added will not stop traffic to a published port 53. If you use Docker, publish only the encrypted ports, or bind the rest to 127.0.0.1. The Docker Compose guide covers the basics of running one app this way.
What happens if I lock myself out with the firewall?
On a Cloud VPS, open the console from your dashboard: it shows the machine's screen without needing SSH, so you can log in and fix the rule. If that fails you can restart or reinstall from the same tab, and people are on chat and phone at any hour.

Take your DNS filter with you

Get a Cloud VPS with its own IPv4 and IPv6, root access and a browser console, and have AdGuard Home answering your devices tonight.

Get a server for your DNS filter

Read next