Penguin

Prerequisites for WakeOnLan:

  • A motherboard aware of resume on ring events
  • A NIC with WakeOnLan support
  • Possibly a cable connecting the NIC to the WOL header on your motherboard (unless it's an onboard NIC)

You will need to enable WakeOnLan in the machine's BIOS, and you will need to know the NIC's MAC address.

From another machine you can then use ether-wake to send the special Ethernet frame:

$ ether-wake $MACADDRESS

If you add an entry mapping MAC addresses to hostnames to /etc/ethers, you will also be able to simply say

$ ether-wake <hostname>

Pre-compiled packages of ether-wake exist for most LinuxDistributions. In Debian, it's called etherwake, but the version available in Woody doesn't seem to support /etc/ethers.

Some Linux NIC drivers seem to disable the WakeOnLan function of the network card. If you can use WakeOnLan after booting into Windows, but not at all after booting into Linux, your driver is probably one of them. ethtool allows you to change this. An initial query of an interface's properties will look something like this:

$ ethtool eth0
Settings for eth0:
       Supports Wake-on: g
       Wake-on: d
       Link detected: yes

Here, MagicPacket (type g) WakeOnLan support is available but disabled (Wake-on: d). You can change this with a swift

$ ethtool -s eth0 wol g

This time, a query to confirm the result should produce something like this output:

$ ethtool eth0
Settings for eth0:
       Supports Wake-on: g
       Wake-on: g
       Link detected: yes

Note that you'll need to change the setting anew on every boot, so stick the command in rc.local or whichever boot script is applicable.

If you encounter further problems check the parameters passed to the halt command in your shutdown script (/etc/init.d/shutdown.sh on gentoo). The -i parameter tells halt to down all the network interfaces just before shutdown which will prevent wol from working.


Which open ports do you need to open for ether-wake?

First of all, you normally use ether-wake to trigger a wake-on-lan event on a powered off computer. It is unlikely to have a firewall running at this point!.

ether-wake works by sending a special ethernet frame. Read the notes at MagicPacket for more information about this. Because this is an ethernet frame, and not actually an IP packet, it is not routable. The answer to the above question is "You can't".

There are other types of wake-on-lan triggers however, and I believe the only requirement is that it follows the format specified in the MagicPacket notes. these may or may not IP packets, and whether you need to open firewalls up to them or not will depend entirely on the local configuration.