Source: https://www.truenas.com/community/threads/enable-wol.95856/
As an Admin user you can use the ethtool with sudo rights to check if WoL is available on your system. The usual ethernet NIC name is "enp3s0" so I use everytime this name.
sudo ethtool enp3s0
Supports Wake-on:
- d available and inactive
- g available and active
# turn on WoL once
sudo ethtool -s enp3s0 wol g
You can now check with sudo ethtool enp3s0
if now the supports WoL is turned to g, which means -> active
To proof, you can shutdown and send a magic package to your MAC address. (Use Android app or wake-on-lan tool from a different OS)
If this is working, you can be happy for a few minutes. Unfortunatelly, the step above is not permanently persisted, so you have to do it after each reboot (because after your reboot, the configuration is gone.
- switch to root user and create a script which does the step above
- change to root user
sudo su root
- create the script
cat >> /root/wol_fix.sh <<EOF
#!/bin/bash
ethtool -s enp3s0 wol g
EOF
- add execution flag to that script
chmod 755 /root/wol_fix.sh
Try it! Change the WoL config back to "d" manually. ethtool -s enp3s0 wol d
and execute your script as root /root/wol_fix.sh
Check if the configuration changed back to "g".
cat >> /etc/systemd/system/wol_fix.service <<EOF
[Unit]
Description=Fix WakeOnLAN being reset to disabled on shutdown
[Service]
ExecStart=/root/wol_fix.sh
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
EOF
# Reload the systemd manager configuration.
systemctl daemon-reload
# start the wol_fix.service
systemctl start wol_fix
# Enable to wol_fix service script.
systemctl enable wol_fix.service
If everything works as expected, you have now permanently WoL enabled.