Linux Wake-on-LAN worldwide
Wake-on-LAN can also work worldwide (over WAN Internet), in case a PC 10,000 km away gets turned off accidentally. To turn on a target PC from anywhere in the world, first setup the target PC and router port forwarding. For simplicity/clarity we assume the following arbitrary parameters, which will be unique for the target Linux PC:
- target interface: eth0
- target PC static LAN IP: 192.168.1.100
- target public WAN IP: 1.2.3.4
- public WoL port forward: 10009
- target MAC: 00:11:22:33:44:55
Remote Linux PC: modern Linux distros such as Ubuntu have WakeOnLan configured in NetworkManager.
- Settings → Network and select the wired LAN interface to use for WakeOnLan.
- under the “Ethernet” tab, seee that “Wake on Lan: Default” is checked. No Wake on LAN password is needed for most use caes.
- copy down this “Device” hexadecimal string, this is the MAC address to turn on the PC remotely.
Confirm the correct MAC address by typing in Terminal
ip a
Have someone nearby it in case it doesn’t turn it back on–shutdown remote PC for testing.
On a laptop:
apt install wakeonlan
Wake PC on same LAN
on control PC, on the same LAN
wakeonlan 00:11:22:33:44:55
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. Try a discrete Intel Ethernet NIC, some motherboard NICs don’t work for Wake-on-LAN
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
- To use without Dynamic DNS service, have the PC auto-send email when the public IP address changes.
From the control PC on a different network type in Terminal:
wakeonlan -i 1.2.3.4 -p 10009 00:11:22:33:44:55
and target PC should power on.
Notes
- Ubuntu WoL setup
- Ubuntu TLP config
- notes
Legacy Linux remote PC setup
This procedure is for older Linux distros that don’t have WakeOnLan config in NetworkManager.
Install ethtool
apt install ethtool
Add the following line to /etc/network/interfaces
under the interface to control auto eth0
up ethtool -s eth0 wol g
Edit /etc/init.d/halt
, changing text near top to:
NETDOWN=no
instead of yes
.
Edit/create /etc/default/tlp
with line
WOL_DISABLE=N
Note link/ether
for eth0–this is MAC address
ip a
Reboot target PC, then shutdown target PC for testing