The Ultimate Wake-on-LAN Guide

Posted by Kyle on April 11, 2012

A funny thing happens when you leave the nest, go out into the world, and start paying your own electric bill: turning the lights off becomes really important to you. At least, it did for me.

If you also have several computers at home that can't always be on because you can't afford it, Wake-on-LAN just might be for you. Wake-on-LAN allows you to send a signal over Layer 2 of an ethernet network called a "magic packet" to a network interface card (NIC) that has been configured to stay on and listen for that packet even when the computer itself is turned off. This packet tells the computer to turn itself on. What you get in the end is a really neat, power saving, laziness-enabling feature on your network, and you'll be able to turn on a machine from anywhere in the world.

Limitations & System Requirements

There are some technical limitations to WOL:

  • Some network cards are not compatible with WOL. Do your homework before you purchase one.
  • Some motherboards do not support WOL, either. Others take A LOT of work to configure. Again, do your homework.
  • WOL DOES NOT work over WiFi. There has to be a physical, wired connection. (It will, however, go over a wireless bridge to a wired client.)
  • Many consumer-grade routers do not allow the user to setup static ARP entries. You will not be able to use WOL over the internet if this is the case. Alternatively, you could always install DD-WRT on your router, which DOES support static ARP entries.

To state that all positively, you will need:

  • A motherboard that supports WOL
  • A NIC that supports WOL
  • A wired connection
  • A router that supports static ARP entries for WOL over the internet

Configure the NIC

Once you've confirmed the various system requirements, you will need to setup the NIC, usually on two levels: the BIOS and the Operating System.

Bios

Computer BIOS configuration varies wildly from PC to PC and generation to generation. Sometimes, there will not be a setting for WOL or Wake from PCI. This does not mean the MB doesn't support it. You may just need to configure from the OS instead of through both the BIOS and the OS.

Usually, you'll want to look under the power options for "WOL," "Wake on LAN," "Power On PCI" or something similar. I've included some screen shots below of the WOL entry on several different BIOS pages.


Once you've configured the proper BIOS settings, you'll want to boot into your operating system and set things up there. If you dual boot (or triple boot, etc.), you'll need to go into each operating system you've installed and setup the card there.

Depending on your hardware, this step may not be necessary. As mentioned above, sometimes the NIC/MB only need the BIOS OR the OS to be configured. Others require both.

Windows

Some cards in Windows can get pretty funky. In general, though, you can go to the Computer Management console (Control Panel -> Administrative Tools -> Computer Management).

Select the Device Manager in the left pane, expand the Network Adapters category and double-click the NIC in question.

Under the Advanced Tab, select the property that reads "Wake Up Capabilities," "WOL" or something similar. Possible values to look for include "Both," "True" or "Magic Packet." Also click the Power Management tab and make sure "Allow this device to wake the computer" is selected.

More screenshots below.

Ubuntu

This information is based on the post at ubuntuforums.org called HOWTO: Set your system up for Wake On LAN (WOL). I've made a few changes to better fit how I setup my systems.

Next, install the ethtool package. Ethtool will configure your NIC to stay on after the computer turns off to listen for the magic packet.

$ apt-get install eththool

Then edit your /etc/rc.local script.

$ nano /etc/rc.local

This script runs every time you turn you boot to your Ubuntu partition. Here's what your script should look like if you haven't alread added anything to it. Be sure to replace "eth0" with the interface you want to configure. You can run ifconfig to determine this.

#!/bin/bash
ethtool -s eth0 wol g
exit

If you have anything else you need to run at startup, you can always add it to this script. For instance, there are some commands that you should run at startup when using Likewise Open.

At this point, run the script (sudo /etc/rc.local), turn off your computer and send it a magic packet to test.

Mac

While I don't wish to hurt your feelings, I really don't like Mac's. I don't even own one (I ripped the image below from Macworld. They've got a great article on the particulars on how to setup a Mac). However, they have some WOL support. Some of the features are neat...like that ellusive WOL over WiFi, but it cannot wake a computer that is OFF. Instead, it must be asleep. In OSX, go to your system settings, then "Energy Saver." Check "Wake for Ethernet network access" to enable it. However, it should be enabled automatically. See below.

Mac WOL Settings

Configure the Router

I'm not going to spend too much time on this. If this makes sense to you, you're on the right path. If not, keep pressing on to learn!

In order for your router to receive WOL over the internet (aka Wake on WAN), UDP port 9 must have a NAT forward to an IP associated with the broadcast MAC address (ff:ff:ff:ff:ff:ff). I usually use the last IP address in the subnet (x.x.x.254) as this address. To connect the broadcast MAC with a specific IP, you'll need a static ARP entry.

I am most familiar with DD-WRT and pfSense, so those are the ones I will address here. I imagine other solutions will be similar.

DD-WRT

Static ARP is much simpler in DD-WRT. Simply add the entry to the startup script by going to Administration -> Commands. Enter "arp -i br0 -s [IP ADDRESS] FF:FF:FF:FF:FF:FF" (without quotes) in the text area and click "Save Startup."

DD-WRT Static ARP

pfSense

pfSense is a little trickier because, for some reason, you get an either/or option where static ARP is concerned. Either, it does not officially support static ARP, or EVERY ARP entry has to be static (read:pain in the butt - if you have a visitor that needs to get on the network, you'll be getting their MAC, manually assigning an IP and editing the ARP table via the web gui).

My solution around this is to simply create a cron job that sends an "[IP] is at [MAC]" ARP request once a minute. The easiest way to do that is to download and install the cron package and edit the cron jobs from there. The command is "arp -s [IP] ff:ff:ff:ff:ff:ff" (again, without the quotes).

pfsense static ARP

Configure the agent

Android

I have lately come to use my Android devices to send magic packets more than anything else these days, mainly because I have the device sitting in my pocket, and I can turn my computer on from anywhere with a cell signal. The first app I used was Wake On Landroid, but it looked terrile on my tablet. I switched to the originally- (and aptly-) named Wake on Lan app. My favorite thing about this is that each machine is saved in its own config file on /mnt/sdcard, and I can just copy one from my phone to my tablet, or vice versa, to sync them. (Thanks to the Google Play App store for the image).

Wake on Lan for Android Screenshot

IOS

You may notice a pattern by now, but I don't like IOS, either. However, they iPhone/Pad do have some WOL apps of their own.

wakeonlan & mc-wol

wakeonlan for Linux (sudo apt-get install wakeonlan) and mc-wol for Windows are both command line tools that are insanely helpful for cron & scheduled tasks. For instance I have my main server turn on several other computers automatically at night to back them up, then it turns them off.

For the former (in a LAN environment), just type:

$ wakeonlan [MAC ADDRESS OF TARGET]

For the latter (in a LAN environment), copy mc-wol.exe to C:\WINDOWS\system32 and type:

> mc-wol.exe [MAC ADDRESS OF TARGET]

For more complicated situations, like going over the internet, check out their help commands.

wolgui

wolgui is a neat little stand alone program. I don't really use it much anymore, but it can handle a wide variety of configurations. (Thanks to depicus for the image).

wolgui

pfSense

pfSense is a freeBSD-based router that runs on x86 hardware. It's pretty much the greatest, and it comes with a WOL service built in. You can do one-offs, or save machines for later. There's even a link from the DHCP page to add a client to your list of WOL machines.

pfsense WOL page

DD-WRT

DD-WRT is a linux-based firmware alternative for consumer-grade routers, turning $50 routers into $500 routers. It also has built-in WOL capabilities similar to that of pfSense.

dd-wrt WOL page

Spiceworks

Spiceworks is a great helpdesk, inventory, troubleshooting and IT life-saving tool...and it's free! (even if it only runs on Windows) I use it pretty heavily for most of my professional computer-type endeavors.

One feature is that, when supplied with proper credentials, it will crawl the network and automatically inventory everything it sees. It will pick up hardware serials, waranty information, software installations (it even warns you when a user installs heinous toolbars) and even software licensing information.

It puts all this information into an inventory, and when you call a device up in the inventory, one of the available tools is to send a magic packet for WOL.

Spiceworks WOL tool

Internet

Finally, if you've set your router up properly, you can send a magic packet from one of several web sites. I like to use wakeonlan.me. (The link is to the mobile site. It's a much cleaner page.)

I hope I've been able to save you a buck or two on that electric bill. As always, please feel free to leave comments or questions below!

-Kyle

 

Comments:

Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.