Using a Synology Disk Station for Wake On Lan

For my work I need to be able to access my home lab “server” frequently but in no way it needs to be always-on. This leaves me with the struggle of leaving it on and, for most of the time, consuming unnecessary  electricity or accept the fact that I can’t use it without proper planning.

So I was thinking of a way to have the best of both worlds, no waste of electricity but being able to use it whenever I want.

I thought of a system where I would run a script each evening shutting down the system. The script will prompt for the shutdown so when I’m still using it I am able to cancel the shutdown. This is the easy part, but how to get it on again…… What about that legacy Wake-On-Lan (WOL) protocol?

I started with just a simple WOL program on my Windows 8 company laptop and I was able to turn on the “server”. That’s cool but that doesn’t help because when I’m not at home this just doesn’t work. After a lot of thinking I though about that cool Synology Diskstation I have on my desk.

From one of the Synology forums I grabbed a script and got it working. I ‘m now actually able to turn on my server from anywhere, any time and any place.

Here is a short description of how it works.

First you need to start with setting up Synology Diskstation Web Services.

Go To Control Panel > Web Services and enable a Virtual Host.

Synology web services

Now you’ll find a new folder in your Synology File Station.

Synology indexphp

Upload index index.php file to that folder.

In the php file find the IP Subnet and change that to your IP subnet, probably 192.168.1.255 (always ends on 255).

At the bottom of the php file you’ll find three lines for systems. Carefully replace the MAC Addresses of the systems you want to be able to WOL.

When you’re ready browse to http://diskstationIP:port/WOL/

About Barry Schiffer

Barry is an IT Architect with 15 years of IT experience. He has gained both a broad and deep knowledge in the sphere of IT. Throughout the years, Barry has developed into a specialist in the field of Microsoft Windows, Server Based Computing, desktop and server virtualisation.Barry is co-founder and member of the Board of the Dutch Citrix User Group.Barry is awarded with the Citrix Technology Professional award in 2015 and received the RES Software Valued Professional award in 2012.
Tagged , , . Bookmark the permalink.

39 Responses to Using a Synology Disk Station for Wake On Lan

  1. PMOSES says:

    Thanks heaps mate. Very helpful. Just what I needed!

  2. erwinsie says:

    Hi Barry, can you help me with:

    In the php file find the IP Subnet and change that to your IP subnet, probably 192.168.1.255 (always ends on 255).
    -> i found my subnet is 255.255.255.0 ? am i wrong? if so how to find my subnet?

    At the bottom of the php file you’ll find three lines for systems. Carefully replace the MAC Addresses of the systems you want to be able to WOL.
    -> i saw three lines, so which one i have to replace with my synology MAC add?

    with your guide in this article, do i need to have a pc turned on 24/7 at home or as long the modem is online i can turn on my syno from any pc in the world?

    thanks so much.
    -Win-

  3. Ivan Chi says:

    Thanks Barry, exactly what I need to wakeup my not-always-on NAS from my other always-on NAS. May be because my DSM 3.1 version is too old, I did not get your PHP to work at first. With some struggling I found that the Sockets extension was not loaded by default by my NAS. I tried dl() but did not work. Eventually I fixed the problem by setting the php.ini to load the Sockets extension on start up.

    Hope this will help others. Thanks once again for the great work, it has saved me a lot of effort.

    – Ivan

    • Win says:

      Ivan, can you be more specific? I really need to have this working before I fly overseas in two days time. Thanks

      • Ivan Chi says:

        Reading your questions posted on June 1st, it seems Barry’s solution does not meet your need. His solution is to use a NAS to wake-up another device on the same LAN segment. You seem to be looking for a solution to wake-up your NAS from Internet instead.

  4. Economy says:

    For many users they will also have to add a port forwarding for the port of the virtual host in their ROUTER.

  5. Scare says:

    Thank you so much! I was an happy user of another Wake-On-Lan package but after some DSM updated it stopped to work definitively.
    I didn’t know this PHP based solution and I have to say it’s really effective and DSM version independent!
    Congratulations for the idea! And thank you again.

  6. Awesome! Really appreciate it! Users must not forget to port forward their router.Thanks!

  7. Andre Boelee says:

    Great application! Question: why do I have to create a virtual Host? Would it be sufficient to create a new folder in the web directory?

    • Dr Tosh says:

      Thanks – works well. On latest version of DSM you need to press Apply when selecting enable Web Station, and then select Virtual Host after pressing apply.

  8. Moss says:

    Hi works really well, however it would be great if required a password to access the page.

  9. Petr says:

    Hi Barry,
    Can you please let me know what application I can use to edit the .php file?
    Thank you i advance!
    Petr

  10. dalrmi says:

    Great, I’ll give it a try. One question: so does it works if I connect from Internet (WAN) to my Virtual Host (web server & site on my QNAP) to wake up my iMac in the SAME LAN (subnet) as the QNAP nas ?

  11. catronin says:

    Thank you. It works fine in a DS411j with DSM 3.1 and DS213j with DSM 5.0

  12. CP says:

    great, works very well! thanks!

  13. Tery says:

    HI,

    Do you think it’s possible to modify this script, so that it send Magic Packet as soon as I access the page, on my mobile ?
    I only need to wake 1 computer, and don’t want to choose anything.

  14. Brian says:

    Wow….. That’s awesome!! Thanks for for sharing :)

  15. Stephanie says:

    Why run an entire web server just to do WOL when you could do the same thing from the CLI? Just SSH in and type:

    ether-wake -i eth0 00:01:02:03:04:05

    Works since at least DSM 4.3.

  16. @lex says:

    Perfect, thanks ! Please install Flattr, so I can Flattr you :)

  17. Manuel Azevedo says:

    Hello Barry, very nice stuff!
    I’ve adapted your script so I can access over my iPhone (better screen resolution too).
    Is it OK if I can also share it?
    I’ve included attribution to you on the header files.
    Thanks!

  18. Dimas says:

    With that, anybody can WOL my devices?!?!

    • Morten says:

      Well the smart thing would be to not open the port in the router for the WOL website. Then setup VPN for your network so you can connect to it from the outside and then turn on your PC.

  19. Pingback: Lan Stations | Amazon Supply

  20. joerg says:

    Great! it works fine. Thx.

  21. Paul Orbit says:

    There’s an easier way to achieve WOL from Synology. Just add a user defined script in the task scheduler:
    ether-wake -i eth0 01:02:03:04:04:06

    01:02:03:04:04:06 being the macaddress of the device you wish to wake up.
    Set the run time in the past so you can run the script manually with the run button.

    Note: to WOL your pc you may have to configure bios and the settings of your LAN adapter. This may differ for any device so you’ll have to google for it. This would be the case for any WOL method you choose. The LAN adapter needs to stay in stand by when switching off, and react to the magic packet sent with the WOL command. Also in BIOS your power options needs to be configured to be allowed to wake up by a PCI event and also the powersaveing mode needs to be set to a lower standard to prohibit the pc from completely shutting down. A lot of mainboards and LAN adapters allow this, but there are some that don’t.

    Been runnig this for a few days and works like a charm, altho the settings in BIOS and the adapter took some time to figure out.

  22. Michael Madsen says:

    Hi Barry,
    Thanks a lot for sharing this. It works great from my Synology Diskstation and wakes up my various computers.

  23. Gianpiero says:

    Thanks a lot Barry. It works perfectly in my environment

  24. Jan Bogaerts says:

    Thanks a lot, it works very well
    Cam you tell me how I can make the text a little bigger
    That would be fine to use on my iPhone

    best regard

  25. planetwilson says:

    Trying the ether-wake manually through SSH to my Sinology says operation not permitted. I wonder if this is why the script is not working also. No error reported when trying to wake up my iMac, just nothing happens (I have wake for network access switched on in OS X)

Leave a Reply