WoL for TrueNas server through SSH

riccardokhm

Cadet
Joined
Jan 16, 2022
Messages
5
Hi everybody,
I'm a newbie on the matter. I have just installed and configured my TrueNas machine on my local network and I have created a domain for the Nextcloud instance running on Truenas to access it remotely. I'm trying to set up the Wake On Lan functionality (motherboard Gygabite H270 HD3 with WoL enabled) through an ssh connection. Do I have to set up a port forwading on my main router pointing to the port I set on the TrueNas WebGui for ssh connection, right? How for authentication? I read that root user should not be considered for accessing from remote the machine, can i use the other accounts from TrueNas? Do i have to write a script to call when starting WoL?
Thanks for your time!
 

R.G.

Explorer
Joined
Sep 11, 2011
Messages
96
I see that no one replied to you; that seems to be more and more common on this forum, sadly.
I messed with WOL long ago on earlier releases of FreeNAS. Are you trying to wake the whole hardware from power off, or just the Nextcloud instance on already running hardware? I got WOL to work on powered down hardware and boot the whole machine. The effort was entirely to understand and get WOL running on the hardware, no involvement with FreeNAS at all, as FreeNAS was not running when WOL happened. I have no clue about how to get WOL running to start a software instance on an already running TrueNAS.

Edit: I realized that I could be more helpful. WOL (for starting a motherboard) is not a terminal/SSH operation. Hardware that does WOL powers up when it receives a "magic packet", a specially formed network frame. WOL enabled hardware leaves some part of the hardware active even in power-down, and that part of the hardware can receive network packets and examine them for a special string of binary bits. When that string of bits is received, the kept-alive hardware asserts the "power on" signal to the power supply, and the result is exactly like pressing the power button on the case. In my case, I found that I had to use an application on another machine that was a magic packet sender program to send the magic packet to the machine's IP address. It's not SSH, not terminal operations at all. There is no authentication at all. Port forwarding depends on whether you want to do this from anywhere on the internet, or just on your subnet. I spent some effort to get it to work on just my subnet, as I want to keep the greater internet strictly out of my server. If you want to wake it from anywhere, yes, you'll have to set up port forwarding to get a path through your firewall into the machine to let the magic packet through. That will necessarily mean that you have to worry about keeping hacking attempts through that port from subverting your NAS.

The thread on my WOL attempts with FreeNAS is still in this forum's archives. You can find them with searches. What I mostly got was some of the crustier gurus spending a great deal of effort to tell me not to do WOL at all. I did it anyway, used it for a while and didn't lose my data, but then I was careful in how I used it. I don't use it any more.
 
Last edited:

Cloudified

Dabbler
Joined
Jan 21, 2022
Messages
42
You can put get a very inexpensive Raspberry Pi on your network to send pings to your server(s)/instance(s) to keep them active.
 

R.G.

Explorer
Joined
Sep 11, 2011
Messages
96
Good idea, Cloud. Pis were not something I had in the arsenal back when I was messing with WOL.

I'm still not clear if the OP just wanted to bring up an instance on an already-running server, or start the whole server hardware from power off.
 

riccardokhm

Cadet
Joined
Jan 16, 2022
Messages
5
Hi guys, thanks a lot for the reply. I am trying to wake all the machine up, not just the Nextcloud instance. I have an already working SSH connection established with my home server just to shut it down in case of necessity but I'd like to be able to wake all the system up in case lights skips. I have set up my motherboard for wol but it seems that my router cannot manage magic packet (i'm not finding the wol settings in the router home), could it be that it is not actually supported? I'm thinking of buying as alternative an interruptable power supply to avoid this issue, but the raspberry would be another optimal solution since I'm planning to control my 3D printer from remote and I would use this instance to control both in case. What do you think? What measures would you take in allowing remote connection?
 

R.G.

Explorer
Joined
Sep 11, 2011
Messages
96
This was fairly confusing to me when I was doing it, too.
(1) WOL is not connected in any way to SSH that I know of, and I did not need it. It's like you don't need a banana to do WOL either.
(2) Routers might, maybe, could possibly send a WOL package, but from what (little) I know about routers, it would be surprising if it did, and would need special stuff inside the router to do. I don't know of any routers that do this, but they ... might ... exist. Maybe.
(3) I highly recommend getting an uninterruptible power supply if you value your data. I consider a UPS to be mandatory. The NUT utility in FreeNAS (and I assume TrueNAS) can interact with most intelligent UPSs to do an orderly shutdown when they go on battery for long enough. This saves your data. I personally am OK with going around and turning the NAS back on when power comes up again.

One other item in my setup is that I have Supermicro motherboards with onboard IPMI processors. This lets me power the systems on from a web browser remotely without WOL.
 
Top