Wake-on-LAN from a phone without opening any ports
The desktop at home sleeps most of the day. I want to wake it from wherever I am, and I do not want a port forward on the router for that.
The trick: the Pi is always on, and it is already reachable through the same WireGuard tunnel I use for everything else. So the magic packet does not need to cross the internet at all. It only needs to be sent on the LAN by something that is already there.
ssh pi 'wakeonlan aa:bb:cc:dd:ee:ff'
On the phone that is one shortcut in an SSH client. It takes longer to unlock the phone than to run it.
Things that bit me
- The motherboard setting is called something different in every BIOS. On mine it was under power management, not networking.
- Linux disables WoL on the interface by default.
ethtool -s eth0 wol gfixes it until reboot; a small systemd unit makes it stick. - It only works from S3 sleep and soft-off. Hibernate with fast startup on Windows does weird things.