How to enable Wake on LAN on Rockstor?

Hello Community! Newbie here! :laughing:

Does “Rockstor” support the “Wake on LAN” feature? If so, how can I enable it? I’ve searched throughout the WebUI but couldn’t find anything related.

Thank you for your time!

Unless I am mistaken, it’s a function of your Motherboard/BIOS whether you can start the system with a WOL packet. So, if your hardware supports it, you should be good to go.
To have a clean shutdown prior to this, say, always shut a running Rockstor instance off at 2 am and use WOL to start it again on demand, you could schedule a task via the Rockstor WebUI and then use the WOL to wake the system again.

2 Likes

I have enabled the WoL function from BIOS, but while it works with other NAS softwares, nothing happens with Rockstore! This is why I’m wondering if I need to enable something via the Web UI or some command via CLI. For example, in Openmediavault, it’s not enough to simply enable the WoL function in BIOS. You also have to enable the corresponding option in the Web UI.

I have also found this link: [WOL on Rockstor 4 (SuSE)]
But I can’t understand what he/she is doing!!!

@simos.sigma, glad you did a search for this, because I did not this time around :slight_smile:

Identify which of your network devices you will use to receive the WOL packet, which you can do from the Network screen in the Rockstor WebUI:

In this example it would end up being eth0 (there are 2 ethernet devices but in this case, only one is connected and active. So, in your case it could be eth1 so then you would just need to replace eth0 with eth1

It should be fairly straight forward via the command line. I am assuming, that you’re looking for clarification on the instructions. If that’s not it, my apologies, and let us know what clarification you need.

First you need to install the ethtool package so you can have systemd execute it.
At the command line:
zypper in ethtool confirm that you want to install it.

Next, create the service file for systemd:
nano /etc/systemd/system/WOL-eth0.service or give it some other name, but provide the .service extension.

Paste the content:

[Unit]
Description=Wake-on-LAN for eth0
Requires=network.target
After=network.target

[Service]
ExecStart=/usr/sbin/ethtool -s eth0 wol g
Type=oneshot

[Install]
WantedBy=multi-user.target

Save the file (<Ctrl>+O, then confirm)
Exit the file (<Ctrl>+X)

Then execute the systemctl commands below, which will enable this “service”, so the WOL activation of the network device will survive a reboot (as indicated by @cbits68 in his message).

systemctl enable WOL-eth0 (or whatever you named the file above, minus the .service extension) - this will essentially make this new service known to systemd.
systemctl start WOL-eth0 to start it (meaning the setting is applied and will also now ensure that at every system start is re-applied, instead of just being reset.

3 Likes

And, actually, there seems to be an even easier way to do this. Since we are using Network Manager, we can also take advantage of the nmcli (Network Manager command line interface).

At the command line, first check for the available connections (or use the Rockstor WebUI as above):
nmcli con show
This will give you (using the above example):

NAME                UUID                                  TYPE      DEVICE
Wired connection 1  6c25894c-111a-3721-8461-6e7388f3e99c  ethernet  eth0
docker0             d842d555-071e-502e-b89e-2ac45de8c259  bridge    docker0

We’re interested in the Wired Connection 1. Let’s check it out:

nmcli c show "Wired connection 1" | grep 802-3-ethernet.wake-on-lan`

You should get a response like this:

802-3-ethernet.wake-on-lan:             default
802-3-ethernet.wake-on-lan-password:    --

As far as I know, the default indicates that this connection is taking that setting from the global network manager configuration file - we currently don’t have that attribute globally configured, so it would be the same as if nothing was assigned to that property.

Now let’s set the WOL for use with a magic packet:

nmcli c modify "Wired connection 1" 802-3-ethernet.wake-on-lan magic
nmcli c up "Wired connection 1"

if you happened to have the ethtool from above installed already, you could check the setting out:

ethtool eth0 | grep -i wake

(note, for ethtool you need to use the device name, not the connection name)
this should give you an output like this:

        Supports Wake-on: pumbg
        Wake-on: g

The g flag indicates that WOL is now enabled. And this settings change also survives reboots.

Of course, you can also use the nmcli to check on the setting:

nmcli c show "Wired connection 1" | grep 802-3-ethernet.wake-on-lan`

This will now show:

802-3-ethernet.wake-on-lan:             magic
802-3-ethernet.wake-on-lan-password:    --
2 Likes

Thanks a lot, @Hooverdan, that looks great, especially if we can just use nmcli to set that in a persistent manner.

@simos.sigma, @Hooverdan, if/once this is confirmed to work, what would you think about integrating this in Rockstor’s UI? We could add a button/icon next to a connection that supports it to turn it ON/OFF.

2 Likes

Thank you very much @Hooverdan!!! I have two old machines where I’m testing various NAS software so to see where I will end up. I used your second approach for the Rockstor machine and it worked. I also used your first approach to the other machine which has Ubuntu Server 22.04.3 LTS and another NAS software installed and it worked too. :slightly_smiling_face:

@Flox yes, that would be really great. In others NAS software, of which I have tried, it already exists. It would be really great to have it on Rockstore as well.

3 Likes

Glad to hear both of them worked for you. @Flox I think, especially since the nmcli approach seems to work, it would be a good idea to expose it in the WebUI as a switch, next to a valid device …

3 Likes

I took the liberty to create an issue on github for this, referencing this thread:

3 Likes