Wake-on-LAN on Linux (Pop!_OS)

Setting up the service:
Install the software:
sudo apt-get install ethtoolTo set up a systemd service, we create the file wol.service:
vim /etc/systemd/system/wol.serviceAnd add the following content:
[Unit]
Description=Enable Wake On LAN
[Service]
Type=oneshot
ExecStart = /usr/sbin/ethtool --change enp4s0 wol g
[Install]
WantedBy=basic.targetThe following command makes systemd recognise the newly created service:
systemctl daemon-reloadAnd we enable the service so that it runs when the computer boots:
systemctl enable wol.serviceThen we can reboot the computer.
Consistency
After suspending the computer once, it no longer wakes up the next time. So we create a suspend command as an alias, editing the aliases file as follows:
vim ~/.bash_aliasesand add the following content:
suspend="sudo systemctl restart wol.service; sudo systemctl suspend"Next we apply the changes made to the .bash_aliases file by running the following:
. .bashrcNow we can use our suspend command.
This was tested on an MSI laptop.
Photo by Jordan Harrison on Unsplash