Skip to content

Instantly share code, notes, and snippets.

@AzimsTech
Last active September 26, 2020 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AzimsTech/c20512b2b15763bc2677a9426266e281 to your computer and use it in GitHub Desktop.
Save AzimsTech/c20512b2b15763bc2677a9426266e281 to your computer and use it in GitHub Desktop.
Set AdGuard DNS Server ipv4 (Android)
#!/system/bin/sh
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 94.140.14.14:53
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 94.140.15.15:53
iptables -t nat -I OUTPUT -p tcp --dport 53 -j DNAT --to-destination 94.140.14.14:53
iptables -t nat -I OUTPUT -p udp --dport 53 -j DNAT --to-destination 94.140.15.15:53
@ECHO OFF
@TITLE AdGuard DNS Setup
@COLOR 0E
@ECHO :: Setup AdGuard DNS iptables rules from adb.
@ECHO :: If you haven't already, please enable USB Debugging.
@ECHO.
@ECHO.
TIMEOUT 2 > NUL
@ECHO :: Pushing AdGuard-DNS-Server.sh to /sdcard
adb push %~dp0AdGuard-DNS-Server.sh /sdcard
TIMEOUT 3 > NUL
@ECHO.
@ECHO :: Moving the script to /data/adb/service.d and set its permission
adb shell "su -c 'mv /sdcard/AdGuard-DNS-Server.sh /data/adb/service.d & sleep 5 && chmod +x /data/adb/service.d/AdGuard-DNS-Server.sh'"
@ECHO.
@ECHO :: DONE. Reboot changes to take effect.
pause
adb kill-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment