Pepare
Install required tool:
$ sudo apt install ethtool
Get ethernet interface
$ ip a
Let’s assume it’s enp1s0
Check if the WOL is available:
$ sudo ethtool enp1s0
Set WOL on:
$ sudo ethtool --change enp1s0 wol g
After sudo ethtool enp1s0
the Wake-on: d
should be changed to Wake-on: g
But this will be reset after reboot, so:
Make it permanent via service
Get the ethtool
executable’s full path by running which ethtool
Create a service file sudo touch /etc/systemd/system/wol.service
and put next content in it using vim:
[Unit]
Description=Enable Wake On Lan
[Service]
Type=oneshot
ExecStart=/usr/sbin/ethtool --change enp1s0 wol g
[Install]
WantedBy=basic.target
Enable service:
$ sudo systemctl enable wol.service
$ sudo systemctl start wol.service
// check the status
$ sudo systemctl status wol.service
Test WOL
Install wakeonlan
package:
$ sudo apt install wakeonlan
// call for action
$ wakeonlan C0:C7:E7:1E:14:77
// or
$ wakeonlan -i 192.168.0.255 -p 9 C0:C7:E7:1E:14:77
// 7 & 9 (mostly 9) are default UDP ports used for WOL
Enable Wake-On-WAN
Make 9 (or 7) UDP port forwarding via router to the device using port mapping.
Use mobile apps by adding your network external IP and device MAC address:
https://play.google.com/store/search?q=wake%20on%20lan
(I personally prefer: https://play.google.com/store/apps/details?id=com.bitklog.wolon&hl=en&gl=US)
OR
You can setup a VPN using OpenVPN and use test step, mentioned above