Hi, I just updated the AdGuardHome version in my Gli-Net M3000 router to version 0.1.07.24
I used the GitHub version AdGuardHome_linux_armv7.tar.gz.
It came to my attention that the AdGuardHome version from the router I flashed yesterday is much bigger than the version from GitHub. Do you know why?
AdGuardHome_bu is the version from the beta4 firmware.
I was using the 32bit version instead of 64bit. However, that doesn’t change the size of the file much.
Question here: Why is the original file on the router 12 MB bigger than the newer one in the GitHub repository?
I tried to install on Beryl MT-1300 running 4.3.1b1 and after installation, I don’t see adguard in the applications but going to 192.168.8.1:3000 to run the setup, I get a warning about DNS already in use. See attached photo:
So far htop is showing the router doing just fine with AGH. I finally got it installed and here are the steps I took:
Install an SD card in the SD card slot. I’m using SanDisk 64Gb extreme (~$10 on Amazon)
The card will auto mount. You should umount /dev/mmcblk0
Format the card mke2fs -t ext4 /dev/mmcblk0
In luci, system —> mount points, then add the new disk as an overlay then save and apply the updated config
Add swap through ssh:
a. dd if=/dev/zero of=/mnt/mmcblk0/myswap.swp bs=1k count=1048576 ## I set the swap file to 1G which is a bit more than recommended for this router. Normally we want it to be 2X ram. Good news is swappiness is set to 60 so no adjustments necessary there.
b. mkswap /mnt/mmcblk0/myswap.swp
c. swapon /mnt/mmcblk0/myswap.swp
Back in luci we need to enable swap to turn on during boot. Go to system —> startup —> local startup. Add this as the first line after the comments /usr/sbin/swapon /mnt/mmcblk0/myswap.swp
While we are in luci, let’s go ahead and force dhcp to send the router IP address as the DNS server. To do this, we can go to network —> interfaces —> lan —> edit —> dhcp server —> advanced and under dhcp options add 6,192.168.8.1. Save your settings
Either through ssh & opkg or from the admin webgui install adguard home package opkg list |grep -i adguard then okpg install the adguard package
Ssh —> /etc/init.d/dnsmasq stop (this will stop all dns and dhcp temporarily)
Adguardhome’s default working directory is /tmp/adguardhome. The advantage is that this is very quick memory. The disadvantages are that once your router reboots, you’ll lose all history. There is also a danger of running out of space and filling /tmp completely. Let’s change that so we don’t have to worry.
a. mkdir /mnt/mmcblk0/etc/adguardhome
b. chmod 755 /mnt/mmcblk0/etc/adguardhome
c. vi /etc/config/adguardhome or use your favorite editor
d. comment out the working directory line with a # in front
e. add the following new line option workdir /mnt/mmcblk0/etc/adguardhome
f. finally we can restart adguardhome with /mnt/mmcblk0/upper/etc/rc.d/K89adguardhome restart
http://192.168.8.1:3000. For me I changed the default admin port to 14711 which is the same used as part of asus-merlin, amtm, agh install
Set DNS to 53 and complete the install
At this point you should see adguard home running on port 53. You can check by running netstat -naulp | grep :53
Next we’ll move dnsmasq to 553 (easy to remember) by echo "port=553" >> /etc/dnsmasq.conf from ssh prompt
We can now restart dnsmasq with ssh —> /etc/init.d/dnsmasq restart
Check that dnsmasq is running on the right port with running netstat -naulp | grep :553
Flip over to the DNS Blocklists and set to adguard, adaway, and oisd basic
This will get you pretty good protection without overloading the router. You can test by going here. You should get in the high 90’s for blocking ads and trackers. To make sure everything is working, reboot your router, use free to check that swap is on, netstat -naulp | grep :53 to check AGH is working correctly, and htop (separate opkg package) to check performance. With AGH and the resolvers above, you should see good performance.
Also, don’t forget on ios devices to disable private wifi address so your clients show up in the query and dashboard logs
edit - I’ve updated the instructions to account for tmpfs limited space and changing the working directory from /tmp/adguardhome to /mnt/mmcblk0/etc/adguardhome
I wanted to add a follow-on post on how to update to the latest release of AGH, assuming you followed the steps above. For me, by default I had a 6+ month old version of Adguard in opkg and with opkg having update issues on the latest Beryl beta I decided to just update Adguard directly.
The first thing you will want to do is determine which version you need by ssh into your router. Download opkg install file then file /usr/bin/AdGuardHome
For Beryl I got an output like this:
/usr/bin/AdGuardHome: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), statically linked, Go BuildID=c0WtXHe74ItLRoOBOXFY/hmNPOIn3NRWjsIgoE2Ht/150uHHOGLVCtPkdknURS/eCewiXB9pIkOW5-aCcNy, stripped
Next head over to AGH github page for releases and identify your platform. Note that for Beryl, choose the 32-bit MIPS LE. Keep this page handy. We’ll come back to it in a minute
First we need to create a backup in case something goes haywire. Keep in mind that when you stop AGH, DNS resolution will also stop
a. cp /usr/bin/AdGuardHome /usr/bin/AdGuardHome.old
b. cp /etc/adguardhome.yaml /etc/adguardhome.yaml.backup
Next create some temp space to download the latest AGH mkdir /overlay/tmp
Now it’s time to go back and copy the download link into your clipboard/buffer for the version of AGH you want. Then paste it into your ssh terminal after wget This example is for Beryl beta version. Choose your own version appropriately:
a. cd /overlay/tmp
b. wget https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_mipsle_softfloat.tar.gz
Next we need to extract the new binary tar -xzvf ./AdGuardHome_linux_mipsle_softfloat.tar.gz
This will create a new directory cd AdGuardHome
Check that the file matches the same arch as your current binary file ./AdGuardHome
Now it’s time to do the switcharo. First thing is to shutdown AGH /mnt/mmcblk0/upper/etc/rc.d/K89adguardhome stop
cp ./AdGuardHome /usr/bin/
Last thing is to restart AGH /mnt/mmcblk0/upper/etc/rc.d/S21adguardhome start
ps | grep -i adguardhome — should show AGH running
Go to http://192.168.8.1:14711/ and enjoy the new release
*note: the above sometimes uses relative paths. Be sure you are in the expected directory before executing any commands with relative paths
Background - I’m not a programmer but I do have a background in systems so I can (sorta) hack together some scripts. I mostly use the beta version of AGH and it was getting annoying having to follow the process above every time a new release came out so I set out to create a script to automate some functions. Well, that automation grew significantly, to the point that I felt that I’d like to dump my script into github and share with this community, hoping for the best.
Script Features
Checks for dependencies:
a. Free disk space to upgrade
b. Properly installed and running version of AGH
c. Checks for the correct model and fails if you aren’t running the correct version (supports MT1300 only right now)
Downloads and parses the available beta and release versions of AGH comparing to your current version and presents an output of the same
Allows you to switch from beta to release and vice versa or just upgrade to the latest version of your chosen branch (if available)
Will fetch the correct go binary based on your model number
Extracts the tarball (with a check that it can find the new binary file)
Creates a backup of your existing binary and config files
Disables your AGH service (temporarily)
Copies new AGH binary into place
Reloads AGH service
Cleans up temp files created
Status along the way with error handling and graceful exiting if something fails (e.g. cleanup of temp files)
Asks
I’m looking for feedback on other models and their correct go binary. Specifically - cat /proc/gl-hw-info/model along with the associated url to your binary from here. You can check for the correct binary using the process outlined here.
As stated, I’m not a programmer and likely broke all sorts of best practices with my code (but it works for me!). If you are interested in helping clean up the code to be more efficient and align with best practices, let me know. I’m sure there are a zillion opportunities here.
It’s because dnsmasq is already using 53. You need to move it to another port or choose AdGuard to run on a different port which isn’t advisable. See my detailed instructions above. You also already have a web server running on 80, so you’ll need a different port for that as well.
got it. i stopped DNSMASQ
/etc/init.d/dnsmasq stop
only remain is how to change the port 80 for the web service. this is on a stock setting (after reset).
update: i just re-assigned the adguard web admin port to 3001