I am sure everybody has a PC that they want to remotely access but not powered on all the time. Now if you have a Qnap machine or any other NAS box with embedded linux, which is always on, you can use it to Wake your computer on Lan.
I am assuming that you have remotely shell access on your Qnap machine and your Computer supports WOL. Offcourse your Computer has to be on the same network as the Qnap machine and you have to know the Mac and broadcast address of the machine you are trying to wakeup.
You will be first enabling Wake on Lan on your PC, then install wakelan on Qnap and finally sending a MagicPacket to your PC from Qnap. here is a step by step on how to do it.
1. Check if your PC is capable of WOL and enable it in BIOS.
First Boot into your Bios and see if there is a Wake on Lan option somewhere. Different BIOS use different menu structure, so it may be under Network in one BIOS and Power management in the other BIOS. You will have to go through all the menu options to find it.
If the option Exists , enable it and you know that your PC supports WOL. Your PC in this case can definetely be brought to boot from a complete power down.
If your BIOS doesn’t have this option, then WOL is not supported. Now there are PCs on which I have seen no WOL support in BIOS, but still capable of waking from power off. And there are some computers that can only be brought to wake from Linux suspended and windows Standby mode . My Old Lenovo 3000 N200 didn’t have WOL support in BIOS, but I was able to bring it out of sleep from Suspended mode. Similary the HP dx2390 didn’t have any WOL settings in BIOS, but I could power then on from a complete power down. So if your BIOS doesn’t have a WOL option, it doesn’t mean that your PC doesn’t have WOL support.
2. Enable WOL in your operating system.
In Windows, you can enable WOL by going to your Network card properties in Device Manager. Under the tab Advanced, enable all the WOL options you see. Then in the Power Management, check “Allow This device to bring the computer out of Standby” and “Only Allow Management Stations to bring this computer out of standby”.
In Ubuntu, you can run ethtool to check the stauts of WOL and turn it on. there is a guide on how to do this here.
3. Prepare your Qnap Box to send MagicPacket by installing wakelan.
Now that your PCs are WOL ready, you need a program on your Qnap that can send a MagicPacket to the machine you wish to wake up. I found a program called WakeLan.
The easiest way to to install wakelan package is by going to your optware ipkg web front end. If you have enabled optware Qpackage, it would be under http://yourmachineip/Optware/. You will have to have the admin username and password to login.
Once you see the optware webfront, search for wakelan, and install it. My below screenshot shows only a delete task as I have it installed already. Your should show install under the column heading task.
Once you hit install button, it shows the package download progress and then installs it for you.
4. Use Wakelan command on your qnap box to wake your PC
Now connect to your Qnap box remotely over SSH ( I use Putty) to get shell.
Run the wakeland command, replace the mac and broadcast address with the PC you wish to wake up.
wakelan -m <mac address> -b <broadcast address> . for example wakelan -m 001eec0a0326 -b 192.168.1.255.
You can find your machine mac address by running ipconfig -all on command prompt on windows machines and ifconfig on Ubuntu.
That’s it, your PC should immediately power on and start to boot. If you have a remote access software like Teamviewer, Logme in or VNC installed , you will be able to access the PC once it boots up.