Wake On Lan

Finally, I solved the problem partially that I could not use wake on lan before.

1. find required information with the following command

ifconfig
ethtool <Your ethernet interface name>
which ethtool

2. make the file wol.service at /etc/systemd/system/ and the contents are followed

[Unit]
Description=Enable Wake On Lan

[Service]
Type=oneshot
ExecStart = <Your ethtool filepath> --change <Your ethernet interface name> wol g

[Install]
WantedBy=basic.target
skip this step

3. add the following line at /etc/init.d/halt

NETDOWN=no

4. run the following command

sudo systemctl daemon-reload
sudo systemctl enable wol.service

5. turn off the computer as sudo systemctl suspend

You should check your motherboard or networkcard that supports wake-on-lan while in shutdown state, if you want to use shutdown command to power off the computer.

6. use wakeonlan as broadcasting

apt install wakeonlan
wakeonlan <Your mac address>

Note that if you didn’t specify ip address with -i option, the packet is broadcasted.

The reason that I think this is an half-measure

The wakeonlan command was not working when I used as wakeonlan -i <ip address> <mac address>.
But the computer turned on when I made the packet broadcast.
I think that because the client that I made packet uses the same router, the broadcasting packet works.
In other words, It won’t work if I used another clients outside.
+ However, I have a question about that is it okay the computer can be on by the internet traffic as the perspectives of secure.

Reference

init.d and systemd

ChatGPT

Although I got an information about wake-on-lan in Reference 1~4 too, there was an information hard to search. However I’m really surprised that ChatGPT made me get a required narrow personalized information.