[HowTo] Running Adguard Home on OpenWrt

I have my blocklist disabled cos I'm using NextDNS Premium as my upstream servers. My AGH still consumed all available memory and had to be restarted after 4 days.

Right now, I just set a cron job to auto restart AdGuardHome every 4am.

Current Edge build Version: v0.107.0-a.218+90e65b66

That's curious. Wonder what's causing that. May be worth some investigation and file an issue?

(edit - Seems you arent the only one. https://github.com/AdguardTeam/AdGuardHome/issues/3913)

You disabled logging? You can disable stats and logging via the settings page but there are these settings.

These are in the yaml file.

Log settings

log_file — Path to the log file. If empty, writes to stdout, if syslog -- system log (or eventlog on Windows).
log_compress — Compress determines if the rotated log files should be compressed using gzip (default: false)
log_localtime — If the time used for formatting the timestamps in is the computer's local time (default: false [UTC])
log_max_backups — Maximum number of old log files to retain (MaxAge may still cause them to get deleted) (default: 0, which retains all old log files)
log_max_size — Maximum size in megabytes of the log file before it gets rotated (default: 100 MB)
log_max_age — MaxAge is the maximum number of days to retain old log files (default: 3)
verbose — Enable our disables debug verbose output (default: false)

How can you get to run AGH + Nextdns together without interfering with Internet connection? I can run only one at a time

Said it uses NextDNS as upstream servers.

He uses AGH as a "client" which then uses AGH as upstream due to NextDNS not having a proper client.

Ok, I have finally sat down and reinstalled AGH on a backup router from scratch and re-written a fair chunk of posts from here into a new updated guide.

Might be time to let this thread archive out naturally now as it is 2yrs old and while some of the thread is still relevant, certainly earlier posts are no longer needed.


So after writing up my new install post earlier today I ran across this.

I am unsure if this will be their new AGH update or maybe a different client. Certainly is going to be worth keeping an eye on. Much better interface and statistics by the look of things.

1 Like

Disable Adguard filtering. Basically you route all traffic to NextDNS with the exception that u use optimistic caching on adguard

1 Like

I keep seeing this confusion in various posts on the forum so I'm adding this to the thread.

You do not need to use any other programs like Unbound, Stubby or DNS-Over-Https. Those were the old way of manually adding encrypted DNS to OpenWrt and extending DNSMasqs so it could do encrypted lookups.

AGH does it all internally and will do any variant of encrypted dns. DoH, DoT, DoQ. All you have to do is pick the provider you wish to use.


There's a list of all the providers for ease of use. Just use AGH's setup and pick your provider and which protocol you want.

https://github.com/AdguardTeam/AdGuardHome/wiki/Configuration#upstreams - Configuring Upstreams

There is a problem that still bothers me. Whenever my R2S restarts, AGH will always be unable to block it. To save space, I have disabled saving QueryLog.

Regarding this problem, how should I solve it?

Your r2s is your primary router yes?

When it boots up, it will use dnsmasqs DNS to do NTP and updates. Then AGH will load and provide DNS to the rest of your network. That's the way it has to load.

I found that I made a mistake. It should be said that when I restart R2S, the blocking function of AGH will always be invalid

is AGH started as a service? If you do not have sudo installed then AGH will fail to install as a service and thus not restart when the router reboots.

Install sudo and reinstall AGH using the script. This will properly setup AGH as a service and thus auto start when you reboot.

Is "Sudo" the picture package?

So should I use AGH's install.sh script to reinstall?

Yes that is the package. Yes. reinstall with the script and it will setup AGH as a service. It should leave your agh.yaml file alone so all your config should stay as it was. Back it up before hand in case however.

1 Like

OK, I see.
I will go through these steps, and then thank you

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v -u
The script also accepts some options:

-c <channel> to use specified channel.
-r to reinstall AdGuard Home;
-u to uninstall AdGuard Home;
-v for verbose output;
Note that options -r and -u are mutually exclusive.

Technically you should uninstall AGH and have your yaml file backed up first.

Then remove the /opt/AdGuardHome folder.

Then properly reinstall it. Just so you have a clean install.

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh | sh -s -- -v
1 Like

This method does not work for me. My restart task is executed in the early morning. My AGH is started normally, but it cannot be blocked.

So your R2S reboots and AGH doesn't start?

or it doesn't do blocking after the restart?

No Block after restart.