From MythTV Official Wiki
Revision as of 09:37, 10 September 2010 by Henk Poley (Talk | contribs)

Jump to: navigation, search

If you have a network card that supports wake-on-lan (wol), you can powerup your mythbox by sending it a 'magic packet' over the network. Here's what i did (i use an Epia M10k with Fedore Core 4):

Setting up

First, find out whether your network card supports wol:

# ethtool eth0
Settings for eth0:
       Supported ports: [ TP MII ]
       Supported link modes:   10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
       Supports auto-negotiation: Yes
       Advertised link modes:  10baseT/Half 10baseT/Full
                               100baseT/Half 100baseT/Full
       Advertised auto-negotiation: Yes
       Speed: 100Mb/s
       Duplex: Full
       Port: MII
       PHYAD: 1
       Transceiver: internal
       Auto-negotiation: on
       Supports Wake-on: pumbg
       Wake-on: d
       Current message level: 0x00000001 (1)
       Link detected: yes

The 'g' in Supports Wake-on: pumbg indicates that wake-on-lan by using a 'magic packet' is indeed supported. Next, you need to make sure that wake-on-lan support is enabled in the BIOS (although, this does not seem to be necessary for my motherboard). In addition, you need to tell your network card to enable wake-on-lan:

# ethtool -s eth0 wol g

When you run `ethtool eth0` again you will see that "Wake-on: d" (disable; wake on nothing) has changed to "g" (wake on magic packet)

Ubuntu 9.10 & 10.04

To make this setting permanent edit `/etc/network/interfaces`, in the 'auto eth0' segment add at the end:

ethernet-wol g

Other Linux

Since after rebooting Wake-on will be reset, you might what to add it to /etc/rc.local:

# vi /etc/rc.local

Add 'ethtool -s eth0 wol g' above the 'exit 0' line

Now turn off you mythbox and send it a 'magic packet'.

Sending 'magic packet' to wake up your mythbox

You will need a wake-on-lan client to send 'magic packets' over your network. First, determine the MAC address of the machine you what to power on:

# ifconfig

Turn off your mythbox and from another computer execute the following command (replacing the MAC address with the one you just found). I used a wake-on-lan client from Sourceforge.

$ wol 00:4F:49:07:0B:5F

If all went well, your mythbox will boot up now! There are other clients for Windows and Mac OS X as well.

Via Python one-liner

Maybe not as clean, but works on all systems where Python is available, replace the '\x00\x1A\x92\x9D\x69\x85' with the numbers of your backend's MAC address:

# python -c "import socket; s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1);
s.sendto('\xff'*6+'\x00\x1A\x92\x9D\x69\x85'*16, ('<broadcast>', 7));"

Password 'protection'

Wake-on-lan has a SecureON password feature. Here's an example of how to use ethtool and wol with SecureON (note that the password contains 6 hexadecimal numbers):

# ethtool -s eth0 wol g sopass 11:22:33:aa:bb:cc 
$ wol --passwd=11-22-33-aa-bb-cc 00:4F:49:07:0B:5F

Wake-on-LAN supported but just won't wake up

At this writing, the Marvell Gigabit Ethernet controller on the Asus A8V and some other motherboards, using skge driver under Debian Etch may not wake at all while connected at Gigabit speeds to a Gigabit switch. The same hardware may wake correctly when shutdown with Windows in a dual-boot system.

A variety of workarounds have been suggested, from modifying the halt binary to using the NIC at 100 Mbps speeds, to placing calls to ethtool in various startup/network/shutdown scripts, but the simplest path to solution is probably to disable the motherboard network controller in BIOS and replace with a known-good PCI Gigabit NIC (such as the US Robotics 7902 Gigabit NIC).

Wake On LAN, Fedora 11 and Realtek RTL8111/8168 (etc)

This chip seems to be pretty common, along with a lot of problems getting WOL to work... I suspect this will apply to the following NICs chips


Finally, after much headache, this is the fairly simple solution (based on much crawling around on the web and some considerable testing)... Go to the Realtek Site, download the driver from there (http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=13&PFid=5&Level=5&Conn=4&DownTypeID=3&GetDown=false) Follow the instructions in the README and make and install yourself a new kernel mod (this will be r8168).

Now, edit /etc/modprobe.d/blacklist.conf and add

# NIC Kludge Stop r8169 loading so that r8168 will 
blacklist r8169

this stops the r8169 module loading after reboot, this is the one that ships with the kernel, and WOL won't work (except for physical activity), which means it will happily use your shiney new r8168 module instead.

It also appears to be necessary to place the following lines into /etc/init.d/halt

/usr/sbin/ethtool -s eth0 wol g       # This sets the WOL options on the NIC you may wish to use different ones
sleep 10                              # Apparently this is necessary

The above lines need to be the penultimates ones, just above

exec $command $HALTARGS

Useful links

  1. http://ahh.sourceforge.net/wol/ (wake-on-lan client + additional information)
  2. http://dag.wieers.com/packages/wol/ (wol packages for RedHat and Fedora)
  3. http://www.die.net/doc/linux/man/man8/ethtool.8.html (man page for ethtool)
  4. http://www.sourceforge.net/projects/gkernel/ (gkernel package that contains ethtool)