Gingko
New Around Here
This tutorial is intended for people who want to wake up some device (a NAS, PC, ...) when a VPN client connects to the VPN server on your Asus Router.
It is similar to WOL Script Wake Up Your Webserver On Internet Traffic except that the trigger comes from the VPN connection.
To setup follow these steps:
client-disconnect /jffs/scripts/ovpn-client-disconnect.sh
Notes
It is similar to WOL Script Wake Up Your Webserver On Internet Traffic except that the trigger comes from the VPN connection.
To setup follow these steps:
- Install Asuswrt-Merlin firmware.
- Setup a VPN server on your Asus Router and a VPN client e.g. on your mobile phone (or any other client device).
- On the Asus Router admin page:
Administration > Enable JFFS custom scripts and configs: Yes
Administration > Enable SSH: Yes - Setup WinSCP and open a session to your router
- Create the script file /jffs/scripts/ovpn-client-connect.sh
- Edit the ovpn-client-connect.sh script with the following content:
#!/bin/sh
logger "VPN client connected!"
# MAC address of the device you want to wake up
/usr/sbin/ether-wake -i br0 -b "00:11:22:33:44:55"
exit 0 - While saving the script, make sure line endings are Unix style (LF) but not Windows style (CR LF)
- Make the script executable (either in WinSCP edit file properties: RWX or using PuTTY: chmod a+x /jffs/scripts/ovpn-client-connect.sh)
- Go back to your Asus Router admin page:
VPN > VPN Server > VPN Details: Advanced Settings
VPN > VPN Server > Custom Configuration, enter the lines:
script-security 2
client-connect /jffs/scripts/ovpn-client-connect.sh - Apply and test it
client-disconnect /jffs/scripts/ovpn-client-disconnect.sh
Notes
- Commands added to the "Custom Configuration" section will be embedded in the OpenVPN configuration file /etc/openvpn/server1/config.ovpn
- It takes about one or two minutes after a client has disconnected until the client-disconnect script gets executed.
- Note that the openvpn-event script (described here) seems not appropriate for this purpose since it is invoked only at VPN server startup and shutdown, but not when a client connects or disconnects. The openvpn-event script is linked to the OpenVPN commands up and down.
- It's suggested to keep a backup of scripts located in the JFFS partition, since the partition may be erased during firmware upgrade (as stated here)
Last edited: