1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

Issues trying to figure out Wake On Wan

Discussion in 'Asuswrt-Merlin' started by Crymn, Oct 18, 2018.

  1. Crymn

    Crymn New Around Here

    Joined:
    Oct 18, 2018
    Messages:
    2
    So I'm trying to figure out how to configure my Wake On Lan over Internet (I call it Wake On Wan not sure if this is correct) and I'm running into some problems.

    I have a RT-AC87U running in AP mode, which I think might be the problem to some of these issues.
    It might be good to know that a few days ago I didn't really know anything about this stuff.

    So first I tried to enable my router access from Wan so I could send a magic packet from my router.
    After googling some about this I found out it was a stupid idea.

    Then I found this thread:
    https://www.snbforums.com/threads/w...an-a-computer-using-script.29365/#post-278076

    So I put this:

    #!/bin/sh
    /sbin/arp -s 192.168.178.14 XX:4D:54:50:EC:XX

    in the services-start script, I confirmed the script to be working as intented, but sadly this didn't work.
    I think it might have to do with the fact that I forward my ports on my modem and have my router in AP mode.

    So then I moved on the find another way to do it, seeing how I prefer to use my modem for my forwarding, because my modem can only be put in bridge mode if I contact my ISP.

    On the same thread as I linked before I found a scripts that scans for activity on any (or specific) port(s).
    1 script from an user in the thread, and other one from script on github linked in the thread:
    https://github.com/RMerl/asuswrt-merlin/wiki/WOL-Script-Wake-Up-Your-Webserver-On-Internet-Traffic

    I tried both of them but none of them seemed to work. I confirmed them starting by adding "touch /tmp/000wanstarted" to the scripts as said in the Asuswrt-Merlin wiki

    This is the current setup that I have:
    ------------------------
    services-start:

    #!/bin/sh

    sleep 1m

    sh /jffs/scripts/wake.sh&
    sh /jffs/scripts/arp.sh&
    ------------------------
    wake.sh:

    #!/bin/sh

    touch /tmp/000wanstarted
    /usr/bin/logger -t START_$(basename $0) "started [[email protected]]"
    INTERVAL=5
    NUMP=3
    OLD=""
    TARGET=192.168.178.14
    PORT=3389
    IFACE=br0
    MAC=XX:4D:54:50:EC:XX
    WOL=/usr/sbin/ether-wake
    LOGFILE="/var/log/ether-wake.log"

    while sleep $INTERVAL;do
    NEW=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/ {print }' | tail -1`
    SRC=`echo $NEW | awk -F'[=| ]' '{print $8}'`
    DPORT=`echo $NEW | awk -F'[=| ]' '{print $27}'`
    PROTO=`echo $NEW | awk -F'[=| ]' '{print $23}'`

    if [ "$NEW" != "" -a "$NEW" != "$OLD" ]; then
    if ! ping -qc $NUMP $TARGET >/dev/null; then
    # echo "NOWAKE $TARGET was accessed by $SRC, port $DPORT, protocol $PROTO and is already alive at" `date`>> $LOGFILE
    # else
    echo "WAKE $TARGET requested by $SRC, port $DPORT, protocol $PROTO at" `date`>> $LOGFILE
    $WOL -i $IFACE $MAC
    sleep 5
    fi
    OLD=$NEW
    fi
    done
    /usr/bin/logger -t STOP_$(basename $0) "return code $?"
    -----------------------
    arp.sh:

    #!/bin/sh

    /sbin/arp -s 192.168.178.14 2C:4D:54:50:EC:10
    touch /tmp/001wanstarted
    -----------------------
    The way I checked to see if the scripts work was to use this site: https://www.depicus.com/wake-on-lan/woli
    or try to RDP into them if I used the port 3389

    I have tried forwarding port 7 and 9 on my PC's IP (forwarded in my modem)
    I have tried forwarding port 7 and 9 on my routers IP 192.168.178.17 (I dont know why I set the ip to .17) (forwarded in my modem)

    I tried running port scans because in the thread mentioned they said that should also work.
    And I tested all those ports and configurations but none of them seem to work.

    Now I think this might have to do with the fact that I am running my router in AP mode and everytime I run a port scan or send a magic packet it somehow doesn't get past my modem to activate the script on my router.

    I have also checked running: /usr/sbin/ether-wake -i br0 XX:4D:54:50:EC:XX via an SSH client on my phone while my PC was off, this worked.

    I know this is kind of a long post but I wanted you guys to know what kind of things I've already tried.

    If any of you have any tips or ideas it would be greatly appreciated.
    Thanks
     
  2. Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!
  3. ColinTaylor

    ColinTaylor Part of the Furniture

    Joined:
    Mar 31, 2014
    Messages:
    6,749
    Location:
    UK
    You are correct in your assumption that neither of those techniques worked because the RT-AC87U is just an access point not a router.

    Adding a static arp entry to your router by itself achieves very little. What you can do is probably going to be limited by the functionality of your router (not the RT-AC87U).
     
  4. Crymn

    Crymn New Around Here

    Joined:
    Oct 18, 2018
    Messages:
    2
    Thanks for the reply Colin,
    So the smartest thing for me to do would be to put the router that I currently use for port forwarding and stuff in bridge mode and let the RT-AC87U handel all that, correct?
     
Please support SNBForums! Just click on this link before you buy something from Amazon and we'll get a small commission on anything you buy. Thanks!