First find you interfaces:
esage@delldesk:~> ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 6c:2b:59:d2:97:c0 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
inet 192.168.2.13/24 brd 192.168.2.255 scope global dynamic noprefixroute eth0
valid_lft 3579sec preferred_lft 3579sec
inet6 fe80::6e2b:59ff:fed2:97c0/64 scope link noprefixroute
valid_lft forever preferred_lft forever
In this case my device has one local ethernet port. Next we need to see if that interface supports wake on lan:
esage@delldesk:~> sudo ethtool eth0 | grep Wake-on:
Supports Wake-on: pumbg
Wake-on: g
We can enable WOL temporarily by this command:
sudo ethtool -s eth0 wol g but after reboot WOL would no longer work to correct for this we need to run this command sometime after the network comes up during startup. Most people now use systemd as their init (program that starts all other programs/services) but the same principle applies to any init.
First create an oneshot service:
sudo vim /etc/systemd/system/wol@eth0.service
add this text to the file and adapt the filename to your interface:
[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
After=network.target
[Service]
ExecStart=/sbin/ethtool -s %i wol g
Type=oneshot
[Install]
WantedBy=multi-user.target
After that we need to get systemd to see the new service file:
sudo systemctl daemon-reload
To try it once:
sudo systemctl start wol@eth0.service
To run this command at every boot:
sudo systemctl enable wol@eth0.service
Leave a Reply