[How-To-Updated 2021] Installing AdGuardHome on OpenWrt [Manual and opkg method]

Still outstanding unfortunately.

Until they redo it I'm not testing anything. Some have told me that simple networks work ok but I personally haven't tested AGH replacing dnsmasq and DHCP.

thank for the quick reply...are the outstanding issues around ipv6, vlans, replacing openwrt dnsmasq/DHCP or are they more general, as far as you know. I only ask cause i don't use ipv6 at all.
On another note, perhaps you can help. Do you know of any way AGH can not log queries from certain clients ? The reason I ask is because my top clients are always my mesh nodes, which is understandably considering all 4 of them are very chatty with each other and the network in general; i.e. after all that is what a mesh network is supposed to do. The result however are lots of unnecessary queries being logged. Someway of 'masking' those would be great but i haven't found any way of doing it yet.
Similarly top blocked domains, like www.google-analytics.com. For this I have found a workaround by putting the domain into the DNS Settings---Disallowed domains, this way AGH simply drops these requests (they would be blocked anyway) and the the logs are saved these unnecessary entries.

my ISP still doesn't do IPv6 so can't help there. Regarding the DHCP I originally tried 106 which had some serious issues. Hence why I settled on letting OpenWrt do DHCP and have AGH do the dns. Since they haven't refactored their DHCP which is on their milestones yet I've had no reason to do any testing.

Regarding logging? best to see if others have requested things like that on the AGH issues/requests threads.

Personally I'd just let it log and then parse the results. Purely under the basis of if you have logs you can check. You can always filter unwanted but no logs will be an issue.

thanks again. I'm running the latest edge and updates come through great. I may fire up this setup on a raspberry, simply because it's easier to overcome problems than running on WRT32x where I always keeps one partition with the oem firmware, in case I brick.
My setup will use latest stable openwrt 64bit, ipv4 (don't use ipv6), vlans and I'll try replacing both DHCP and DNS with AGH. I will report back here if I find it steady enough for a daily driver. I'll try this over the weekend otherwise my family will shout 'Dad what's happened to the internet'.

EDIT: couldn't wait so i set this up in my testlab.Very soon into the configuration I noticed a 'feature' that renders AGH DHCP implementation not fit for my purpose. Apparently you can only select one DHCP interface so if, like me, you have multiple vlans each with their own IP range then AGH currently cannot do this. They list all available ones for selection but only one selection can be active.
I also tried manually editing the YAML file but that just resulted in unable to login showing a pop 'network error' when i tried to add more dhcp servers.
I searched on their github and saw others mentioning it, AGH response was basically 'we're trying to keep it simple' AdguardHome problem 3539. IMHO there's a big difference between simple and dumb.


sigh... that is a substantial gotcha. It seems their DHCP is more a baby barely crawling compared to OpenWrt's DHCP. That pretty much cements this guide as the only way forward at present. So much for simple eh?

Hi, I'm trying to install AdGuard Home on my Archer A7 running OpenWrt 22.03.2 r19803-9a599fee93, or rather on a USB drive plugged into the router, since it doesn't have sufficient storage capacities.

First, I followed the Automount tutorial from OpenWrt.

I saved the contents of routerDNS.sh and installAGH.sh into 2 new files and set a custom output directory (according to this answer on another thread):


# grab and install AGH and install it in a custom directory
curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh  | sh -s -- -c edge -o /mnt/sda1/adguard

Then, I ran both of the scripts; routerDNS.sh worked fine, but installAGH.sh spit out these errors:

starting AdGuard Home installation script
curl: (23) Failure writing output to destination
cannot download the package from https://static.adtidy.org/adguardhome/edge/AdGuardHome_linux_mips_softfloat.tar.gz into AdGuardHome_linux_mips_softfloat.tar.gz
Router IPv4 :
Router IPv6 : fd61:e899:7509::1
Adding fd61:e899:7509::1 to IPV6 DNS
uci: I/O error
udhcpc: started, v1.35.0
udhcpc: broadcasting discover
udhcpc: no lease, failing
Goto and configure AdGuardHome.

root@OpenWrt:~# ls

The error arises because curl doesn't download the AdGuard .tar.gz file onto the USB drive as intended but on the router's internal storage, which doesn't have sufficient capacity to actually store that file.

Though, it should actually be possible to write onto the USB drive using the path /mnt/sda1/:

root@OpenWrt:~# cd /mnt/sda1/
root@OpenWrt:/mnt/sda1# touch test.txt
root@OpenWrt:/mnt/sda1# echo "look, i can write a file onto the usb drive" >> test.txt
root@OpenWrt:/mnt/sda1# cd
root@OpenWrt:~# cat /mnt/sda1/test.txt
look, i can write a file onto the usb drive

Also, I made sure that the adguard directory on the USB drive actually exists:

root@OpenWrt:~# ls /mnt/sda1/
adguard     lost+found  test.txt

Also, Luci displays this:

So why can't curl write the AdGuard archive onto the USB drive? What am I doing wrong?

Simplest way? mount your usb drive as /opt and rerun the script. AGH expects to install to that folder.

Change the auto mount from /mnt/sda1 to /opt.

Unfortunately, that didn't solve the issue. Though, I think the USB drive should be mounted correctly:

root@OpenWrt:~# mount | grep sda1
/dev/sda1 on /opt type ext4 (rw,relatime)

root@OpenWrt:~# cat /opt/test.txt
look, i can write a file onto the usb drive

And here's the updated line of the script:

curl -s -S -L https://raw.githubusercontent.com/AdguardTeam/AdGuardHome/master/scripts/install.sh  | sh -s -- -c edge -o /opt

However, the exact same error (with the exact same output) happens again.

you don't have to edit the script. just make sure your usb drive is mounted as /opt and follow my instructions.

AGH's install script expects to be installed to /opt and allows for this. it is ONLY if you have a different install folder you wish to use that u need to edit the script and you are on your own if you do that.

My scripts are just for aiding installation of AGH into its default folder for OpenWrt installations.

:edit: make sure you run the script from the /opt folder. Also if you do not have enough space to download the archive you may have to redirect your /tmp folder to the USB key as well. check your available disk space with df -h

I'd reset your router to defaults and start completely from scratch as you will have a broken setup due to the failed installs.

1 Like

Thank you very much, this in fact solved the issue! :+1:

1 Like

Another option is to define the following link:

ln -s /mnt/sda1 /opt

It worked for me.

1 Like

How to do that?

You can check what disk space you have available using the df -h command. But as you said you have it working now you don't need to setup a /tmp folder on your usb stick.

root@OpenWrt:/opt/AdGuardHome# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.0M      4.0M         0 100% /rom
tmpfs                    59.7M      1.1M     58.6M   2% /tmp
/dev/mtdblock5            8.7M      6.5M      2.2M  75% /overlay
overlayfs:/overlay        8.7M      6.5M      2.2M  75% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                 7.2G     49.5M      6.7G   1% /opt

Well, first it ran fine, but after I selected some filter lists, neither the AGH dashboard nor Luci are reachable, and even the SSH connection is quite slow. :face_with_monocle:

you did reset completely so u have a clean setup?

once its properly installed you should have a setup page on

Luci should still be available on https:/

You do need to tell AGH to install its dashboard on a port other than port 80 as luci lives there. I use port 8080

Yes, I did so, and I also made AGH use port 8080. It's just that after enabling those filter lists, the router doesn't respond at all anymore. Trying to open or results in time-outs, and typing in the SSH terminal isn't possible at all anymore.

That should not happen. Where did you get to on the setup and what options did you choose?

Here's what I did:

  1. Reset OpenWrt via Luci.
  2. Set WiFi SSID and password.
  3. Configure automount for the USB drive.
  4. Install all the necessary packages you listed in the instructions.
  5. Run routerDNS.sh.
  6. Run installAGH.sh.
  7. Open and set 8080 as the AGH port.
  8. Set a bunch of upstream and bootstrap DNS servers, made sure they work.
  9. Set a few custom filter rules to block “suspicious” TLDs like .ru or .cn.
  10. Try opening regular websites, works fine on different devices.
  11. Try opening .ru websites, doesn't work (as expected), and AGH says the DNS requests were blocked, just as intended.
  12. Enable five filter lists in total with approximately 190,000 domains.
  13. Reload AGH page, doesn't load.
  14. Open, doesn't load either.
  15. Opening any website fails with ERR_NAME_NOT_RESOLVED.
  16. Can't even type into SSH console anymore, also won't re-connect.

you are using the edge build not the opkg install yes?

I'm guessing you have run out of space somewhere along the line and your router crashed.

Redo your steps until you get to the filters. Enable only one set and check your disk space again.

make sure it is saving the filters to your /opt folder and you still have space space.

Yes, I used the edge build. I think the problem is the filter lists being downloaded onto unsufficient storoage. I calculated that 200,000 domains à ~20 characters and 4 Byte per character could be about 200,000 × 20 × 4 Byte = 16,000,000 Byte = 16 MB in size, which is most likely simply too much for the Archer A7.

Thus, I've decided not to run the adblocker on the OpenWrt router at all but on a Raspberry Pi instead. I don't want to use only one or two filter lists just to prevent AdGuard Home from constantly crashing.

Thank you very much for all your advice, it's highly appreciated! :heart:

1 Like