Setup Wake on Wan with the Asus RT-AC68U router and the Synology DS216j NAS

 

Hi all, I’m not a network guru but when I was confronted with this problem, as I saw many people were having the same problem on the forums I visited, I decided to share how I managed to solve it, after hours of tries and tests. Sorry for the inaccuracies, this is not a technical paper, it’s just a “how I did it” blog post. I’m not a network administrator I’m a CG guy who wants to use his NAS. Feel free to correct me in the comments.

The goal : being able to start then access my NAS remotely, from the internet (not only from my own WIFI network). Starting a device through the internet is called “wake on wan” or “WOW”.

The hardware:

  • Modem Router : SFR NB6VAC.
  • Router : Asus RT-AC68U
  • NAS : Synology DS216j
  • Laptop and smartphone to test wake on wan.

As you can see, my router is behind my ISP’s modem-router, which brought additional challenges. We’ll deal with this later.

 

Setup your LAN

Wake on Wan will not work if Wake on Lan doesn’t work, so start by setting your LAN properly.

Give a Static IP for your NAS inside your LAN. I set it up inside the Synology DSM control panel.

it is better to give static IP’s to your computers inside your LAN, except perhaps for laptops.

Also, still in the Synology DSM control panel, enable Wake on Lan.

Collect your MAC address. You can find it in CMD > ipconfig /all or in your router.

 

Test Wake On Lan

First, you can test the “wake on lan” tool of your router. Then, try also with some apps:

Just enter your NAS’ local IP and MAC address,

Also add the local port. For example, don’t put 8009, just put 9. Try also 7 and 22 if 9 does not work.

But adding an IP should not be absolutely necessary. I’m not sure, but when one uses wake on lan, only the MAC address is involved.

Try these apps. You should observe the target PC powering up almost instantly upon hitting enter.

 

Having a private WAN IP on your router?

We want to start configuring the devices for wake on wan. But before we start, there’s something we should check…

Check the WAN IP address of your router. If it looks like 10.x.x.x, 192.168.x.x or 172.16.x.x to 172.31.x.x then you have what is known as an RFC-1918 IP address (often referred to as private addresses). But for external access to our devices, it’s better to have a public address. Why is my router’s WAN address private? Because the SFR modem-router is issuing a private IP to the Asus router.

Because of that, the Asus router is complaining that “The wireless router currently uses a private WAN IP address. This router may be in the multiple-NAT environment and DDNS service cannot work in this environment.” That is because the asus router took an internal ip from my modem. Its a known fact that dynamic DNS concept will not work on dual natting. So there are a lot of things I can’t do on the router with a private WAN IP: activating a DDNS for the router, and all AI Cloud services, which rely on DDNS, like Cloud Disk, Smart Access, Smart Sync.

Another problem is that your own DDNS, the one we will set up later in this article, will not be reachable if this limitation is not avoided. Your own NAS DDNS, will look like mynas.synology.me:5000, and will be useful to connect to your NAS’ web interface remotely. This web interface won’t appear in your web browser if you don’t fix the problem. Instead, as per my tests, when you type this address, you’ll see the web interface of your modem-router. But wake on wan needs a DDNS that reaches its target: the NAS. So it is important to solve this issue.

To solve that, it is advised to put the modem router into bridge mode, so that the router gets a public WAN IP. Big problem here : my modem router does not have bridge mode and my ISP does not intend to add this function via a firmware upgrade in the future. There may be ways to hack this modem router but I didn’t try. Let’s move on.

 

Bypass the modem router without Bridge

So the solution I found was to use the modem-router’s DMZ function. What it does is pass on all internet traffic to the router.

While this solution is not ideal, it has solved part of the problems for me.

I also tried port forwarding instead of DMZ, but it didn’t work for me. So I kept the DMZ option on.

 

Ports forwarding on your router

To configure the devices for wake on wan, the 2nd step is to setup port forwarding on the router.

I really had no idea which port the router or the NAS uses for waking on LAN. Is there a way to know it other than with trial and errors? According to bigeddu on the Synology forum, the port is 22. But he doesn’t have the same Diskstation or router I have. So I found out after many tests that my Diskstation uses the port 9. I tried ports 7,9 and 22.

To make sure which port was the right one, I added many port forwards in my router. Here are them:

The first line is to access your NAS’ interface. The 3 following lines are for Wake on lan attempts. The last line is another computer. You should add the 4 first lines.

“Source target” : I think that value should be left empty.

While you’re in your router’s options, bind the NAS’ IP with its MAC address. Due to the fact that a “Magic Packet” (the data packet that wakes your hardware) is always broadcasted to the MAC address and not to the IP address, we need to tell our router that the signal it is receiving from an IP and port, should go to a MAC address. Indeed, if the NAS is off, there is no IP our router can find, so it must forward the WOL signal from the IP to a specific MAC address.

Restart the router after all is configured.

 

DDNS for your NAS

Previously, we set up a static local IP address for your NAS. Now we need to set up a static public IP address for your NAS. If you have only a local IP address, when you will send the wake on lan signal from the internet, the NAS will be unreachable because this IP is private and is behind your router. Now if the IP is public, the WOL request will find the public IP and will reach the NAS.

To get a static public IP address, we need a DDNS provider. There are some free DDNS providers in the internet (NO-IP is an example) but I am using Synology’s DDNS Service. You can get one in the control panel of your Disk Station DSM: “External Access” > DDNS. You will get an address that looks like a domain name, for example: mynas.synology.me. Restart the NAS. Then, to connect to your NAS’ web GUI, just type http://mynas.synology.me:5000 . Try it.

 

Persistent static ARP entry on the Asus router

This is the complicated part, the problem I spent so much time locating.

First, let’s summarize how our Wake on Wan will work: First, the user sends a wake on wan request through the internet. DDNS routes the signal towards our private network at home. The modem-router gets it and passes it on to the router via DMZ. The router gets it. Its port forwarding settings tells him he must pass it to the NAS. Using the IP-MAC binding, he passes this signal to the NAS. Now everything should work… But it deosn’t. WHY???

The answer is that when the NAS is switched off, the router forgets about the MAC address. Yes that’s right. As the MAC address is binded to the IP, and as this binding setting is kept in the router’s memory, it SHOULD not forget about the NAS’ MAC address, even after everything is shut down and restarted, but sadly, that’s the way it is. So we have to work on this problem again! Make him eat this MAC!

First, we have to test if the router can memorize this MAC address forever. For this, we have to connect to the router by Telnet or SSH. So the first step is to enable telnet and / or SSH in the router’s settings.

Then you can use putty to connect to your device. Install Putty, launch Putty (not the other utilities), and enter the router’s local IP then ENTER.

Enter your router’s admin username , not “root”

Enter password [your admin password]

Type “arp” (without quotes): you should see the list of devices that the router is connected to. If the NAS is shut down, you’ll see it’s not in this list.

But we’ll make the router remember the NAS. Type the following after logon to router via telnet.
arp -s xxx.xxx.xxx.xxx yy:yy:yy:yy:yy:yy <Enter>

Where xxx.xxx.xxx.xxx is the local STATIC ip address of your NAS, and yy:yy:yy:yy:yy:yy is the MAC address of your NAS.

NOTICE, the ip address numbers are separated by periods “.”, and the mac address numbers are separated by colons “:”, with a space in between the two.

To see if it was done correctly, type ARP from telnet prompt, it should show your computer ip address and mac address with PERM in the line, meaning permanent.

Now you can test a wake on wan (see below) and it should work.

However, if you reboot your router, you will still have to enter this again, as it erases the arp table when you reboot. Damn! So let’s get this even more complicated. All we need to do is to have this  command to run each time the router starts. The command will automatically start “arp -s [IP] [MAC]” each time we boot the router.

To do this, there 2 ways. The first is to have a usb thumb drive permanently connected to the router and install the router’s USB application “Download Master”. This method did not work for me. The second method is to install the Merlin Firmware for Asus routers. This worked.

Here’s a 10 steps guide:

1 — Install the Merlin firmware from http://asuswrt.lostrealm.ca/ . At the beginning I didn’t want to install another firmware but then I found the Merlin firmware installs fine, provides nice tools and options, provides the nano editor. It also provides SMB master browser which is good for your home network.

2 — Set up JFFS : On router UI > Administration > System Tab > you’ll find options for JFFS2 that are available only on custom firmwares like Merlin’s. We have to enable “Format JFFS partition at next boot” and “Enable JFFS custom scripts and configs”. Click apply, reboot, and after the reboot, check again: “Format JFFS partition at next boot” should be on “no” and “Enable JFFS custom scripts and configs” should be on “yes”.

3 — Merlin provides some customizable user scripts. Those scripts are stored in the internal non-volatile flash in the JFFS partition. But some of them do not exist right after you install Merlin. Now we will create one fo them : the file “services-start”.

4 — You’ve got to type in the Putty terminal:

nano -w /jffs/scripts/services-start

#!/bin/sh

arp -i br0 -s [IP, for example 192.168.1.254] [MAC address, for example FF:FF:FF:FF:FF:FF]

5 — Press CTRL-O to save changes in the “services-start” , enter to save, and you’ll see something like “Wrote 2 Lines”.

6 — Then press CTRL-X in order to close nano-editor

7– With the following command, you’ll make your file executable. Type the following in Putty terminal:

chmod a+rx /jffs/scripts/services-start

8 — Then type in Putty terminal “reboot” and the router will reboot.

9 — Testing : After reboot, still with Putty, you can login into your router. Type a command “arp”. You’ll see what IP addresses correlate to what MAC addresses. You should see the word “PERM” just right after the MAC address of the NAS. I guess that PERM means permanent.

10 — That’s it!

This page might explain another way to set up a wake on lan script, but I didn’t try this method yet. And here is a thread on the SNB forum similar to the one where I found the good method.

 

Test Wake On Wan

I tried with these apps:

Just enter your NAS’ local DDNS domain name, its MAC address, and the external port, the one the router will get. So for example , don’t put 9, just put 8009. Do the same for 8007 and 8022.

And now it’s time to try.

To make sure the test is correct, shut down the NAS, reboot the modem-router and reboot the rooter.

First use your smartphone, disconnect its WIFI and keep the 3G. Use the app. If the Diskstation starts, it means it has worked!

Then you can try to connect your laptop to another WIFI, like one of these free WIFI hotspots, and try again with a desktop or modern UI app. Note: some WIFI hotspots will restrict some accesses.

 

Links

https://www.smallnetbuilder.com/lanwan/lanwan-howto/29941-how-to-wake-on-lan-wake-on-wan

https://forum.synology.com/enu/viewtopic.php?t=87843

https://www.snbforums.com/threads/rt-ac68u-wol-static-arp-reboot-survival.16304/

 

 

You might be interested in …

31 Comments

    1. Hi,
      Regarding the update of the IP DDNS :
      I meet a problem of delay of update with my synology DDNS. So my NAS was unreachable.
      So I use now “afraid” and will see…..

  1. Hey Pierre, thanks for the info. I already setup a DDNS on the router but I cannot use it as my modem-router does not have the Bridge feature. This is explained in my article. Accessing the Asus router’s web interface would be the ideal solution as it would allow me to wake up, not only the NAS, but any ethernet connected computer on my lan. Unfortunately I can’t do it.
    As for the NAS’s IP. Since I set up the NAS’ DDNS, I notice its IP never changed. But if one day it changes, I think the DDNS “domain name” will always point to the updated IP.

    1. Well, I’m in the same situation. My Bbox doesn’t have a bridge mode. My router is in DMZ, and the custom DDNS works 🙂

    2. Accessing the Asus router’s web interface would be the ideal solution as it would allow me to wake up, not only the NAS, but any ethernet connected computer on my lan.

      Yes, i may try to do it on my RT-AC86U but i need to put leave it on router wireless mode instead of bridge as the main reason i got this router is to enhance my home wifi signal.

      But i already tried to wake up any LAN device from ASUS router and is working.

      Saludos,
      Dante

  2. Oh and: why not using the broadcast address if you want to wol your nas and PC?
    Just forward UDP port 7 (or 9) to 192.168.0.254, and then send the magic packet to your ddns (with the MAC of the device you wanna wake up), et voilà !

      1. sorry for my delay this time. Didn’t receive an alert for your comment. Yep. That’s the ddns i’m talking about. Even if the box doesn’t have a bridge mode, you can use a custom ddns on the router. Regardless the message you have on the gui.

  3. Great work! i was trying to get it done for a few months.

    I just did the part of arp -s but everytime router reboot, arp gone,then MAC.

    But i recently got an ASUS router, first thing i did is install MERLIN.

    JJFS is the solution as scripts works.

    I did not know that 8009 is the port from WAN instead of 9.

    In case you wanna know, i did not need to enable DMZ (i am quite cautious leaving ports open on the internet)

    Therefore, thanks man, i can turn on now my synology nas from WAN.

    Much appreciate!

    Saludos,
    Dante

    1. changing the external port is just for security, you can forward any external port to internal port 9 and it will work.
      because if someone knew that port 9 is open on your router he will know what are you using it for and can misuse this information to hack you.
      i’m not sure which part of this guide worked for me, but i got it done..thanks

      Some Extra reading:
      i’m on RT AC66U and could only wake up my pc from LAN, so i added the static ARP via SSH and that took care of the issue (maybe!!). my router also didnt lose the static ARP after a reboot, MAYBE because i use a static IP on the PC?
      i also downloaded the latest LAN driver and BIOS for my PC from asus as the default windows 10 driver didnt have all the features required for WOL.
      FYI, i use this PC for PLEX, HTPC, downloading stuff.

      Good work publisher!! thank you.

  4. Hi,

    Recently, I also came across the same issue of WoL with my Netgear router, I almost did what you did except the last step that installed a 3rd party firmware for startup script.

    I don’t feel comfortable with 3rd party stuff, so I am digging around a solution that even preparing to get a newer router that is able to handle this well.

    I finally hit with someone talking about Asus that offers an app called, aiCloud, it has a feature of WoL that is able to remote Login the router and wake up your devices.

    I’m not sure how well it works, so, have you tried? and tell me your experience about this? Would it wake up devices after having a long sleep? Thank you.

    1. Sorry I never used AI Cloud. But I’m almost sure AI cloud needs a DNS on the router, which is not possible in my case, as my modem-router does not have the “bridge” feature. I explain this in my article.

    2. FYI, aiClould Works but i find it to be slow to open, sync with your router then finally find your PC and wake it up…a lots of steps.

      i think the one line script which you can create yourself is pretty safe and nifty solution..but thats just me.

      the third party WOL apps from the playstore are very quick and they allow you to create a
      shortcut widget to a specific machine.

  5. Hey! I just wanted to say thank you very very much! I found so much usefull information in this article and all collected together! Thaanks to you I was able to setup everything so it just works without any problems

  6. I just wanted to thank you for this guide. I had been searching all over the internet for a working Wake on LAN/WAN walkthrough, and yours was easily the most accurate and detailed one that I cam across, and I finally got everything working perfectly.

  7. You made my day!
    Thanks a lot, your guide was perfect for me. Now it looks like, every thing works.
    For me its no for a nas. i want to stream games from my pc to my girlfriends tv. At weekend i will test if the tv part also works 🙂

    Cheers for your great work!

  8. Hello, thanks a lot for this guide.
    Everythings seem to work. Nevertheless, there is a problem left.
    The WOW doesn’t work any more when I reboot the modem-router.

    But if I reboot the modem-router, I need to switch on the NAS manually. After, I can use ds finder to switch it off, and after the WOW is working.

    Could you please help ?

    1. Hey Francis, yes if you shut down the NAS manually, it’s completely off and can’t receive the command. You have to switch it off through its web interface. Cheers.

  9. Hello Dave,
    Thanks for respond.
    By manually, I mean by web interface, sorry
    In your guide you say : “To make sure the test is correct, shut down the NAS, reboot the modem-router and reboot the rooter.

    If I shut down the NAS by web interface and reboot the rooter ONLY, the WOW is working.

    BUT, if I reboot the modem-router in addition, it doesn’t work any more.
    In this case, I need to switch on the NAS manually or by WOL.
    After, switch off the NAS by DS finder or web interface, and switch it on by WOW it ‘s ok.

    But you see, if there is a problem with the power supply of my home temporarely, the modem reboot automatically (so the router, and the NAS switch off), and it will be not possible to wow the NAS again.

    Cheers

    1. YESSSSSS !
      I replace my Synology DDNS by DDNS Afraid and it solves my problem !!!!
      Now, WOW is working when I shutdown NAS, and reboot modem and router.
      So many thanks for this guide, thanks Pierre and Dave.

  10. Hi
    I just wanted to thank you very much. Wake on Wan was driving me crazy the last couple days.
    I really appreciate your work.

    Thx

  11. Thanks so much. Perfect.
    Only problem i had: Don’t write arp -i br0 -s [IP, for example 192.168.1.254] [MAC address, for example FF:FF:FF:FF:FF:FF]
    You have to wirte arp -i br0 -s xxx.xxx.xxx.xxx yy:yy:yy:yy:yy:yy

    Now it works for me 🙂

  12. On my ASUS there is a tool for Wake On Lan in the Network tools, so you can wake up the Synology from there directly. I just natted a port to access the web interface of the Asus from the WAN

  13. I really appreciate this guide.
    After a couple weeks of trying to figure this out, I finally got to find some good info in this guide to make WOW (wake on wan) possible.
    They most important part is definitely “Persistent static ARP entry on the Asus router” and I finally managed to achieve it and works perfectly.
    Thank you once again for your time and sharing this info.

Leave a Reply to Dave Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

I blogged this

Social clickbaits