This little guide describes how to use the magic packet Wake On LAN (WOL) method to turn on your mythtvbox (or any box that supports WOL, it's independent of O/S). I'll also recommend a very light (146 k) that runs on Windows you can use to wakeup your mythbox from that environment.
Hardware Requirements
An ethernet card that supports WOL
A BIOS that allows wakeup events
I think most modern (post 2003 at least) MB's with integrated NICs and/or dedicated NICs (PCI, PCIE, etc.) support it.
Verify That Your Hardware Supports MagicPacket WOL and Configure It to Do So
Use ethtool supplied with R5.5 to query your NIC and see if WOL is indeed supported:
Code:
# ethtool eth0 | grep Wake-on
Supports Wake-on: pg
Wake-on: g
You're interested in the "Wake-on" variable which shows the modes that will trigger the wakeup event. As you can see, my D-Link DGE-530T is currently accepting Magic Packet which is what I'm used to using. I didn't need to enable it, this was the out-of-the-box state.
BTW, I'm sure you can use other method, but I have no experience doing it. Here are some other responses according to the man page:
Quote:
wol p|u|m|b|a|g|s|d...
Set Wake-on-LAN options. Not all devices support this. The
argument to this option is a string of characters specifying
which options to enable.
p Wake on phy activity
u Wake on unicast messages
m Wake on multicast messages
b Wake on broadcast messages
a Wake on ARP
g Wake on MagicPacket(tm)
s Enable SecureOn(tm) password for MagicPacket(tm)
d Disable (wake on nothing). This option clears all previous
options.
If you get a reply that the card supports option "g" but you do not see it in the "Wake-on: " field, you'll need to set it manually:
Code:
# ethtool -s eth0 wol g
My understanding is that the mode change doesn't survive a reboot. For a quick n' dirty way to do this, see
squiffy's post where in he suggests adding the following line to your .fluxbox/apps
Code:
[startup] {/usr/bin/ethtool -s eth0 wol g}
With that, you should be good to go. All you need the MAC address of the NIC you'll be using to wake the box. You can get it from the following command:
Code:
# ifconfig eth0 | grep HWaddr
eth0 Link encap:Ethernet HWaddr 00:0E:A3:10:A8:14
The MAC is the part after the "HWaddr" section. Make note of it.
BIOS ConfigurationYou BIOS may or may not require you to enable WOL or PME events. Look for these or similar wording under the hardware sectio, or power management section.
As an example, my aged A7N8X-VM requires a setting of "PME Resume" to enabled to trigger the wakeup.
Send a Magic Packet from Your Windows MachineThere are a number of
WOL programs to chose from. Some have GUIs, others do not. I'm partial,
wol which is freeware and very light.
The syntax is simple: wol MAC address
Open a windows command prompt and navigate to the directory containing wol.exe and issue (from my example):
Code:
>wol 00:0E:A3:10:A8:14
Waking up 00:0E:A3:10:A8:14...
That should do it. If the box doesn't wake-up, you may have to fiddle around with some other wakeup event switches in the BIOS.
You can also use wol.exe to wake machines OUTSIDE your LAN provided you are forwarding the correct port to the target machine. See the help file for wol for more options, but here is an example:
Code:
>wol -p 50000 -i 65.34.120.23 00:0E:A3:10:A8:14
In this example, we're using port 50000 to IP 65.34.120.23 and MAC address 00:0E:A3:10:A8:14. (The IP address is fictitious for obvious reasons.)
Windows Batch File ExampleI have a few machines on my LAN that can be turned on or awakened from S3 sleep states via this method as well as a machine elsewhere. Here is the batch file I use. Alter it to your liking:
Code:
@echo off
REM Define MAC and IPs
set mythtvmac=00:0E:A3:10:A8:14
set submythmac=00:13:0E:82:aa:10
set prettymac=00:0e:a6:70:b8:12
set greenmac=00:1a:92:56:7b:fd
set greenip=65.34.120.23
path=%path%;"R:\Utils\wol-0.6"
cls
echo Use this batch file to wake via WOL the following boxes
echo.
echo =================================
echo MYTHTV BOXES
echo =================================
echo M) Wake ONLY Mythtv
echo S) Wake ONLY Submyth
echo B) Wake Both Submyth AND Mythtv
echo =================================
echo OTHER BOXES
echo =================================
echo P) Pretty
echo G) Greenmachine
echo Q) Quit and take no action
choice /c msbpgq /m "Choose an option"
if errorlevel 6 goto end
if errorlevel 5 goto green
if errorlevel 4 goto pretty
if errorlevel 3 goto both
if errorlevel 2 goto submyth
if errorlevel 1 goto mythtv
:mythtv
echo.
echo Waking mythtv
wol.exe %mythtvmac%
echo DONE
goto end
:submyth
echo.
echo Waking submyth
wol.exe %submythmac%
echo DONE
goto end
:both
echo.
echo Waking mythtv
wol.exe %mythtvmac%
echo DONE!
echo Waiting 30 sec and then waking submyth
choice /d n /t 30
echo Waking submyth
wol.exe %submythmac%
echo DONE
goto end
:pretty
echo.
echo waking pretty
wol.exe %prettymac%
echo DONE
goto end
:greenmachine
echo.
echo waking greenmachine
wol.exe -p 50000 -i %greenip% %greenmac%
echo DONE
goto end
:end
Send a Magic Packet from Your LINUX MachineJust get etherwake and use it on the shell or better yet, in a script.
Code:
# apt-get install etherwake
BASH script exampleCode:
#!/bin/bash
myth=00:13:32:82:bb:3f
submyth=00:24:46:82:aa:70
pretty=01:0d:b2:70:b8:09
while [ "$input1" != quit ]; do
echo "Which PC to wake?"
echo "p) pretty"
echo "m) mythtv"
echo "s) submyth"
echo "b) wake mythtv, wait 40sec, then wake submyth"
echo "q) quit and take no action"
read input1
if [ $input1 == p ]; then
sudo /usr/sbin/etherwake -i eth1 -b $pretty
exit 1
fi
if [ $input1 == m ]; then
sudo /usr/sbin/etherwake -i eth1 -b $myth
exit 1
fi
if [ $input1 == s ]; then
sudo /usr/sbin/etherwake -i eth1 -b $submyth
exit 1
fi
if [ $input1 == b ]; then
sudo /usr/sbin/etherwake -i eth1 -b $myth
echo "myth sent, now waiting for 40sec then waking submyth"
sleep 40
sudo /usr/sbin/etherwake -i eth1 -b $submyth
exit 1
fi
if [ $input1 == Q ] || [ $input1 == q ]; then
echo "later!"
exit 1
fi
done
echo "this is the (quit) end!! c-ya!"