Wake on LAN (WOL) for Windows 10 PLEX Media Server when in sleep mode. Is it possible?

Nice ! Thanks for sharing !

This may be the wrong place to post this. However, my server has been waking up when clients connect. I don’t know why or what did it, however, I know that it has something to do with my router. I have a Linksys ea4500 and this worked flawlessly with my PC going to sleep, and waking up only when someone tries to connect. (inside and outside LAN) So, I’ve been wanting to replace my router but not loose this feature… but so far three routers I’ve tried break this. What is it about this router that allow this to work? Anyone else have this experience with some routers?

Hello Hahnstech,
The script on this post is based on tcpdump. There is another script (in which I based to do this) that you can try to run on these other routers you mentioned.

My server after a format and clean install of Windows 10 Pro was no longer waking up when in sleep mode when opening a Plex client.

I finally tracked the culprit down. Under Power settings for Windows, go to the ā€œChoose what the power buttons doā€ or whatever its called, on the left hand side. Click the ā€œChange settings that are currently unavailableā€ link and some checkboxes appear. I unchecked ā€œTurn on fast start upā€.

I also made sure that the network adapter power settings allowed wake on activity and not just magic packet.

And now everything works great. When the server is asleep, starting up a Plex client or starting an RDP connect will wake it up! Fantastic!


1 Like

@Mikesamsondesign said:
I recently built a new media server and signed up for a PLEX Pass. I love everything about it except not being able to wake up (WOL) my server from sleep mode using a magic packet. I do not want my media server running 24/7 for hardware longevity purposes, energy efficiency and I would like the server to run quieter when not in use (located in my living room). I also understand I can simply download a ā€œWake on Lanā€ app which would alleviate my problem but add an unnecessary step when trying to access my media. Also, I would like to eventually share my library with friends and family, thus not having them download apps to wake my server.

I’ve spent the past few days trying to diagnose this problem with no positive result. I’ve read online that this isn’t possible while other posts state that it is. I think this is a necessary feature to include.

What I’ve done to troubleshoot:

  • Ensured my WOL settings are enabled in BIOS.
  • Ensured my WOL setting are all turned on under the ā€œPower Managementā€ tab for my Realtek PCIe GBE Family Controller driver.
  • Ensured that ā€œWake on Magic Packetā€ is enabled under the ā€œAdvancedā€ tab for my ethernet driver.
  • I’ve successfully woken my media server by using ā€œWake on LANā€ software on both my Android phone and separate laptop.

So is it possible or not? If not, is this being worked on for a future release? It would be nice to get a confirmation of this from an actual PLEX employee.

Important System Notes:

  • Windows 10 (x64)
  • 16gb RAM
  • OS running off of 256GB SSD
  • Direct LAN connection
  • Nighthawk R6400 wirelss router
  • ARRIS SURFboard SB6183 DOCSIS 3.0 Cable Modem
  • Xfinity Broadband (90mb down, 11mb up)

Thank you in advance for any insight on this issue.

There is a Windows 10 Power Setting that seems to do this. For whatever scheme you choose, click Additional Power Settings, Change Plan Settings, Change Advance Power Settings, Multimedia Settings, When Sharing Media. Then select, Allow the computer to enter Away Mode. Since I did this, Plex has been available on Roku and Firestick, regardless of the sleep mode.

Using @Zx4161 process worked great for me. Having a bit of trouble getting dshutdown to start automatically after a full reboot, but I’m sure I’ll get that figured out with a little more effort. Main issue I’m posting about is how to get a Win10 PC to wake for a scheduled DVR recording. Currently, it appears that Plex can’t do this by itself. Any ideas?

@stringpark You can create a batch script that is arbitrary and does nothing and have task scheduler trigger the batch script to wake itself up to run it. If its a regularly timed thing. In task scheduler set the trigger for on a schedule and to repeat every day or so. Then set the random batch script to be the program triggered. The batch script doesn’t have to do anything, its just there to let the computer wake itself to run it.

@stringpark as for dshutdown restarting after full reboot. You can create another task to start dshut down when logging in or at startup. That way everytime you log in it’ll start it for you. I usually use log in and set it for a delay of about 30 sec or so to give the system time to boot. Hope this helps! Been awhile since I’ve been on the forums

Hey Guys this is my first post ever.

So I have a new router DSL-G2562DG D-LINK it isn’t supported according to this list https://wiki.dd-wrt.com/wiki/index.php/Supported_Devices#D-Link
Also to be honest i’m not the hottest coder… I’m a bit noob but trying hard to learn.

Can i get an official answer by a plex developer is WOL in the pipe line? is it something we can hang on for ? Or it is not ever coming?
I think i speak for allot of the guys here, we love Plex but the transcoding eats power so we want powerful machines to do the job right, but then also want to save on our power bill. Can’t really have both. WOL is something that could save the day here.
Please develop it! PLEASE! and add it a premium pass i would totally pay for it.

So this may or may not work for everyone, but I have a low-tech method of keeping my system off when not streaming.

Use something like a Wemo power plug for your system. You can turn on your system remotely (just configure the computer’s bios to turn on when it gets A/C power to the PSU). Stream to your heart’s content.

The plex server is at least smart enough to keep the system from sleeping while streaming. When you’re done streaming, it’ll go into sleep mode. (if your system is configured to do so)

Any advance on wake on lan with magic packet?

I can wake server with Kodi when calling for media to stream but not working with Plex.

Ok. I FINALLY figured it out for my system.

It seems like the culprit for mine was maybe an update to tcpdump? The parameter -P would throw an error when I tried in console, also I can’t seem to get it to work on a local IP.

My tcpdump line looks like this now (without the host ip and eliminating -P):

tcpdump -q -n -i any -p -K -l -O -U 'dst port '$PORT'' 2>/dev/null | while read NEW ; do

Pretty much everything else is the same.

Hope this helps someone

Edit: had to change the code line to eliminate ā€˜-Q out’, that param definitely was hanging it up. should be working now

I have a solution: as a server let your connection ALWAYS up, and allow you computer to sleep.

When you want to reach your Plex Server, the Plex Player asks plex infrastructures to join your server on port 32400. The is a classic new tcp connexion, so it’s start with normal SYN packet. There is NO Magic Packet sent, Wake on Lan is not involved, Plex doesn’t rely on WoL. Second problem, when your computer is deeply sleeping for hours, the network card is off (the switch could be involved) and no packet could wake it, magic or not.

The solution :
1 - put a redirection of 32400 port on your LAN server static IP or let uPnP works.
2 - do NOT tick the ā€œonly allow a magic packet to wake the computerā€ on your network adapter. It’s not related to WoL magic. But you need a SYN packet to revive it. Do like in this post Wake on LAN (WOL) for Windows 10 PLEX Media Server when in sleep mode. Is it possible?
3 - Owners of Windows 10 HOME (PRO jump to 4) have to install the gpedit.msc, follow this solution https://www.itechtics.com/easily-enable-group-policy-editor-gpedit-msc-in-windows-10-home-edition/
4 - change local policy to let your network adapter active when your computer is sleeping according to this link https://www.howto-connect.com/keep-internet-connection-active-when-in-sleep-mode-windows-10/
5 - in power settings, advanced…PCI Express tab, you may have to choose OFF for Link State Power Management setting.

PS sorry for my english i’m not a native speaker of Shakespeare

Hi guys,
I have just came across this thread, and a little while back I made the below guide to configuring everything properly!

Enjoy!

Hi, i cant find the script need for the router, that youve uploaded as a text file. I need to do this as ive just constructed a power hungry HTPC!

Sure thing, my post got deleted that had the scripts when plex moved to this new forum board.

For routers with swtiches:

#!/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=Your IP address
BROADCAST=192.168.1.255
MAC=Your mac address
WOL=/usr/sbin/wol
LOGFILE="/tmp/www/wol.html"

echo "<meta http-equiv=\"refresh\" content=\"10\">" > $LOGFILE
echo "["`date`"] AUTO WOL Script started. <br>" >> $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` "<br>">> $LOGFILE    
   else                                                                                        
      echo "WAKE $SRC causes wake on lan at" `date` "<br>">> $LOGFILE                         
      $WOL -i $BROADCAST -p $WOLPORT $MAC >> $LOGFILE                                             
      echo "<br>" >> $LOGFILE                                                                  
      sleep 1                                                                                 
   fi                                                                                          
   OLD=$NEW                                                                                  
fi                                                                                                                                                                               
done

For those without switches:

#!/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=2
PINGTIME=1
OLD_TIME=""
PORT=32400
WOLPORT=9
TARGET=Your IP address
BROADCAST=192.168.1.255
MAC=Your mac address
WOL=/usr/sbin/wol
LOGFILE="/tmp/www/wol.html"
# Never change LOGLINESTOSTORE to under 100. It will create pretty much a loop on the cleanup log procedure
LOGLINESTOSTORE=10
PURGECOUNT=0

echo "<meta http-equiv=\"refresh\" content=\"10\">" > $LOGFILE
echo "["`date`"] AUTO WOL Script started. <br>" >> $LOGFILE
echo "For server: $TARGET:$PORT <br>" >> $LOGFILE
echo "WOL for MAC: $MAC on port $WOLPORT <br> <br>" >> $LOGFILE

tcpdump -q -n -i any -p -P out -K -l -O -U 'dst host '$TARGET' and dst port '$PORT'' 2>/dev/null | while read NEW ; do
  # Get the line in seconds, to minimize the number of processed commands.
  NEW_TIME=`echo $NEW | awk -F'.' '{print $1}'`
  if [ "$NEW_TIME" != "$OLD_TIME" ]; then
        # Get the source IP for logging
        SRC=`echo $NEW | awk -F'[.| ]' '{print $4"."$5"."$6"."$7}'`
        # If box is alive (responding to ping)
    if ping -qw $PINGTIME $TARGET >/dev/null; then
       echo "[`date`] NOWAKE - $TARGET accessed by $SRC <br>">> $LOGFILE
       #touch /dev/null
    else
       echo "[`date`] _WAKE_ - $TARGET accessed by $SRC <br>">> $LOGFILE
       $WOL -i $BROADCAST -p $WOLPORT $MAC >> $LOGFILE
    fi
        OLD_TIME=$NEW_TIME
        # Cleanup log file procedure, keeping the header and the last 10 last WAKE log lines
        if [ "`wc -l $LOGFILE | awk -F'[ ]' '{print $1}'`" -gt "$LOGLINESTOSTORE" ]; then
                head -n 4 $LOGFILE >  /tmp/www/wol.tmp
                PURGECOUNT=$((PURGECOUNT+1))
                echo "Log File purged $PURGECOUNT times, last one at $NEW_TIME <br> " >> /tmp/www/wol.tmp
                grep _WAKE_ $LOGFILE | tail -n 10 >> /tmp/www/wol.tmp
                mv  /tmp/www/wol.tmp $LOGFILE
                echo "<br>" >> $LOGFILE
        fi
    sleep $INTERVAL
  fi
done 

Thanks very much for that, Im sorry for the delay in reply but the notification mail went to spam and ive only just found the mail.

No problem, takes me awhile to get back to the forum as well. Haven’t really been active on here

I have an Asus router that allows me to login via SSH and edit files. Does anyone know how I would create this script and make it run? I’ve created a file called plex_wol.sh in the /jffs/ directory, but I’m not sure what else would need to be done. I appreciate any help! Thanks!