OpenWrt AdGuard Home 101 ( DNSMASQ )

Nice summary of the [HowTo] Running Adguard Home on OpenWrt thread.

Couple of things.

  1. You don't actually need unbound. You can do DOH https://en.wikipedia.org/wiki/DNS_over_HTTPS directly from within AGH. Full set of encryption protocols they use is here https://github.com/AdguardTeam/AdGuardHome/wiki/Encryption

  2. Using AGH install script is easier and simpler for most users. Just use their Edge builds as they are most up to date. It will also warn if there is missing dependancies.

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -c edge
  1. You included the routers own DNSMasq in your upstream list. While this is ok, there is no real reason to add another hop in your DNS list. Just go direct to your upstreams and AGH becomes your primary DNS cache instead of being a secondary (and repeated cache) on the router. This is much better as you are not doubling up memory usage. Especially as you have moved DNSMasq to port 5353 and thus only the router will use it. Your clients will use AGH as it is the DHCP servers DNS.

  2. While the filter list is a good selection, users should be aware that on limited memory routers you should only have a few filter sets as you will quickly run out of memory. That filter set provided is roughtly 140k entries in total and was optimised for a router with 128mb of ram.

  3. the crash around statistics database reloading has been fixed with AGH. However, currently AGH uses 35mb of space for its binary. It then will use space for its query logs and database. Query logging is currently using 45mb of space on my router. Current log rotation setup means you will need double that space so 35mb x 2 (for AGH binary and its backup when it upgrades) and log space x2.
    AGH also will crash with error messages once it it out of diskspace. Keeping an eye on your free diskspace is crucial. Once you have AGH up and running after an upgrade you can delete the /opt/AdGuardHome/agh-backup folder contents.

If you run out of space entirely?
The /opt/AdGuardHome/data folder contains the following.

root@OpenWrt:/opt/AdGuardHome/data# ll -h
drwxr-xr-x    3 root     root         512 Oct 29 09:42 ./
drwxrwxrwx    4 root     root         736 Oct 30 09:06 ../
drwxr-xr-x    2 root     root         800 Nov  2 09:52 filters/
-rw-r--r--    1 root     root       45.4M Nov  2 20:42 querylog.json
-rw-r--r--    1 root     root        8.9M Oct 29 09:00 querylog.json.1
-rw-r--r--    1 root     root       32.0K Oct 30 05:28 sessions.db
-rw-r--r--    1 root     root        4.0M Nov  2 21:00 stats.db

Delete the querylog files. These are your DNS queries.
sessions.db are connections to AGH currently. This can be deleted as well
stats.db you can purge but you will lose your statistics data.

filters folder contains all your filter downloads. Purge if it is full but it will re-download your filters. If your filters are too large for your diskspace you will have to disable large filters and restrict their usage.

Another option would be to use usb storage and remount that as the /opt/AdGuardHome folder and thus avoid space issues. (Not all routers can do this)

I had been meaning to summerize the rather long thread that is the AGH one but it seems i was beaten to it :slight_smile:

(edit)
Also you should warn users that your changes will make AGH the primary webserver on their router and move luci's interface to port 8080 (and also its https interface if you use AGH secure interface)

2 Likes