2 ms·
A few things to add, since Wake-on-LAN either just works the first time, or is a headache to figure out why it doesn't: * The target device might have to be on
by neilv 2y ago
A few things to add, since Wake-on-LAN either just works the first time, or is a headache to figure out why it doesn't:
* The target device might have to be on Ethernet, not WiFi.
* You might have to enable this feature on the target device, such as in the motherboard firmware setup for onboard network interfaces, and/or in the host OS. (I had a machine that required doing both, for an onboard Ethernet device.) For Linux host OS, such as on Debian Stable, if the device doesn't default to wake-on-LAN enabled, you'll probably use `ethtool`, testing it with something like the following, and then have to put the last line as an init/systemd script, so that enabling persists across boots.
ip a
sudo ethtool MYDEVICE
sudo ethtool -s MYDEVICE wol g
* You need to get the magic packet onto the right LAN. Maybe this means plugged into the same network switch or routed LAN, but it can get more complicated, even with small home WiFi routers, various ways. (Including if you're on WiFi but the target is not, or you're on a different VLAN, or it's isolating LAN devices from each other in the WiFi device or router, or any of multiple kinds of 'firewall' filtering is between you.)
* There are many ways to send the magic packet. Lately, I `apt install etherwake` on a host that's on the same LAN, or even the equivalent on a router once.
* From there, if the sending device has multiple network interfaces or VLANs, you might have to tell the program which to send the packet on.
* I sometimes make pairs of one-line scripts named `start-`<hostname> (which does Wake-on-LAN, possibly by SSH into a jump box of some kind) and `stop-`<hostname> (which does something like SSH to invoke `shutdown`). Kludgey, but they pretty much always work.