Wake-on-LAN (WoL) is a fairly simple idea, but like any computer idea, it comes with a tonne of caveats and exceptions. The idea is that you can bring a computer into a fully functional state remotely - whether it was originally off, suspended, or hibernated. This is achieved with a network message sent to the machine's MAC address.
Caveats and Exceptions
- the computer has a built-in network card: USB-to-Ethernet adapters don't cut it because they're powered off when the computer is off, and there's a form of WoL for wireless but A) it's apparently less reliable, and B) I'm not talking about that here
- the computer is on your local network: I don't think WoL messages pass through routers
- the network card on the machine supports WoL (most in the last decade-plus do)
- WoL is specifically enabled on the machine - in the BIOS/UEFI and in the OS
- PXE servers definitely cause problems: you want to NOT have one on your network if you want the woken machine to boot its own local OS
- you know the MAC address of the machine you want to wake
If the following steps don't work as expected and you think they should, go into the BIOS/UEFI and see if you can turn on Wake-on-LAN there. (I reboot my machines about once a month, so I'm loathe to go into the BIOS if I don't have to - I'm assuming you're the same. Maybe you'll do that first.)
On the machine you want to wake, determine the Ethernet device (I use
ip -br addr) and run:
# ethtool enp2s0 | grep -i wake Supports Wake-on: pumbg Wake-on: d
ethtool which you may have to install. We're looking for "Wake-on:" to be equal to "g". In this case, it's supported but not activated. So we activate it:
ethtool -s enp2s0 wol g. You can re-run
ethtool enp2s0 | grep -i wake and you should now see "Wake-on: g". The last thing we need from this machine is it's Ethernet/MAC address, which you can find with
ip addr (notice in this case we don't use "-br" for "brief" - that output doesn't include the MAC address). Look for the same Ethernet device as before (in my case "enp2s0") and look for the "link/ether" line associated with that. For this discussion, let's say my Ethernet address on this machine is "e0:e1:e2:e3:e4:e5".
With WoL enabled on the target machine and with the Ethernet address in hand, switch off or suspend the target machine. Go to another machine on the same network where you've installed one of
wol (Fedora), or
wakeonlan (Debian). Any one of these accepts an Ethernet address as its only parameter.
wol is convenient because it can be run as any user: the other two require you be root (which makes a little more sense from a security perspective).
# wakeonlan e0:e1:e2:e3:e4:e5
This should wake the remote machine. At this point you get into some of the twistiness of WoL: network issues; bad BIOS, bad network cards ... there are a lot of possible reasons this may not work. But ... most of the time, it will. Again: if you have a local PXE server, and a computer is being woken from OFF (ie. not just suspend), the machine will try to boot from the PXE server.