Skip to content

Collection of scripts that can run on stock Asus routers (also on Merlin's firmware and forks)

License

Notifications You must be signed in to change notification settings

scjtqs2/asuswrt-scripts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom scripts for AsusWRT

This uses known script_usbmount NVRAM variable to run "startup" script on USB mount event that starts things out.

Obviously this requires some kind of USB storage plugged into the router for this to work, you don't need it on Asuswrt-Merlin though - just start the scripts from services-start script.

Everything here was tested on RT-AX58U v2 on official 388.2 firmware (3.0.0.4.388.22525 to be precise), there is no gurantee that everything will work on non-AX routers and on lower firmware versions.

Some routers are no longer executing commands from script_usbmount NVRAM variable on USB mount - in that case look here for a workaround.

Installation

Install startup script:

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/startup.sh" -o /jffs/startup.sh
/bin/sh /jffs/startup.sh install

If you would like for it to be called differently you can rename it before running it.

Install scripts you want to use from section below.

Available scripts

You can override config variables for scripts by creating .conf with the same base name as the script.

If there is another file with the same base name as the script then it is required for that script to work.

Remember to mark the scripts as executable after installing, you can do it in one command like this:

chmod +x /jffs/scripts/*.sh

This script will reboot your router at specified time if it's been running for fixed amount of time.

By default, reboot happens at 5AM when uptime exceeds 7 days.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/conditional-reboot.sh" -o /jffs/scripts/conditional-reboot.sh

This script does exactly what you would expect - makes sure WPS stays disabled.

By default, runs check at boot and at 00:00.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/disable-wps.sh" -o /jffs/scripts/disable-wps.sh

This script implements custom DDNS feature from Merlin firmware that allows you to use custom Inadyn config file.

Checks every minute for new IP in NVRAM variable wan0_ipaddr. You can alternatively configure it to use website API like "ipecho.net/plain".

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/dynamic-dns.sh" -o /jffs/scripts/dynamic-dns.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

This script will force specified DNS server to be used by LAN and Guest WiFi, can also prevent clients from querying the router's DNS server.

This script can be very useful when running Pi-hole in your LAN, especially paired with Raspberry Pi Zero connected through USB port.

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/force-dns.sh" -o /jffs/scripts/force-dns.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

This script rotates Guest WiFi passwords for specified guest networks and/or generates HTML pages with QR code to let your guests connect easily. (HTML page screenshot)

HTML pages will be accessible under these URLS:

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/guest-password.sh" -o /jffs/scripts/guest-password.sh
curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/guest-password.html" -o /jffs/scripts/guest-password.html

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

Warning: this script is not complete and will probably not work on stock firmware (should work on Merlin), see note in the script.

This script implements scheduled LED control.

By default, LEDs shutdown at 00:00 and turn on at 06:00.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/led-control.sh" -o /jffs/scripts/led-control.sh

This script can kill processes by their names, unfortunately on stock most of them will restart, there is an attempt to prevent that in that script but it is not guaranteed to work.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/process-killer.sh" -o /jffs/scripts/process-killer.sh

This script can backup all NVRAM variables and selected /jffs contents to cloud sergice using Rclone.

You should probably store the binary on USB drive but the script has also an option to automatically download the binary before running then deleting it afterwards. Make sure your device has enough memory for this though.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/rclone-backup.sh" -o /jffs/scripts/rclone-backup.sh
curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/rclone-backup.list" -o /jffs/scripts/rclone-backup.list

Enables masquerade for Samba ports to allow VPN clients to connect to your LAN shares.

By default, default networks for WireGuard, OpenVPN and IPSec are set.

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/samba-masquerade.sh" -o /jffs/scripts/samba-masquerade.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

This script tries to emulate service-event script from Merlin firmware but there is no guarantee whenever it will run before or after the event.

By default, integrates with all scripts present in this repository.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

Warning: this script will probably not work on stock firmware (should work on Merlin), see note in the script.

This script enables swap file on start, with configurable size and location.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/swap.sh" -o /jffs/scripts/swap.sh

This script installs Tailscale service on your router, allowing it to be used as an exit node.

You should probably store the binaries on USB drive but the script has also an option to automatically download the binaries. Make sure your device has enough memory for this though.

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/tailscale.sh" -o /jffs/scripts/tailscale.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

This script will send log message when CPU or WLAN chip temperatures reach specified threshold.

Be default, the treshold is set to 80C.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/temperature-warning.sh" -o /jffs/scripts/temperature-warning.sh

This script will send you a Telegram message when new router firmware is available. You need create a Telegram bot for this to work.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/update-notify.sh" -o /jffs/scripts/update-notify.sh

This script updates all *.sh scripts present in the /jffs/scripts folder (also including their extra files).

This is on-demand script that must be ran manually.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/update-scripts.sh" -o /jffs/scripts/update-scripts.sh

This script will add any USB networking gadget to LAN bridge interface, making it member of your LAN network.

This is a great way of running Pi-hole in your network on a Raspberry Pi Zero connected through USB port.

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/usb-network.sh" -o /jffs/scripts/usb-network.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

This script will prevent your LAN from accessing the internet through the WAN interface.

There might be a small window after router boots and before this script runs when you can connect through the WAN interface but there is no way to avoid this on stock firmware.

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/vpn-killswitch.sh" -o /jffs/scripts/vpn-killswitch.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

This script will prevent clients connected to WireGuard server from accessing the internet.

Recommended to use service-event.sh as well.

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/wgs-lanonly.sh" -o /jffs/scripts/wgs-lanonly.sh

curl -fsSL "https://raw.githubusercontent.com/jacklul/asuswrt-scripts/master/scripts/service-event.sh" -o /jffs/scripts/service-event.sh

About

Collection of scripts that can run on stock Asus routers (also on Merlin's firmware and forks)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Shell 94.4%
  • HTML 5.6%