The first time I put AdGuard Home on a router, it was my old Belkin RT3200, and I did it the way the guides did then. I downloaded a tarball into /opt, wrote an init script for it, and told dnsmasq to forward every query to port 5353. It blocked ads, but dnsmasq was AdGuard Home's only client, so every lookup in the query log was credited to 127.0.0.1 and the dashboard couldn't tell the TV from the laptop.
The router today is a GL.iNet GL-MT6000 on a recent OpenWrt snapshot, and there's no tarball, no init script of mine and no forwarding line in dnsmasq any more. AdGuard Home is a package now: the router's package manager installs and upgrades it, and it runs as an unprivileged user. dnsmasq still answers on port 53, the firewall hands client queries to AdGuard Home on port 54, and DHCP doesn't change at all.
Right now the router runs AdGuard Home 0.107.79. The package takes about 32 MiB of flash and the process holds about 95 MiB of RAM. Its working directory, with a day of query data and the downloaded blocklist, takes about 20 MiB more, also in RAM, because it sits on tmpfs. That's nothing on the MT6000's 1 GiB, but on a 128 MiB router it's most of the free memory, so run free -m and df -h /overlay first.
Where each query goes
Clients get the router as their DNS server from DHCP, exactly as they would without AdGuard Home. When a query arrives on port 53, a firewall redirect rewrites its destination to port 54, where AdGuard Home is listening. The TV is the one to watch: it ignores the resolver DHCP gives it.
- Phone192.168.1.142To the router
- FirewallForce-DNS-lan
- AdGuard HomePort 54
- UpstreamsQuad9, Cloudflare
The phone asks 192.168.1.1 on port 53, the resolver DHCP handed it.
$ dig +noall +answer news.example.com
AdGuard Home sees the client's real address, because a redirect changes a packet's destination and leaves its source alone.
OpenWrt's own AdGuard Home guide takes the other route. It moves dnsmasq to port 54, gives AdGuard Home port 53, and rewrites DHCP option 6 so clients still find a resolver. That means undoing the DHCP change too if AdGuard Home ever breaks. I'd rather leave dnsmasq and DHCP as OpenWrt ships them and do the job with one firewall rule I can switch off.
The router's own lookups skip AdGuard Home. The router asks dnsmasq, and dnsmasq asks whatever resolvers the WAN handed it. I'm fine with that: those lookups are package updates and NTP, and it means the router can set its clock at boot. An encrypted upstream needs a correct clock to check its certificate, and the clock needs DNS to reach an NTP server, which is the race OpenWrt's guide warns about.
Install the package
OpenWrt has shipped an official AdGuard Home package since 21.02. On 25.12 and newer, the package manager is apk:
apk update
apk add adguardhomeOn 21.02 through 24.10 it's opkg:
opkg update
opkg install adguardhomeThen enable the service and start it:
service adguardhome enable
service adguardhome start
service adguardhome statusThe package's init script runs AdGuard Home as the adguardhome user inside a procd jail that sees little more than its config and working directories, /etc/hosts and the CA certificates, with just the capabilities it needs to bind port 54 and send raw packets. At boot the script doesn't start it at all. Instead it registers a trigger that restarts AdGuard Home five seconds after an interface comes up, and that keeps firing for every interface that comes up later, a workaround for AdGuard Home starting before the router had an IPv6 address. And it passes --no-check-update, so AdGuard Home never replaces its own binary behind the package manager's back.
The package's files:
| Purpose | Path |
|---|---|
| Binary | /usr/bin/AdGuardHome |
| AdGuard Home's configuration | /etc/adguardhome/adguardhome.yaml |
| The service's own settings (user, paths, jail) | /etc/config/adguardhome |
| Working directory: query log, statistics, downloaded blocklists, login sessions | /var/lib/adguardhome |
| Service | /etc/init.d/adguardhome |
Run the first-run wizard
Open http://<router-ip>:3000 from the LAN. AdGuard Home's setup wizard asks where its web interface and its DNS server should listen. For this layout:
- Web interface: all interfaces, port
3000 - DNS server: all interfaces, port
54 - Admin account: a username of your own and a strong password
Port 54 is there because dnsmasq already owns 53, and the web interface stays on 3000 because LuCI has 80. "All interfaces" includes the WAN, so keep both ports closed there. My router has no WAN rule for either and its WAN input policy is REJECT, so the dashboard is reachable from trusted networks only. AdGuard's guide to running it securely covers tighter bind addresses and access rules if yours could ever face the internet.
Once the wizard is done, check that both ports are listening:
service adguardhome status
netstat -lntup | grep -E ':(54|3000) 'Send every client's DNS to port 54
This rule sends TCP and UDP port 53 from a firewall zone to the router's port 54. Run it once for each zone that has clients, starting with lan:
zone="lan"
rule="force_dns_${zone}"
uci -q delete "firewall.${rule}"
uci set "firewall.${rule}=redirect"
uci set "firewall.${rule}.name=Force-DNS-${zone}"
uci set "firewall.${rule}.src=${zone}"
uci set "firewall.${rule}.src_dport=53"
uci set "firewall.${rule}.dest_port=54"
uci set "firewall.${rule}.proto=tcp udp"
uci set "firewall.${rule}.target=DNAT"
uci set "firewall.${rule}.family=any"
uci set "firewall.${rule}.enabled=1"
uci commit firewall
service firewall restartThe rule has no destination address, so it matches port 53 traffic to anywhere. A TV that ignores DHCP and asks 8.8.8.8 directly gets redirected like everyone else. family=any puts the same rule on IPv6 too, which covers clients that learned the router's IPv6 address from its router advertisements, and a TV that tries 2001:4860:4860::8888. AdGuard Home listening on all interfaces means it's there on IPv6 to receive them.
My router has a separate iot zone, so I ran the same block again with zone="iot". That zone rejects input to the router, and I'd also given it an explicit Allow-DNS-IoT rule for port 53. The redirect doesn't need it: firewall4 accepts redirected traffic itself, with a ct status dnat accept line in the input chain of any zone that has a redirect (its ruleset template), so Allow-DNS-IoT is redundant and can go.
Don't add 127.0.0.1#54 as a forwarding server in dnsmasq. AdGuard Home sends .lan names to dnsmasq, so dnsmasq forwarding to AdGuard Home closes the loop.
Upstreams and local names
Under Settings, DNS settings, my upstream servers are one resolver over DNS over QUIC, one over DNS over TLS, and a line for local names:
quic://dns10.quad9.net
tls://one.one.one.one
[/lan/]127.0.0.1dns10.quad9.net is the Quad9 service without malware blocking; it still validates DNSSEC, and Quad9 added DNS over QUIC to all its services in March 2026. The last line uses AdGuard Home's per-domain upstream syntax to send every .lan name to dnsmasq on the loopback, where it answers from its DHCP leases. That query starts on the router itself, so the redirect, which only watches traffic arriving from a client zone, leaves it alone.
I also switch on Use private reverse DNS resolvers and set Private reverse DNS servers to 127.0.0.1. Left empty, that list falls back to the system's resolvers, and the jail doesn't mount /etc/resolv.conf, so naming dnsmasq is what makes it work. AdGuard Home then asks dnsmasq for the name behind each client address, and the query log shows living-room-tv.lan instead of a bare IP.
dnsmasq forwards what it can't answer, so every line comes from the router. It answers nas.lan from its leases, and the TV's query to 8.8.8.8 never touches it, so AdGuard Home sees neither.
- 21:04:12news.example.com A127.0.0.1Processed
- 21:04:12pixel.adtracker.example A127.0.0.1Blocked
- 21:03:51time.example.net AAAA127.0.0.1Processed
The rest of the DNS settings:
- Upstream mode: parallel requests, so the faster of the two answers
- DNSSEC: on, which only asks the upstreams for signed answers. AdGuard Home doesn't validate them itself; Quad9 and Cloudflare do
- Rate limit:
0, since every client is mine - Query log and statistics retention: one day
The blocklist
Under Filters, DNS blocklists, I run OISD Big and nothing else. One list means a false positive has one suspect. If an ad gets through, I check the query log to see why before adding a second list.
Check each step of the path
From a device on the LAN, ask the router the normal way:
dig @<router-ip> example.orgThe query should show up in AdGuard Home's query log under that device's address. Then ask AdGuard Home directly on its own port, which takes the firewall out of the picture:
dig @<router-ip> -p 54 example.orgAnd ask a public resolver, which should end up in the same query log if the redirect catches hard-coded DNS:
dig @8.8.8.8 example.orgIf dig @<router-ip> answers but the query never shows up in the log under the device's address, dnsmasq answered it and the redirect isn't matching. The same goes for an @8.8.8.8 query that answers but never appears: the device sits in a zone without the rule, or the rule has a destination address set. Check that the rule exists and reached the ruleset:
uci show firewall.force_dns_lan
nft list ruleset | grep -i force-dnsIf the query on port 54 fails too, look at the service:
service adguardhome status
logread -e AdGuardHome
netstat -lntup | grep -E ':(53|54|3000) 'Upgrade the package
Upgrade it through the package manager, by name:
apk update
apk upgrade adguardhomeOn older releases, that's opkg update && opkg upgrade adguardhome. New AdGuard Home releases reach the router when someone bumps the OpenWrt package, so it can run a version behind AdGuard's latest.
Don't run a blanket apk upgrade or opkg upgrade. OpenWrt recommends a firmware sysupgrade when the base system needs updating, because upgrading everything can leave packages out of step with the kernel and libraries they were built against.
A sysupgrade keeps /etc/adguardhome/adguardhome.yaml and /etc/config/adguardhome, because the package marks both as configuration files. It doesn't keep packages you installed yourself, so either reinstall AdGuard Home afterwards or build the image with it included, which is what Attended Sysupgrade does for you.
/var on OpenWrt is a link to /tmp, which lives in RAM, so everything under /var/lib/adguardhome is gone after every reboot, sysupgrade or not. That's the query log and statistics, but also the dashboard's login sessions and the downloaded blocklist, which AdGuard Home fetches again at boot once it can reach its upstreams. With one day of retention I don't miss the history.
If you want it to survive, point work_dir in /etc/config/adguardhome at a USB drive formatted ext4 and mounted at boot. It has to be ext4 or another Linux filesystem: the init script chowns the directory to the adguardhome user, and FAT and exFAT have no owners to record. The script mounts it into the jail read-write for you.



