Switch on FreeNAS via Wake-On-LAN

In my previous blog entry I described how to FreeNAS checks if there are still computers on the network - or the system will shut down. Now the question remains how to restart it after that.

Send Magic Packet

An obvious way is Wake-On-LAN (short WOL). Here a so-called "Magic Packet" is sent to the network card, which then starts the system. Unfortunately, the onboard NIC in the HP N36L does not support this feature in FreeBSD, so a Intel NIC Move into the system. After the card is installed you only need one tool (on my MacBook Air I use the free "WakeOnLAN", other programs will work the same way) to send the magic package. For Windows it is a simple wol.exe to which the MAC address is passed as a parameter. This can then be done either via a shortcut or in the autostart, and it looks like this (the MAC address must be adjusted)

@wol.exe 6805ca09fcf9
@echo "WOL signal sent 1"
@timeout /T 5
@wol.exe 6805ca09fcf9
@echo "WOL signal sent 2"

If you put the contents of a batch file (*.bat) in the same directory as wol.exe, then several WOL signals will be sent one after the other with 5 seconds between each signal.

And behold... HP N36L starts without further ado, without having to press the power button. Sure, depending on where the device is, you can also start it manually, but it's already practical to theoretically be able to activate the NAS from the smartphone. Only the boot time is a bit annoying and needs getting used to, the data isn't immediately available. You can easily influence this by not running the cron job that shuts down the NAS too often - then it really only turns off when you leave the house and not when you turn off the computer for a short time.

I hope that my experience will help one or the other to save some electricity. Next, I'm going to try to bring the hard disks into standby mode in a more controlled way when no data is being accessed.

Wake-on-LAN for FreeNAS 9.1.1

of course this variant also works with the current FreeNAS version 9.1.1 - but I didn't try if wake-on-LAN now works with the onboard NIC of the N36L.

Wake-on-LAN for FreeNAS 9.2.x

Unfortunately, Wake-on-LAN with FreeNAS version 9.2.0 or higher does not work as usual. In order to use Wake-On-LAN nevertheless, a change to the rc.shutdown file will help when using a setup with Intel NIC. This requires a few steps, but can be easily done. First you have to log in via SSH, then:

mount -w /
nano -w /conf/base/etc/rc.shutdown

Comment out the line /sbin/ifconfig -l | /usr/bin/xargs -n 1 -J % /sbin/ifconfig % down (# in front)

mount -r /

If you reboot the system now, you can access it again via Wake-on-LAN - as described above. Hopefully WoL will work with FreeNAS in the next version.

Wake-on-LAN for FreeNAS 9.3.0

After upgrading to the current FreeNAS version 9.3.0 I was sceptical about Wake-On-LAN at first. But: unlike with 9.2.x it works at least with the Intel NIC without problems and without further settings. Just shutdown, after that FreeNAS 9.3.0 can be started easily via Wake-On-LAN.

Wake-on-LAN for FreeNAS 9.10

If you are already using FreeNAS 9.10, you will need the same Workaround. This allows the system to be started again as usual via WOL signal.

[amazon box="B07P7TNND4″]

6 comments

  1. Great tip. I have FreeNAS 9.2.1.7 and WOL just wouldn't work. I tried everything else and wanted to shoot the gun in the grain. But your tip helped. Thanks a lot.

  2. With the update to FreeNAS 9.10, WOL no longer works out of the box for me. But your workaround above fixed the problem.

    The "mount -w" is no longer necessary since FreeNAS 9.3. Apparently the filesystem is now always writable?

    Thanks for the help!

    1. Very good - had already noticed that, but had not yet had the chance to try out my own workaround 🙂

  3. Hello Falk,
    I just came across your blog. Very cool thing and very helpful 🙂

    Since you seem to know a lot about WOL, I wanted to ask if you could help me with my problem:

    For me, WOL works, so the system reboots. But I'm still desperately looking for a sleep state, where my encrypted hard drives remain "unlocked" so that a WOL is enough and I can access the content afterwards.

    Do you operate encrypted hard drives yourself? Can you happen to help me with my problem?

    Greeting
    Michael

Leave a Reply

Your email address will not be published. Required fields are marked *