Rr. Kavajes, Square 21, Tirana, Albania +355 68 400 500 9 info@ernesthena.com

WOL Server once VPN user Connects

Home Solutions

 

Requirements

  • Server remains most of time in sleep to save power

  • User Connects with VPN type PPTP to the Router

  • Router automatically sends WOL (wake-on-lan) to Server which wakes up

 

Solution

    Enable in Bios Server to WakeUP from PCI (PCI Network Card)

    Download Putty from below link, install and open it.
    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

    Will be shown the below table.

    Connect to the router with ip 5.5.5.5 with ssh protocol, click > Open, then insert user/pass that has admin rights

 

Now we need to configure it as PPPTP Server
ubnt@EdgeRouter-6P:~$
configure
set vpn pptp remote-access authentication local-users username test password test
set vpn pptp remote-access authentication mode local
set vpn pptp remote-access client-ip-pool start 192.168.10.100
set vpn pptp remote-access client-ip-pool stop 192.168.10.200
set vpn pptp remote-access local-ip 192.168.10.1
set vpn pptp remote-access mtu 1300
commit
save
exit


Creating the directory where the script will be saved:
ubnt@EdgeRouter-6P:~$ sudo su
mkdir /config/user-data
cd /config/user-data

Modify the script:
br01 is the bridge interface of the router where server is connected
d0:9c:23:df:78:98 is the mac address of the server

vi wol0.sh

Copy paste the below script
if ip link show pptp0 | grep -q "state UP\|state UNKNOWN"; then
COMMAND="sudo etherwake -i br01 30:9c:23:df:78:98"
$COMMAND
else
echo "PPTP interface pptp0 is down."
fi
exit 0

Write and Quit with below commands
esc
:wq!

Make the script executable
chmod +x /config/user-data/wol0.sh


Modify the crontab to add this script.
It will be executed every 1minute

crontab -e

Paste the below text
* * * * * /config/user-data/wol0.sh

Write and Quit with below commands
esc
:wq!

 

 

All Rights Reserved, Ernest Hëna ©2025