Accomplishing the simple often takes a day or two.
According to countless tutorials on the internet, in order for a working WoL, you need to fulfill the following preconditions (where point 4 below is rarely mentioned [that’s why this article exists]):
- An ethernet hardware/card supporting WoL
- Enabling WoL in the BIOS
- Enabling the WoL feature on the ethernet card (usually using the user space tool
- Enabling the WoL feature in the Linux kernel (and this was the major pitfall for me)
Support of WoL can be checked for a given ethernet card in the following way:
ethtool | grep Wake-on
According to my own experiments on my local hardware, WoL seems to always be enabled by default:
Supports Wake-on: pumbg
Because it already prints
Wake-on: g, signalling that WoL is enabled (for Magic Packets), one is tempted to not run
ethtool -s <card_label> wol g to achieve the same.
ethtool command does at least one other thing, being equivalent to the following:
echo enabled > /sys/class/net/<card_label>/device/power/wakeup
And the main pitfall is: After a reboot,
cat /sys/class/net/<card_label>/device/power/wakeup will return
That is why attempts to make WoL work without
ethtool may fail. The feature will stay disabled in the Linux kernel, which will completely shut off the ethernet card in most powersave and power-off states. (I verified this observing the LEDs of a connected ethernet switch).
On modern Linux systems, given supporting hardware, it seems to be enough to write the string
/sys/class/net/<card_label>/device/power/wakeup to make WoL work.
ethtool doesn’t seem to be required any more for that, since Ethernet cards seem to already be configured properly by default. The Ethernet card will stay powered in most power-save and power-off states, so that it can receive Wake-on-LAN packets.