USB Devices

Wake On LAN

Copyright 2008 by Stephen Vermeulen
Last updated: 2008 Oct 12
Cooking





120px 192 200 9 across appears because cause contains cooking cs currently done down easy function hit intel introduction last ll local mac machines management needs often page pcs ram right save search section show similar simple socket special src start table tbody text those three tr updated write

Introduction

Most modern PCs will support a wake on LAN activity function. This often appears as a BIOS option called "Wake on LAN" or "PME" (for Power Management Event). Intel has a reasonable write up on PME functionality.

This function will allow a PC that is currently powered down (S5 state) or in the "suspend to RAM" or hibernation states to be remotely woken up by sending a special packet across the LAN. This is done with a broadcast packet that contains the MAC address of the network card in the PC that is to be woken up. It needs to be done this way because the powered down PC might be DHCP configured, so would not have a particular IP address assigned to it.

This can be useful if you have PCs that are on the LAN but are often powered down or in standby to save power and you need to wake them up to do a backup or use them remotely.

Enabling WOL

The PC's BIOS needs to be set to have the WOL or PME functions enabled and the APM or ACPI functions enabled as well. Then, if you are running Windows XP or similar, you need to configure the network card to allow it to wake up the system. To do this you need to access the network card's control panel (from Start / Control Panel / Network Connections / Local Area Connection / Properties / Advanced) then eventually you will get to a tab marked "Power Management". In this there is a check box labeled "Allow this device to bring the computer out of standby", just check this and hit ok.

You can also get there by right clicking on "My Computer", then selecting Properties / Hardware / Device Manager / Network Adapters / the network card / Properties / Power Management. Isn't Windows easy to configure in three steps or less?

Remotely Waking the PC

To actually send the magic packet that wakes up the PC you need a small program. This forum posting has the following Python program that will do it:
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\x50\x2c\x01\x99\x52'*16, ("255.255.255.255",9))
just place this in a file called "wol.py" (you'll need Python installing, see my Python page, to run it) and edit the section that reads: '\x00\x50\x2c\x01\x99\x52' so that it contains the MAC address for the computer you want to wake up.

Waking on any Network Activity

It is also possible to configure network cards to cause the computer to be woken on any activity directed at its IP address. To do this on all but the most simple LANs you will probably have to assign static IP addresses to those machines that need to behave this way. This is described in this article on utilizing S3 standby. They suggest mapping drive letters to a UNC path of the form \\192.168.0.200\drive you could probably avoid this by setting up hosts files on the various client machines so they can always find the IP address of the server.

Suspending the computer

It may also be possible to get a program or batch file to suspend the computer once it is done its work by executing:
rundll32 powrprof.dll,SetSuspendState



                back to vermeulen.ca home