How to configure Wake-on-LAN using systemd
Wake-on-LAN (WoL) is a feature that allows you to turn on a computer remotely by sending a magic packet over the network. To use this feature, you need to enable WoL support in the BIOS/UEFI and configure the operating system to detect and respond to magic packets.
In this guide, we will see how to configure Wake-on-LAN on a Debian-based system, SysLinuxOS, using systemd.
Step 1 – Check hardware compatibility
Before proceeding, it’s important to check that the computer’s network device supports Wake-on-LAN. You can do this by running the following command:
sudo ethtool <interface-name> | grep "Wake-on"
where <interface-name> is the name of the network interface (e.g., eth0 or enp3s0). If the command returns a line with “Wake-on: d“, it means that the network card supports WoL.
edmond@SysLinuxOS:~$ sudo ethtool enp3s0 | grep “Wake-on”
Supports Wake-on: pumbg
Wake-on: d
$ sudo ethtool enp3s0
edmond@SysLinuxOS:~$ sudo ethtool enp3s0
Settings for eno1:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Speed: Unknown!
Duplex: Unknown! (255)
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: unknown
Port: Twisted Pair
PHYAD: 0
Transceiver: external
MDI-X: Unknown
Supports Wake-on: pumbg
Wake-on: d
Link detected: no
The letter “d” means that WOL on the card is disabled. To enable it, use “g“:
$ sudo ethtool --change enp3s0 wol g
However, this command is temporary.
Step 2 – Configure systemd to enable Wake-on-LAN at boot
$ sudo tee /etc/systemd/network/10-enp3s0.link << EOF
[Match]
MACAddress=e8:d8:d1:86:cd:ce
[Link]
WakeOnLan=magic
EOF
where <MAC-address> is the MAC address of the computer’s network card.
Step 3 – Identify the PC on the network
Determine the MAC address of the target device you want to wake up:
$ ip neigh show
Step 4 – Test Wake-on-LAN
To test Wake-on-LAN, send a magic packet over the network using a tool like wakeonlan or etherwake:
$ sudo apt-get install wakeonlan etherwake
commands:
$ sudo etherwake -i <interface-name> <MAC-address>
$ sudo wakeonlan <MAC-address>
The computer should start up after receiving the magic packet.
Conclusion
In this guide, we have seen how to configure Wake-on-LAN on a Debian GNU/Linux system, SysLinuxOS, using systemd. This feature can be useful for remotely turning on a computer and saving energy by avoiding keeping it constantly powered on.
How to configure Wake-on-LAN using systemd
enjoy 😉
A very good summary how to configure WOL . It much more clearer than the other articles that I could read on the net.
Just 1 remark to make your article a bit more understandably as non expert linux user
it concerns the file 10-enp3s0.link
-you could precise that beside “tee ” the file could be generated by any editor , for instance vi, vim, nano…. . Although “tee” is a very useful tool, it is not very well known by many users. Also you could precise the title
10-enp3s0.link , except the suffix “.link “is arbitrary too.
Any way thanks lot
Didier
Thanks for your feedback