Hi all!
Im trying to enable WOL on plex-traffic using a DD-WRT router but things are not working for me...
Ive been following numerous tutorials and guides so im not sure exactly what ive done and havent done, but the situation is as follows:
I upgraded DD-WRT to latest stable version for my device (asus rt-n13u b1); V3.0-r31221 std, configured USB storage, installed optware and enabled logging, set log level to HIGH and enabled logging for both accepted, dropped and rejected.
The server is a windows 10 box, with WOL functioning (tested and confirmed working) and latest version of Plex Media Center.
The clients for this test is my laptop (macbook, 10.10.5 (yosemite) using the web app) and my android phone (v6.0), using the plex media player app.
The script im using is included at the bottom of this post.
Now, i do get entries popping up on the URL: http://192.168.1.1/user/wol.html (WOL-script log) and i do get sporadic entries there, but not every time i try to access my server.
I digged a bit and came across the system log on the URL: http://192.168.1.1/Syslog.asp and from what i gathered, it appears as if plex uses a number of ports, not only the default 32400.
My system logs mention 32412, 32414 and probably a few others that i havent found yet..
So my big question is; what ports are actually in use when the client (android app and/or web app) tries to connect to the server using default port?
The almost as big question would be; how can one edit the shellscript (found below) to incorporate more than one PORT?
I imagine that something like "if=PORT>PORTMIN && <PORTMAX" instead of "PORT=".
However, i am no programmer nor have i any skills with scripts so any and all tips would be greatly appreciated!
`#!/bin/sh
Enable JFFS2 and place script in /jffs/ then run on startup in web interface.
You can check the log from http://192.168.1.1/user/wol.html
INTERVAL=1
PINGTIME=1
OLD=""
PORT=32400
WOLPORT=9
TARGET=192.168.1.25
BROADCAST=192.168.1.255
MAC=12:34:56:78:90 # i have used correct mac, just anonymizing my script..
WOL=/usr/sbin/wol
LOGFILE="/tmp/www/wol.html"
echo "" > $LOGFILE
echo "["date
"] AUTO WOL Script started.
" >> $LOGFILE
while sleep $INTERVAL;do
NEW=dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/ {print }' | tail -1
SRC=dmesg | awk -F'[=| ]' '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/ {print $7}' | tail -1
LINE=dmesg | awk '/ACCEPT/ && /DST='"$TARGET"'/ && /DPT='"$PORT"'/'
if [ "$NEW" != "" -a "$NEW" != "$OLD" ]; then
if ping -qw $PINGTIME $TARGET >/dev/null; then
echo "NOWAKE $TARGET was accessed by $SRC and is already alive at" date
"
">> $LOGFILE
else
echo "WAKE $SRC causes wake on lan at" date
"
">> $LOGFILE
$WOL -i $BROADCAST -p $WOLPORT $MAC >> $LOGFILE
echo "
" >> $LOGFILE
sleep 1
fi
OLD=$NEW
fi
done`