What's new

Wake on Lan for more then one device

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

tasar

Occasional Visitor
HI,

i want to use another App for WOL and Merlin has made a script for this:
https://github.com/RMerl/asuswrt-merlin/wiki/WOL-Script-Wake-Up-Your-Webserver-On-Internet-Traffic

This works fine but only for one device but i have more then on PC that i want to wake via WOL.

So i found a script that worked fine for every device in your Network. It based on Merlins script with a few changes:
1. the "services-start" :
-----------------------------------------------------------------------
#!/bin/sh

#script for sending WOL packets when traffic to specified ip's
sh /jffs/scripts/wake.sh&
arp -i br0 -s 192.168.1.254 FF:FF:FF:FF:FF:FF
---------------------------------------------------------------------
Change the red marked to your IP.

2. "wake.sh":
-------------------------------------------------------------------------
#!/bin/sh

INTERVAL=5
NUMP=1
OLD=""
TARGET=192.168.1.254
IFACE=br0
MAC=FF:FF:FF:FF:FF:FF
WOL=/usr/bin/ether-wake
LOGFILE="/var/log/ether-wake.log"

while sleep $INTERVAL;do
NEW=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ {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

-----------------------------------------------------------------------

Also, change the red marked when your is different.

All other steps like Merlin´s WOL manual.

The last thing is, make a Port Forwarding: Forward Port 9 to 192.168.1.254 UDP

Now i can use any other WOL App , i use this for Android: https://play.google.com/store/apps/details?id=com.benfinnigan.wol and it worked fine and is much faster then the AiCloud App.


Hope this is usefull for some one and sorry for my bad english...
 
Last edited:
So I think this is exactly what I need, except I am having trouble getting it to work. I want to be able to send the Magic WoL Packet over the internet on my phone to any MAC address on my LAN, without having to pre-configure each individual MAC address for each device I want wakable.

I had something similar to this running on my last router with Shibby Tomato by basically using this as a guide. It worked well.

Here are my settings & steps for what I've done in Asuswrt Merlin:

1. Created /jffs/scripts/services-start:
Code:
#!/bin/sh

#script for sending WOL packets when traffic to specified ip's
sh /jffs/scripts/wake.sh&
arp -i br0 -s 192.168.1.254 FF:FF:FF:FF:FF:FF

2. Created /jffs/scripts/wake.sh:
Code:
#!/bin/sh

INTERVAL=5
NUMP=1
OLD=""
TARGET=192.168.1.254
IFACE=br0
MAC=FF:FF:FF:FF:FF:FF
WOL=/usr/bin/ether-wake
LOGFILE="/var/log/ether-wake.log"

while sleep $INTERVAL;do
NEW=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ {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

3. Both files chmod'd with these commands:
chmod +x /jffs/scripts/wake.sh
chmod +x /jffs/scripts/services-start

4. Navigated to Firewall -> General -> Logged packet types -> changed to Accepted

5. Created the following port forward:
Name: Wake on LAN
Port Range: 9
Local IP: 192.168.1.254
Local Port: 9
Protocol: UDP

So does anything look blatantly wrong here? I did not change the IP in red in tasar's original post as I didn't think I needed to, though this could be part of the problem. I don't know what I would change it to, though.
 
And here is what I get in my system log after one attempt of waking machine 192.168.1.22 from 192.168.1.100

Code:
Jan 25 19:01:05 kernel: ACCEPT IN=br0 OUT=br0 SRC=192.168.1.100 DST=192.168.1.254 LEN=130 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=UDP SPT=42483 DPT=9 LEN=110 MARK=0x448a0001
Jan 25 19:01:05 kernel: ACCEPT IN=br0 OUT=br0 SRC=192.168.1.100 DST=192.168.1.254 LEN=130 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=UDP SPT=60756 DPT=9 LEN=110 MARK=0x44980001
Jan 25 19:01:05 kernel: ACCEPT IN=br0 OUT=br0 SRC=192.168.1.100 DST=192.168.1.254 LEN=130 TOS=0x00 PREC=0x00 TTL=63 ID=0 DF PROTO=UDP SPT=33096 DPT=9 LEN=110 MARK=0x1
 
Last edited:
Hi,
i willl answer you on this way. The only thing that is different on my Asus, i have portforwarding for port 9 as "both" in protocol" but i think that makes no different with"udp".
how will you wake up your PC? I make it on my Android phone with an app https://play.google.com/store/apps/details?id=com.benfinnigan.wol and use the settings you can see in screenshot and it work fine.
 

Attachments

  • wol.jpg
    wol.jpg
    39.7 KB · Views: 523
Last edited:
Hi,
i willl answer you on this way. The only thing that is different on my Asus, i have portforwarding for port 9 as "both" in protocol".
how will you wake up your PC? I make it on my Android phone with an app https://play.google.com/store/apps/details?id=com.benfinnigan.wol and use the settings you can see in screenshot and it work fine.

Hi tasar, thanks for the response. I will try setting my port 9 forward to both TCP & UDP. Also, I use this app, which looks functionally the same as the one you use. I did notice in your app settings you have a "SecureOn" code of the 192.168.1.254 mac address (FF:FF:FF:FF:FF:FF). I also have that field, but had nothing filled in. I did not use this field in the past, but my app also has the field so I just filled it in. I'll see if this combination helps at all.

Thanks again for the response. I'll report back if I am having any luck.
 
Strong recommendation to not open WOL publicly, it's very easy for someone to screw around with you once they sniff and capture the MAC address, why not just make the web gui available over ssl and use the WOL daemon built into MerlinWRT?
 
Hey tasar, no dice. Are you able to post screenshots of any config related to your WOL setup (of course blacking out sensitive info). I'd really like to get this working and I don't know what I've done wrong. Thank you
 
I at least got it working with 1 machine now using the original script you've linked to. I was spinning my wheels in the sand for a while because I realized since my Windows 7 machine upgraded to Windows 10, I hadn't tested the WoL, and turns out there was a problem with the Windows 10 ethernet driver that screws up WoL. I updated the driver to the latest and greatest and that resolved itself. I wasn't even able to start the computer with the WoL interface on the router. Now I can, and start it with my phone from the WAN, which is what I want. I just want to be able to do it with the 192.168.1.254 FF:FF:FF:FF:FF:FF method.
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top