gspannu
Senior Member
I have finally managed to install AdGuard Home on an Asus Router.... this is without using any special scripts.
There was a previous forum post (here) on the same, but that involved installing using a custom script (that asked for your ssh login credentials, installed its own version of Samba, etc... and a lot of people (here, here, here, here, here) including myself were very nervous to use it for the same reasons)
My tutorial below has none of the above.... you can install it yourself by following the instructions below. No 3rd party scripts, no login creds needed... it is almost like any other addon.
UPFRONT DECLARATION
My setup:
Asus RT-AX88U running 386.3.2
Attached USB drive
Pre-requisites
Asus Merlin firmware
USB attached
Entware installed on Asus Router
Some basic knowledge about ssh, scripts, editing files on the router
Some working knowledge of AdGuard Home (as a product)
TUTORIAL
1. Download AdGuard Home on your USB drive
ssh to your router
navigate to the root of your attached USB drive (in my case, it is cd /tmp/mnt/USB-ASUS
download a version of AdGuard from Github
You can use either a stable release version or the beta version
wget https://static.adguard.com/adguardhome/release/AdGuardHome_linux_arm64.tar.gz (for a stable release)
wget https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz (for a beta release)
Or get whatever you wish from the Github page
2. Extract AdGuard to your USB root folder
tar -xvzf AdGuardHome_linux_arm64.tar.gz
3. You should now have a folder called AdGuardHome in your attached USB root folder.
4. Create a AdGuard startup script
nano /opt/etc/init.d/S99adguardhome
Your script needs to look like below...
Change the PATH statement to reflect your USB drive path (where you installed AdGuard). This is important else your script won't work.
The above script will cause your AdGuard Home to auto startup on router reboot
5. Make sure your script is executable
chmod 755 /opt/etc/init.d/S99adguardhome
6. Now it is time to start AdGuard...
execute the following line
/opt/etc/init.d/S99adguardhome start
You can check if AdGuard Home is running or not..
/opt/etc/init.d/S99adguardhome check
{And if you need to stop AdGuard Home, execute /opt/etc/init.d/S99adguardhome stop]
7. Now it is time to Configure AdGuard Home
In your internet browser, navigate to your router address:3000
e.g. something like 192.168.1.1:3000 or 192.168.50.1:3000
8. This should open up a familiar AdGuard Home Setup Wizard page...
Choose a Web Interface address and a port number.
I choose the router IP address (in my case it is 192.168.1.1) and port number as 30000
The default is port 80, make sure you change it to some thing else that is unused, I chose 30000
9. Choose the DNS Listener address and port
I choose the router IP address (in my case it is 192.168.1.1) and port number as 53535
The default is port 53, make sure you change it to some thing else that is unused, I chose 53535
AdGuard shows an error on both steps 8 and 9, if not configured properly.
10. Setup your username/ password as convenient.
Log into the AdGuard Home, navigate to the Query Log page
At this stage, you will notice that there are no queries in the Query Log.
This is because our DNS server is set for port 53535 and default port on the router is 53
11. Test that AdGuard is resolving queries...
ssh into your router and keep your AdGuard Home Webpage on the Query Log page
execute the below command
nslookup google.com 192.168.1.1 (or whatever your router IP address)
Refresh your AdGuard Home portal - AdGuard Query Log, but you should not see any query
now execute the below command
nslookup google.com 192.168.1.1:53535 (or whatever IP address/ port you specified above in Step 9)
Refresh your AdGuard Home portal - AdGuard Query Log, but you should now see the query
If all this works as above, then we do have AdGuard working properly...
12. Now it is time to redirect your default queries from Port 53 to Port 53553
(or whatever port you choose in Step 9)
Create a firewall-start script to set some IPTables
nano /jffs/scripts/firewall-start
Change the port number 53535 to whatever you choose in Step 9
Save the file..
13. Check that the firewall-start script is executable
ls -l ls -l /jffs/scripts
if not executable.... execute chmod 755 /jffs/scripts/firewall-start
[OPTIONAL]
14. AdGuard Home can identify the connected clients and resolve their DHCP names
Configure the AdGuard.yaml file to ensure that all our connected clients are identified by their names rather than IP addresses.
First, stop AdGuard Home
/opt/etc/init.d/S99adguardhome stop
Now edit the AdGuard Home config file.
nano /tmp/mnt/USB-ASUS/AdGuardHome/AdGuardHome.yaml (or wherever you installed AdGuard in Step 3.
Look for the line
local_domain_name: lan
Change it whatever you have defined your domain name in your Router Settings (on the LAN -> LAN IP page, domain name)
My domain name is home so the line should look like
local_domain_name: home
Save the yaml file.
Restart AdGuard
/opt/etc/init.d/S99adguardhome start
The above has to be done by editing the yaml file as there is no GUI option in AdGuard Home portal to do this..
15. Configure some other parameters in AdGuard Home web portal
Navigate to AdGuard Home portal
http://192.168.1.1:30000 (or whatever you chose in Step 8)
Login using your defined username/ password (as in Step 10)
Goto Settings -> DNS Settings
Upstream servers:
Add the below 2 lines to your upstream servers section..
[/in-addr.arpa/]127.0.0.1
[/ip6.arpa/]127.0.0.1
As an example... mine looks like this
Private reverse DNS servers
Add the below line
127.0.0.1
Hit Test Upstreams and if all OK, hit Apply.
Enable both the checkboxes for
User Private Reverse DNS Servers
Enable Reverse Resolving of clients IP addresses
-------------------------------------------------------------------------------------------------------
15. Reboot Router
Navigate to AdGuard Home portal and check query page...
It should be showing your queries from the clients.
And if you followed step 14..
After a little while.... AdGuard should also be showing client names along with IP addresses.
Good luck... and thank you for reading.
And last but not the least, the above would not have been possible without the help of lbtboy (AdGuardHome@GitHub)
————————————————————————————————
2021-12-08 Update:
I highly recommend the slightly alternate method mentioned in Post 3 below by @SomeWhereOverTheRainBow
There was a previous forum post (here) on the same, but that involved installing using a custom script (that asked for your ssh login credentials, installed its own version of Samba, etc... and a lot of people (here, here, here, here, here) including myself were very nervous to use it for the same reasons)
My tutorial below has none of the above.... you can install it yourself by following the instructions below. No 3rd party scripts, no login creds needed... it is almost like any other addon.
UPFRONT DECLARATION
- Asus Routers run great with Diversion AdBlocker, it is one of the best add-ons for Asus Routers
- This article is not to undermine Diversion or contest the pros/ cons of Diversion or AdGuard Home.
- This article is not promoting AdGuard as a replacement to Diversion. It is NOT and I WILL NEVER even remotely suggest this. The contribution by lonelycoder is beyond comparison.
- This post is in in academic interest for anyone who wants to install AdGuard Home (on the router itself) and play with it.
My setup:
Asus RT-AX88U running 386.3.2
Attached USB drive
Pre-requisites
Asus Merlin firmware
USB attached
Entware installed on Asus Router
Some basic knowledge about ssh, scripts, editing files on the router
Some working knowledge of AdGuard Home (as a product)
TUTORIAL
1. Download AdGuard Home on your USB drive
ssh to your router
navigate to the root of your attached USB drive (in my case, it is cd /tmp/mnt/USB-ASUS
download a version of AdGuard from Github
You can use either a stable release version or the beta version
wget https://static.adguard.com/adguardhome/release/AdGuardHome_linux_arm64.tar.gz (for a stable release)
wget https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm64.tar.gz (for a beta release)
Or get whatever you wish from the Github page
2. Extract AdGuard to your USB root folder
tar -xvzf AdGuardHome_linux_arm64.tar.gz
3. You should now have a folder called AdGuardHome in your attached USB root folder.
4. Create a AdGuard startup script
nano /opt/etc/init.d/S99adguardhome
Your script needs to look like below...
Change the PATH statement to reflect your USB drive path (where you installed AdGuard). This is important else your script won't work.
Code:
#!/bin/sh
ENABLED=yes
PROCS=AdGuardHome
ARGS="$OPTIONS"
PREARGS=""
DESC=$PROCS
PATH=$PATH:/tmp/mnt/USB-ASUS/AdGuardHome
. /opt/etc/init.d/rc.func
5. Make sure your script is executable
chmod 755 /opt/etc/init.d/S99adguardhome
6. Now it is time to start AdGuard...
execute the following line
/opt/etc/init.d/S99adguardhome start
You can check if AdGuard Home is running or not..
/opt/etc/init.d/S99adguardhome check
asus@ASUS:/tmp/home/root# /opt/etc/init.d/S99adguardhome check
Checking AdGuardHome... alive.
or it may look like
Checking AdGuardHome... dead.
Checking AdGuardHome... alive.
or it may look like
Checking AdGuardHome... dead.
{And if you need to stop AdGuard Home, execute /opt/etc/init.d/S99adguardhome stop]
7. Now it is time to Configure AdGuard Home
In your internet browser, navigate to your router address:3000
e.g. something like 192.168.1.1:3000 or 192.168.50.1:3000
8. This should open up a familiar AdGuard Home Setup Wizard page...
Choose a Web Interface address and a port number.
I choose the router IP address (in my case it is 192.168.1.1) and port number as 30000
The default is port 80, make sure you change it to some thing else that is unused, I chose 30000
9. Choose the DNS Listener address and port
I choose the router IP address (in my case it is 192.168.1.1) and port number as 53535
The default is port 53, make sure you change it to some thing else that is unused, I chose 53535
AdGuard shows an error on both steps 8 and 9, if not configured properly.
10. Setup your username/ password as convenient.
Log into the AdGuard Home, navigate to the Query Log page
At this stage, you will notice that there are no queries in the Query Log.
This is because our DNS server is set for port 53535 and default port on the router is 53
11. Test that AdGuard is resolving queries...
ssh into your router and keep your AdGuard Home Webpage on the Query Log page
execute the below command
nslookup google.com 192.168.1.1 (or whatever your router IP address)
Refresh your AdGuard Home portal - AdGuard Query Log, but you should not see any query
now execute the below command
nslookup google.com 192.168.1.1:53535 (or whatever IP address/ port you specified above in Step 9)
Refresh your AdGuard Home portal - AdGuard Query Log, but you should now see the query
If all this works as above, then we do have AdGuard working properly...
12. Now it is time to redirect your default queries from Port 53 to Port 53553
(or whatever port you choose in Step 9)
Create a firewall-start script to set some IPTables
nano /jffs/scripts/firewall-start
Code:
iptables -t nat -I PREROUTING -i br0 -p udp -m udp --dport 53 -j REDIRECT --to-port 53535
iptables -t nat -I PREROUTING -i br0 -p tcp -m tcp --dport 53 -j REDIRECT --to-port 53535
Save the file..
13. Check that the firewall-start script is executable
ls -l ls -l /jffs/scripts
if not executable.... execute chmod 755 /jffs/scripts/firewall-start
[OPTIONAL]
14. AdGuard Home can identify the connected clients and resolve their DHCP names
Configure the AdGuard.yaml file to ensure that all our connected clients are identified by their names rather than IP addresses.
First, stop AdGuard Home
/opt/etc/init.d/S99adguardhome stop
Now edit the AdGuard Home config file.
nano /tmp/mnt/USB-ASUS/AdGuardHome/AdGuardHome.yaml (or wherever you installed AdGuard in Step 3.
Look for the line
local_domain_name: lan
Change it whatever you have defined your domain name in your Router Settings (on the LAN -> LAN IP page, domain name)
My domain name is home so the line should look like
local_domain_name: home
Save the yaml file.
Restart AdGuard
/opt/etc/init.d/S99adguardhome start
The above has to be done by editing the yaml file as there is no GUI option in AdGuard Home portal to do this..
15. Configure some other parameters in AdGuard Home web portal
Navigate to AdGuard Home portal
http://192.168.1.1:30000 (or whatever you chose in Step 8)
Login using your defined username/ password (as in Step 10)
Goto Settings -> DNS Settings
Upstream servers:
Add the below 2 lines to your upstream servers section..
[/in-addr.arpa/]127.0.0.1
[/ip6.arpa/]127.0.0.1
As an example... mine looks like this
1.1.1.1
8.8.8.8
[/in-addr.arpa/]127.0.0.1
[/ip6.arpa/]127.0.0.1
8.8.8.8
[/in-addr.arpa/]127.0.0.1
[/ip6.arpa/]127.0.0.1
Private reverse DNS servers
Add the below line
127.0.0.1
Hit Test Upstreams and if all OK, hit Apply.
Enable both the checkboxes for
User Private Reverse DNS Servers
Enable Reverse Resolving of clients IP addresses
-------------------------------------------------------------------------------------------------------
15. Reboot Router
Navigate to AdGuard Home portal and check query page...
It should be showing your queries from the clients.
And if you followed step 14..
After a little while.... AdGuard should also be showing client names along with IP addresses.
Good luck... and thank you for reading.
And last but not the least, the above would not have been possible without the help of lbtboy (AdGuardHome@GitHub)
————————————————————————————————
2021-12-08 Update:
I highly recommend the slightly alternate method mentioned in Post 3 below by @SomeWhereOverTheRainBow
Last edited: