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 (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 a senior technical consultant with 13 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. He also writes several blogs on his website and he is a Computable Expert.
Tagged , , . Bookmark the permalink.

28 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 (always ends on 255).
    -> i found my subnet is ? 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.

  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!

  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:


    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.

  18. Dimas says:

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

Leave a Reply