How to turn on your NAS from the Internet using Wake on LAN

Sandu
7 min readFeb 2, 2022

--

Wake on LAN WolOn app

The Problem

Nowadays Network Attached Storage solutions are very common for home users. In my case I turned an old computer into a Ubuntu data server. Of course it was trespassing my noise tolerance threshold, so I had to place it far from my ears. It became harder to reach out to turn it on when needed. But having it always running was not an option, as I didn’t want to increase my electricity bills with a device that I would not use 24/24.

The Solution

I’ll present here the solution I implemented to turn on my Synology NAS from my Android smartphone with just one tap from my home LAN, or from the Internet.

It may not be a general solution, but in most cases it should work. The key factor in this setup is to have a Wake on LAN (WOL) enabled device. Most of the wired LAN adapters have this functionality, even some WiFi adapters have it, but these are rather exceptions from the rule. WOL is also usable on most of the ready-to-use NAS solutions from Synology, Asustor, Zyxel and others.

Wake On LAN is a protocol used to turn on computers remotely by broadcasting a specific message into the LAN.

I used a handy Android app called WolOn to send WOL packets. I picked WolOn as it has a very good rating on Google Play and it had all the functionalities I needed packed in a very simple and modern UI.

The Setup

1️⃣ Enable Wake on LAN on the target device

I had my NAS connected to my local network using a LAN cable, so the only thing I had to do was to enable WOL on it. On some hardware you have to enable it from BIOS, on others — enabling it only from the OS should be enough. In my case I had to do both.

2️⃣ Setup Wake on LAN

The set-up of WolOn — Wake on LAN app was also very easy. I added a new LAN device in WolOn with my NAS MAC address. In case you have more than one network adapters on your device, make sure the MAC of the LAN connected network adapter is used. To check that it works — just tap the device from the list in the WolOn app, it will display a shaking blender animation and the WOL message will be sent. In my case almost instantly my NAS server got started. That was a success! There is also an option to monitor the device status, just make sure to configure your router’s DHCP to assign a static IP to your device and add the IP in the Status check IP field. The app will ping it from time to time and will display a green sun icon if the device is on and responds to ICMP requests. In my case my NAS has 192.168.1.101 static IP as seen below.

WolOn Wake on LAN setup
  • Broadcast Address filed in most cases can be left empty. You’ll need it only if you have a more complex network architecture and WolOn can’t identify the correct broadcast address.
  • SecureOn is a way of securing WOL protocol. If you enable SecureOn on your computer then you’ll also have to add the password here. In most cases it’s not needed.
  • VPN Accessible — you can check this in case you have a VPN setup on your smartphone to your home LAN. In this case WolOn will try to forward the WOL packet through the VPN tunnel.
  • Select port — just pick any of them. WOL works on ports 7 and 9.

3️⃣ Setup Wake on WAN

To be able to turn my NAS from the Internet I had to do a few more steps. If you are not interested to understand how it works then skip to setup.

When your target computer is turned off, its WOL enabled LAN interface is set to a low power consumption mode. In that state it doesn’t have an IP address assigned, but can intercept LAN broadcast packets. If a WOL message that contains its MAC address is received, it will proceed with device turn on routines. If you are familiar with the Network OSI model, then IP traffic happens on Layer 3 of the model, while WOL protocol works on Layer 2.

Back to set-up.

To set up Wake On WAN for my NAS I had to configure my router to forward all UDP packets received on the WAN interface on a given port to the LAN broadcast address. Usually the broadcast IP is the same as your router’s internal LAN IP but ends with .255 (e.g. 192.168.1.255) Unfortunately most of the routers drop traffic forwarded to broadcast IPs by default. If your router has the option to allow this, then you don’t need the next steps. In my case it was not possible, so I had to do some trickery. I use an older Linksys router on which I run DD-WRT software, but OpenWRT could be even a better option. I created a port forwarding rule to forward all traffic received on the router’s external interface on port 3535 to IP 192.168.1.254 on port 9. Port 3535 is a randomly selected port and IP 192.168.1.254 is one of the IPs from my LAN that I’m sure won’t be assigned to any device in my LAN. The trick it to create a static arp record on the router that would map the above picked IP 192.168.1.254 to ff:ff:ff:ff:ff:ff MAC address. This is a special MAC address used for data broadcasting. The resulting behavior would be as follows:
1. Router receives the WOL packet on its WAN interface on port 3535
2. The WOL packet is forwarded to IP 192.168.1.254:9
3. As the static arp record for 192.168.1.254 points to ff:ff:ff:ff:ff:ff the WOL packet will be sent in the LAN to ff:ff:ff:ff:ff:ff MAC address which will result in a broadcast.

Here is the set-up for my dd-wrt powered router.

The port forwarding rules for both WOL ports 9 and 7 added from the router admin interface:

wol_9 — UDP 0.0.0.0:3535 -> 192.168.1.254:9
wol_7 — UDP 0.0.0.0:3536 -> 192.168.1.254:7

The static arp record added in the router admin interface in the start-up script:

sleep 120
arp -i br0 -s 192.168.1.254 FF:FF:FF:FF:FF:FF

And here is the WolOn Wake on WAN setup:

WolOn Wake on WAN setup
  • Router IP/Hostname — in my case my internet provider offers a DDNS service for free, so I could assign a custom URL to my router. If you have a static IP, which is not very common, then just fill that IP in this filed. Otherwise you’ll have to find a DDNS solution and use the custom URL.
  • Status check IP/Hostname — you can fill it in if you also want to see the status of your computer. You’ll have to create a port forwarding rule in router to forward ICMP requests to your computer’s IP.

⚠️ For the Wake on WAN solution I described you should consider the security aspect, as you are routing packets to your internal network. Nevertheless if someone would want to wake up your computer they would have to guess your computer’s MAC address which is too much of an effort just to wake up a computer. But on this part you should do your research and decide if this is an option for you or not. Otherwise if your router accepts SSH connections, using the below described SSH Command functionality you can set-up a SSH connection to your router and trigger wol command from SSH. For my case this would look like this

/usr/sbin/wol -i 192.168.1.255 -p 9 12:EF:EE:32:AE:56

Bonus 🎉 Remote shut down

I also purchased the Pro version to get access to SSH Command functionality. It let’s me connect through SSH to my computer and run the shutdown command with just one tap. That’s another great feature, as with a single app I can turn on, or shut down my computer remotely.

WolOn remote SSH shutdown command set-up
/usr/bin/echo your_ssh_pass | sudo -S /usr/bin/shutdown -h now

You should check the paths to the above commands for your system. For example, on some it could be /bin/echo and /sbin/shutdown. You can figure it out by typing which followed by the command name in the Linux shell.

The rest of the pro features are related more to the automation:

  • Monitor that your computer is on and if it’s not then WolOn will automatically send a WOL packet to turn it on.
  • Schedule WOL packets send at a given time, or repeatedly at selected intervals.
  • It can also work as a plug-in for Tasker, Macrodorid, Automate or Locale X which unlocks a huge amount of automation options.

This is the setup that worked for me flawlessly for more than a year and I hope this guide will help you easily replicate it to suit your needs. You can get the WolOn app from the link below.

Google Play and the Google Play logo are trademarks of Google LLC.

--

--