Saving energy with WOL
Monday, April 13, 2009 at 9:40PM
Tux in Linux, Linux, Tips and Tricks, apm, ether-wake, how-to, magic packet, tips, wake on lan, wol

Image courtesy of Click for attributionGood day to you, fellow geeks!

Just a short, albeit hopefully useful, entry this time round concerning power conservation.

I've been looking at ways to get my computers to consume less power, realizing that having 2+ computers whirring continually 24/7 might not be the BEST thing for the environment, to say nothing of my pocketbook!

One thing I've been wanting to muck around with for ages is "Wake On Lan", or WOL for short. This technology, which should be available on all modern motherboards, enables a user to allow his or her PC to go to full sleep mode and allow itself to be reactivated by sending a specially crafted packet to the computer's network card.

In practise, this means that your PC can be fully deactivated (drives spin down, fans off, processors off) with only a trickle of power to the motherboard allowing the ethernet card to monitor the network.

Why is this TOTALLY cool? Well, simple: You can, for example, enable a single computer in your household that is on 24/7 and monitoring connections from the outside world. This would be an excellent role for a thin client to fulfill since most modern thin clients pull only about 5W of power compared to the 150W+ monster desktops in use today. This thin client could then be used as the launching point from which to send the magic packets required to wake the other computers in the house, if they happen to be needed.

The method I am going to explain was carried out on a Fedora 10 box with an NVIDIA MCP51 Ethernet controller.

The method

First things first: Reboot your PC and get into the BIOS menu. Within the BIOS, you need to look for a "power management" section and within that see if there are any entries that say "Wake On LAN". If you find this entry, make sure that "Wake On LAN" is enabled. If you don't find an entry like this, it may mean that your PC BIOS does not support this feature. If you DO find this entry, and you enable Wake On LAN, then read on...

Restart yourLinux distro of choice and see if the power settings are configured as they ought to be. In Fedora, you need to go to "System -> Preferences -> System -> Power Management". Once here, ensure that the option slider "Put computer to sleep when inactive for" under the "On AC Power" tab is enabled, that is, that the slider is set to a time and doesn't say "Never". In my case, I set the value to 1 hour. Any less and I found that the computer tends to go to sleep when you're momentarily distracted by other things, thereby requiring you to wait a few extra seconds when you get back to using it.

Now that sleep is set, your PC will, after the specified amount of time and having not detected any activity, put itself to sleep. All you need to do now is to make sure that your network card is able to receive a Wake On LAN packet. To do this, make sure you have the "ethtool" program installed. For Fedora 10 users, this can be found as a package named, surprisingly, "ethtool". What you need to do with Ethtool (Or what I needed to do for this specific Network Card, in any case - a card which uses the "forcedeth" driver, by the way) is to make it tell the Network Card that it should cause the computer to wake up when it receives a magic packet. You do this like so:

/usr/sbin/ethtool -s eth0 wol g

Now, what does all this mean? Simple: "-s" tells the ethtool what Network Card to carry out this command on. This is of course useful in a system that has multiple network cards. For most users, the default "eth0" card (first network card on the system) should be adequate. Next is the "wol" parameter. This is of course short for "Wake On LAN". You are telling ethtool to invoke the WOL functionality with the "g" option. What is "g" in this case? "g" tells the Network Card to wake up the computer when it receives a magic packet. You could also allow the computer to be woken up on receipt of unicast, multicast, broadcast, or ARP activity, among other things. I didn't want to have any false wakeups, however, and that's why I chose for the magic packet option - which effectively means only a specially crafted packet will wake the computer up, and not spurious network activity. The really paranoid among us can even set a password along with the command. This means any magic packet sent to this PC also has to specify the correct password, otherwise the computer will not wake up. For more info on this, see the ethtool man page.

So that's it. That's all she wrote. The opera is over.... Oh no... Of course it isn't. When I next reboot my machine, the Network Card will be reinitialized and probably no longer allow itself to be woken up by the magic packet. So to be sure, I added the ethtool command described above to my "/etc/rc.local" file. "/etc/rc.local" is a file that is processed upon startup after all the other startup scripts have been processed. For a desktop machine, this means you can be sure the Network Card has already been activated when the "ethtool" command is executed from within the "/etc/rc.local" file.

One final thing: In order to be able to send a magic packet to this computer, you need to know it's hardware, or MAC, address. A MAC address is like the physical address of a PC. Even when the IP address is no longer active (The network card itself doesn't really bother with things like IP addresses - all it knows is it's MAC address. IP addresses are things that are created and used by higher level things - like the operating system of the PC. When asleep however, there is no IP address, so we NEED to use the MAC address instead). To find your PC's MAC address, simply type in


At the command prompt and all your PC's network interfaces will be displayed. There may be more on your system than just the one. Chances are, you'll be looking for the Network Interface called eth0. Next to the name should be a block of information relating to this Network Interface. You are looking for the "HWaddr" parameter. This should have next to it a group of six, two letter characters, separated by colons. Something like: 12:AE:00:01:FE:1A. Write this sequence down. You're going to need it to wake up the PC from another computer.

That really is all there is to it. After the specified amount of inactivity, your PC will put itself to sleep and allow itself to be woken up by the magic packet. So I guess all that remains is to explain...

How do I wake up?

Now to test it all. Once your PC is safely asleep, get to another pc on the network and prepare to send a magic packet. What is a magic packet, come to think of it? It's a specially crafted network packet that you send to the MAC address of your sleeping machine. Once the sleeping machine receives this packet, it sends a signal to the power management and the computer wakes up. To do this, of course, you need to know the MAC address of your PC. Which is why I asked you to write it down after you were done configuring the PC.

From a linux client, you can use the "ether-wake" (or, for some distros, "etherwake") tool to send the magic packet that will wake up your sleeping PC.

Windows users could try the program supplied by the website called wol.exe. I haven't tried this program yet so use at your own risk and let me know what results you get!

Ether-wake, on Fedora systems, is part of the net-tools package and is easily obtained and installed using the package manager.

Once installed, as root (by typing su and entering your root password or by preceding the following command with "sudo") type:

/sbin/ether-wake -i eth0 12:AE:00:01:FE:1A

And that's really all there is to it. By specifying the "-i" parameter, you tell ether-wake on which network card to send the magic packet. Again, this is usually eth0 but could be handy if you have a PC that has more than one network card. After the "-i" parameter you type the MAC address of the PC you want to wake up. This is the MAC address I made you write down when configuring your sleeping PC earlier.

For the technically curious, all a magic packet is is a specially crafted UDP packet that gets sent out on the broadcast address of the subnet and therefore reaches all Network Cards located on that subnet. Your sleeping PC's network card is listening for the packet and, when it "sees" it's own MAC address in the payload of the magic packet, it wakes up its host PC.

Good grief. I said this was going to be short. But I just LOVE to talk. My profound apologies. Hope this is useful to someone.

Article originally appeared on dutchtechies (
See website for complete article licensing information.