Not to be confused with the "Fully Automated" script post, this is my go that I started working on last night before I found that posting.
I'm doing this on an ARM-based Zenwifi 6600 / XT8, which I guess isn't supported by Merlin firmware yet... If you're on a MIPS-based machine you'll need the appropriate AdGuardHome build for that.
1. You'll need SSH enabled on your router
2. Login over SSH
3. Execute the following commands:
# Add to Env
export ADGH_HOME=/jffs/AdGuardHome
# Download and extract AdGuard Home
cd ${ADGH_HOME}/..
curl -O https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm.tar.gz
tar -zxf AdGuardHome_linux_arm.tar.gz
rm AdGuardHome_linux_arm.tar.gz
chown -R ${USER}:root ${ADGH_HOME}
cd ${ADGH_HOME}
# Setup ADGH data dir on tmpfs to prevent filling /jffs and reduce flash writes
mkdir -p ${ADGH_HOME}/data
mount -t tmpfs -o size=64m tmpfs ${ADGH_HOME}/data
# Get the router's LAN side address and start AdGuard
./AdGuardHome -h $(nvram get lan_ipaddr) -p 8053
4. At this point, you can connect to your router over http on port 8053, something like http://router.asus.com:8053/
5. Go through the configuration wizard
6. Go back to your SSH terminal
killall AdGuardHome
sed -i "s/bind_host: .*/bind_host: $(nvram get lan_ipaddr)/" AdGuardHome.yaml
7. Setup auto-restart script:
STARTUP_SCRIPT=/jffs/start-adguard.sh
cat << EOF > ${STARTUP_SCRIPT}
#!/bin/bash
export ADGH_HOME=/jffs/AdGuardHome
mount | grep -q \${ADGH_HOME}/data || mount -t tmpfs -o size=64m tmpfs \${ADGH_HOME}/data
killall AdGuardHome dnsmasq; (cd \${ADGH_HOME} && nohup ./AdGuardHome &> \${ADGH_HOME}/data/nohup.out) &
ps | grep AdGuardHome > /tmp/adguard-started
EOF
chmod +x ${STARTUP_SCRIPT}
nvram set script_usbmount="${STARTUP_SCRIPT}"
nvram commit
8. You must plug-in a USB drive and have it mounted through the admin UI.
mount | grep -q /dev/sd && echo USB mount detected - good || echo no USB detected
9. Reboot the router
reboot
10. Reconnect to your Wifi and login to http://router.asus.com:8053/ -- this may not work until the router as fully booted (i.e. SSH doesn't complain about mismatched ECDSA keys)
Done!
I'm doing this on an ARM-based Zenwifi 6600 / XT8, which I guess isn't supported by Merlin firmware yet... If you're on a MIPS-based machine you'll need the appropriate AdGuardHome build for that.
1. You'll need SSH enabled on your router
2. Login over SSH
3. Execute the following commands:
# Add to Env
export ADGH_HOME=/jffs/AdGuardHome
# Download and extract AdGuard Home
cd ${ADGH_HOME}/..
curl -O https://static.adguard.com/adguardhome/beta/AdGuardHome_linux_arm.tar.gz
tar -zxf AdGuardHome_linux_arm.tar.gz
rm AdGuardHome_linux_arm.tar.gz
chown -R ${USER}:root ${ADGH_HOME}
cd ${ADGH_HOME}
# Setup ADGH data dir on tmpfs to prevent filling /jffs and reduce flash writes
mkdir -p ${ADGH_HOME}/data
mount -t tmpfs -o size=64m tmpfs ${ADGH_HOME}/data
# Get the router's LAN side address and start AdGuard
./AdGuardHome -h $(nvram get lan_ipaddr) -p 8053
4. At this point, you can connect to your router over http on port 8053, something like http://router.asus.com:8053/
5. Go through the configuration wizard
- Change Admin Web Interface to from All to br0 on port 8053
- Change DNS server from All to eth0 on port 53 (this is putting DNS on the internet, we'll fix it in step 6)
- Next screen
- Set your Username and Password
- Next screen
6. Go back to your SSH terminal
killall AdGuardHome
sed -i "s/bind_host: .*/bind_host: $(nvram get lan_ipaddr)/" AdGuardHome.yaml
7. Setup auto-restart script:
STARTUP_SCRIPT=/jffs/start-adguard.sh
cat << EOF > ${STARTUP_SCRIPT}
#!/bin/bash
export ADGH_HOME=/jffs/AdGuardHome
mount | grep -q \${ADGH_HOME}/data || mount -t tmpfs -o size=64m tmpfs \${ADGH_HOME}/data
killall AdGuardHome dnsmasq; (cd \${ADGH_HOME} && nohup ./AdGuardHome &> \${ADGH_HOME}/data/nohup.out) &
ps | grep AdGuardHome > /tmp/adguard-started
EOF
chmod +x ${STARTUP_SCRIPT}
nvram set script_usbmount="${STARTUP_SCRIPT}"
nvram commit
8. You must plug-in a USB drive and have it mounted through the admin UI.
mount | grep -q /dev/sd && echo USB mount detected - good || echo no USB detected
9. Reboot the router
reboot
10. Reconnect to your Wifi and login to http://router.asus.com:8053/ -- this may not work until the router as fully booted (i.e. SSH doesn't complain about mismatched ECDSA keys)
Done!
Last edited: