What's new

[help] WOL Script Wake Up Your Webserver

  • 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!

fun4stuff

Regular Contributor
I'm trying to follow the WOL script guide (https://github.com/RMerl/asuswrt-merlin/wiki/WOL-Script-Wake-Up-Your-Webserver-On-Internet-Traffic), so that when port 32400 is accessed (for plex), my htpc will turn on. It is not working though. I am able to turn computer via wake on lan (router's Network Tools - Wake on LAN and by manually sending a magic packet), so the problem isn't with my HTPC. Not sure what I am doing wrong..

My router: asus RT-N66U
Firmware: asus wrt-merlin 380.65

Any help would be much appreciated. Is there a log file I can look at to see what's going wrong? Thanks
 
Try changing the line in wake.sh from

$WOL -i $IFACE $MAC

to

$WOL -b -i $IFACE $MAC

Thanks for the reply. It still doesn't seem to work.

Just to make sure I'm not missing something stupid: This is my wake.sh file (http://pastebin.com/3geZtK3f). 192.168.1.50 is the local ip of my HTPC that I want to wake up. 32400 is plex's port.
00:25:22:21:B6:64 is the HTPC's mac address.
 
So, maybe I am not understanding how this script should work.

So when I do not specify a port in the wake.sh and just run a port scanner, the HTPC does wake up after a minute or two. But when I try random individual ports (e.g. myipaddress:####), nothing happens.
 
The script you used (the second one in the wiki entry) will only wake on port 32400, not any random port.
 
The script you used (the second one in the wiki entry) will only wake on port 32400, not any random port.

Yeah, I meant I changed it to and used the first one to see if any port would work. The only way I can get it to work is by using the first script and running a port scanner.
 
Yeah, I meant I changed it to and used the first one to see if any port would work. The only way I can get it to work is by using the first script and running a port scanner.


when i manually run the ether-wake command from within putty, i am able to wake the htpc up. hmm
 
Your script is generating a log file. Open a cmd window and enter

tail -f /var/log/ether-wake.log

then switch to your browser and run your test......you should see entries in the log scrolling which reflect your test.
 
Your script is generating a log file. Open a cmd window and enter

tail -f /var/log/ether-wake.log

then switch to your browser and run your test......you should see entries in the log scrolling which reflect your test.

Thanks for the help. I ended up coming across a different script to do the same thing a different way that worked ... after I made one change. Here it is for reference for anyone else that comes across this:

http://www.thiemo.ch/plex-wake-on-lan.html

But you have to change
/usr/bin/ether-wake -i br0 $MAC

to

/usr/sbin/ether-wake -i br0 $MAC
 
But you have to change
/usr/bin/ether-wake -i br0 $MAC

to

/usr/sbin/ether-wake -i br0 $MAC
Interesting.....thanks for reporting back.

@RMerlin - It seems this location change was introduced with the change to busybox 1.25.1 (release/src/router/busybox/include/applets.src.h). In fact, from a build standpoint, a lot of applets were potentially moved....but so far ether-wake and arping are the only ones that I've found that seem to be used (at least in my fork). Thoughts on how to handle the backward compatibility, if at all?
 
If people absolutely need to work with different Busybox releases, then I'd recommend allowing the shell locate it in the search path (i.e. don't specify the full path).
 
Hi,

What is the right syntax if I use different ports for LAN and WAN?
PORTS="(32400, 32500)" or what?

Original script:
# WAN and LAN ports of the plex app (in my case it's both 32400)
PORTS="(32400)"
 
Hi,

What is the right syntax if I use different ports for LAN and WAN?
PORTS="(32400, 32500)" or what?

Original script:
# WAN and LAN ports of the plex app (in my case it's both 32400)
PORTS="(32400)"
Did you ever figure it out? Did the script work for you? The script seemed broken when I tried it...

Edit: nevermind. Just realized you are referencing the second script link that I posted. Tgat one is working for me, although I think something else may be triggering my port as my htpc keeps randomly waking up. Anyway, sorry I do not know the answer to your question.
 
Last edited:
Yes, it's working with same port to wan, lan. (run plex as service is required)
Although I'm still waiting for correct answer for syntax.
 
Yes, it's working with same port to wan, lan. (run plex as service is required)
Although I'm still waiting for correct answer for syntax.

Multiple ports?
Code:
PORTS="32400|32500"

NEW=`dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /(DPT=)'"$PORTS"'/ {print }' | tail -1`
 
I'm trying to follow the WOL script guide (https://github.com/RMerl/asuswrt-merlin/wiki/WOL-Script-Wake-Up-Your-Webserver-On-Internet-Traffic), so that when port 32400 is accessed (for plex), my htpc will turn on. It is not working though. I am able to turn computer via wake on lan (router's Network Tools - Wake on LAN and by manually sending a magic packet), so the problem isn't with my HTPC. Not sure what I am doing wrong..

My router: asus RT-N66U
Firmware: asus wrt-merlin 380.65

Any help would be much appreciated. Is there a log file I can look at to see what's going wrong? Thanks

I'm surprised no one has fixed the script posted on github.com yet...
 
Wondering if someone can help me. I'm trying to get this working (using the second technique: http://www.thiemo.ch/plex-wake-on-lan.html) but for the life of me I can't even get it to log anything. I'm a newb at this but I'm trying to learn.

I'm trying to do some basic debugging to work out what's going wrong but not even the command below is working:

Code:
iptables -I FORWARD -d 192.168.1.56 -j LOG --log-prefix "FORWARD TO SANCHEZ "

I have a Plex server (called Sanchez) on my LAN and the IP address is 192.168.1.56 but nothing sent from within the LAN is ever logged. The only traffic that comes up on the log is from outside of the LAN. How can this be? I can ping it fine from any device on my LAN.

Could someone please give me a few tips so that I can work out how to resolve this? Spent 4 hours on it so far but no dice...
 
nothing sent from within the LAN is ever logged. The only traffic that comes up on the log is from outside of the LAN. How can this be? I can ping it fine from any device on my LAN.
LAN-LAN traffic is switched, not routed. That traffic never gets processed by iptables.
 
Thanks john! Would you happen to know how one would log LAN traffic to a specific IP on a specific port?
You'd have to use whatever logging facilities are available on the sending or receiving machines. Alternatively you could "sniff" the LAN traffic using something like Wireshark.
 

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

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