View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 9 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Sun Aug 03, 2008 5:44 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
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 Configuration
You 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 Machine
There 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 Example
I 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 Machine

Just get etherwake and use it on the shell or better yet, in a script.

Code:
# apt-get install etherwake


BASH script example

Code:
#!/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!"

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Last edited by graysky on Sat Feb 07, 2009 6:34 pm, edited 4 times in total.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 03, 2008 10:21 pm 
Offline
Joined: Thu Feb 09, 2006 7:18 pm
Posts: 112
I have to say graysky, these guides you've been writing have been really helpful. I don't know why, but every time I try to play around with the more advanced features in 5.5 I find you've just written a guide for it...

I was starting to get frustrated that wol wouldn't work, and it turns out that it was disabled in the driver, and the commands you listed got it working.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 2:20 am 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
jigawho wrote:
I was starting to get frustrated that wol wouldn't work, and it turns out that it was disabled in the driver, and the commands you listed got it working.


Glad to hear it! Writing up what I learn is my way of giving back to the community. I love the entire concept of open-source software, and open communities like this. These forums are the best :)

Enjoy!

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 10:29 am 
Offline
Joined: Thu Feb 09, 2006 7:18 pm
Posts: 112
hmm, spoke too soon. I tried adding the code to .fluxbox/apps but it's not setting the value on reboot, it comes up as disabled. Any ideas? Does there need to be a sudo call in there?

Edit:
Not sure why, but the .fluxbox/apps method didn't work for me. Instead I used the startup script method detailed here:
http://ubuntuforums.org/showthread.php?t=234588

It appears to work, but if anyone has a method they recommend (especially one that will survive an upgrade or at least have a minimum of setup) please post it.


Last edited by jigawho on Mon Aug 04, 2008 11:08 am, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 11:03 am 
Offline
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location: Virginia, USA
Which .fluxbox/apps did you add it to? It should be added to /home/mythtv/.fluxbox/apps ...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 12:50 pm 
Offline
Joined: Thu Feb 09, 2006 7:18 pm
Posts: 112
I added it to /home/mythtv/.fluxbox/apps and the code I added is
Code:
[startup] {/usr/sbin/ethtool -s eth0 wol g}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 1:30 pm 
Offline
Joined: Wed Dec 10, 2003 8:31 pm
Posts: 1996
Location: /dev/null
jigawho wrote:
I added it to /home/mythtv/.fluxbox/apps and the code I added is
Code:
[startup] {/usr/sbin/ethtool -s eth0 wol g}


Interesting... I haven't actually verified that this method works... I suspect it's not working because ethtool requires root to operate and that the fluxbox/apps launches under the mythtv user. I dunno if adding ethtool to your /etc/sudoers will work or not. Perhaps the script method is best.

_________________
Retired KM user (R4 - R6.04); friend to LH users.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 04, 2008 5:01 pm 
Offline
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location: Virginia, USA
Is that the type of thing that could be added to the end of bootmisc.sh?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 31, 2008 10:55 am 
Offline
Joined: Thu Feb 09, 2006 7:18 pm
Posts: 112
To answer your question Ceenvee703, putting the command into /etc/init.d/bootmisc.sh seems to work, and would probably be a better solution than having it in the .fluxbox/apps file, since it's a system-wide hardware setting.

_________________
MBE:AMD Athlon 64 3000+ (venice),MSI K8MM-v Motherboard (via chip based), PVR-500, Chaintech av710, IDE Hard drive
SBE:P4 3Ghz, Asus P4G800, PVR-250, IDE Hard Drive


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu