Wake-on-LAN can also work worldwide (over WAN Internet), in case your PC 10,000 km away gets turned off accidentally. To turn on a target PC from anywhere in the world, first you need to setup the target PC and router port forwarding (or have a VPN to the target subnet).
For simplicity/clarity we assume the following arbitrary parameters, which will be unique for your target PC:
|target interface||target PC static LAN IP||target public WAN IP||public WoL port forward||target MAC|
1. On target (PC to be remotely controlled)
- install ethtool
apt install ethtool
- add the following line to
/etc/network/interfacesunder the interface you want to control
up ethtool -s eth0 wol g
/etc/init.d/halt, changing text near top to:
link/etherfor eth0–this is MAC address
- Reboot target PC, then shutdown target PC for testing
2. setup control PC (your laptop)
apt install wakeonlan
3. Test Wake-on-LAN while on same LAN
on your control PC (while on the same LAN)
using the MAC address of the target PC of course.
If PC didn’t turn on, ensure BIOS/UEFI settings have Wake On Lan enabled. Worst case, you may need to try a discrete Intel Ethernet NIC.
setup worldwide Wake-on-LAN
To wake-on-LAN from anywhere in the world, using example parameters at top and after doing the procedure above, further do:
- Router: port forward 10009 to 192.168.1.100 port 9
- If you prefer not to use a Dynamic DNS service, just have the PC auto-send email when the public IP address changes.
- From your control PC on a different network type in Terminal:
wakeonlan -i 18.104.22.168 -p 10009 00:11:22:33:44:55
and target PC should power on.