Windows Shutdown and Wake on LAN Primer

Shutdown
Almost all modern PCs support Advanced Configuration and Power Interface (ACPI), which offers several methods of removing power to components within the PC, while allowing for the PC to quickly resumed when needed. Additionally, over the years several methods of waking a PC remotely over a network have been developed. Using a combination of these two features allows you to conserve power by powering down a PC when not in use, but have it quickly (and remotely) available when needed. 

ACPI defines the following levels of shutdown.
     
    S1: The CPU is paused but power to CPU and RAM is maintained. Devices that do not indicate they must remain on may be powered down.
    S2/S3Standby. CPU is stopped and whilst RAM is still powered it refreshes slower. The difference between S2 and S3 is the ram refresh speed. PC power is still required and may not be removed.
    S4Hibernation. All content of main memory is saved to non-volatile memory such as a hard drive, and the PC is then powered down. If power is removed, the PC is able to resume from it's hibernated state once it has power again. Resuming from hibernation returns the PC to the state it was in when the hibernation was performed rather than "booting" the PC. only devices able to wake the PC are powered (e.g. keyboard, clock, modem, LAN, or USB device).
     S5: Shutdown / Soft Off. This is what most people regard as Shutdown and power can safely be removed. When the machine is woken it will perform the normal bootup sequence. only devices able to wake the PC are powered. 
    G3/S6*Mechanical Off. Power is removed from all devices (except the real time clock, which has it's own on-board battery). This is the state the PC is in when the power cord is removed. It is not normally possible to achieve this state from software. 




CPU Paused. 
Hard disks and other non-S1 compliant devices are powered off
CPU powered offRAM Powered offWake Devices Powered OffPC can resumePower can safely be removedPC can be woken remotely
S0 (Running)
NoNo
No
No
N/ANo
N/A
S1YesNo
No
No
Yes
No
Yes
S2 / S3 (Standby)Yes
Yes
No
No
Yes
No
Yes
S4 (Hibernation)Yes
Yes
Yes
No
Yes
Yes
Yes
S5 (Shutdown)Yes
Yes
Yes
No
No
Yes
Yes
G3/S6
(Mechanical Off)
Yes
Yes
Yes
Yes
No
Yes
No

S1 and/or S2 are not supported many PCs claiming to be ACPI  compliant as they are not used by Windows.
S3 is sometimes referred to as Sleep Mode.
When woken from S4, most PCs will perform a faster "warm boot" (also known as a soft boot) assuming it has maintained power.
S5 is sometimes referred to as Soft-Off. When woken from S5, most PCs will perform a slower "cold boot".
S6 is not an official ACPI state, but is a term occasionally used.

Windows Vista expands on the ACPI states by introducing "Hybrid Sleep", this saves the contents of memory to hard disks (as it would in S4) but only drops the hardware to an S3 (Standby) state. This means the PC can be woken as quickly as it would from S2 (almost instantaneous), assuming power is maintained, but should power be removed it can perform an S4 style resume. Obviously putting a PC into "Hybrid Sleep" is much slower than standby. This option is very useful on laptops where limited battery life means keeping it on standby indefinitely is not possible, although it can be useful on desktop PCs too.

Hibernate (s4)

Hibernate stands out from the other ACPI states as it requires considerable interaction from the operating system to operate and in Windows is only offered as an option if your hardware fully supports it.

Once hibernation is enabled and a request to hibernate is made, the operating system dumps all of memory to a file (hiberfile.sys in the case of Windows) which may be compressed and/or encrypted, but the file is typically the size of your memory before powering down the PC (effectively to the s5 state). When the PC is awoken the data from this file is loaded back into memory and the PC is effectively carried on from the point it was hibernated in (although, in the case of Windows, it can optionally "lock" the PC on return from hibernation, prevent unauthorized resumption from hibernation).

In Windows XP, you can check if your PC supports hibernation and if it is currently enabled by navigating to the Power Options applet in control panel and checking the Hibernate tab. on Vista, hibernate is enabled automatically if your hardware supports it (it can be disabled and re-enabled from the command prompt). 
  

Wake on LAN

If a PC has been shutdown to an ACPI state from S1 to S5, it may be possible for it to be remote woken over a network and either resumed (S1 to S4) or booted (S5). For this to be possible it requires both a motherboard and network adapter that supports Wake on LAN and in some cases for that support to be enabled in the BIOS. Thankfully most modern motherboards with built in network adapters support this by default. PCs without on-board network adapters will need a motherboard that supports PCI 2.2 or has on board WoL connector, along with an appropriate network adapter.

When supported by the hardware (and configured if required) the "link" light on your network card should still be on, even when the PC is powered down (s1-s5), if not the card has most likely been powered down by the motherboard and will therefore not be able to look for remote wake up messages.

Most modern network cards support two types of remote wake up: "Magic Packet" and "Wakeup Frame". When the PC is in states S1-S5, it maintains power to any "wake devices" which would normally include any network adapters. The network adapter then listens on the local network for the wakeup message and once the adapter sees the wakeup (and determines that it is the intended recipient) it signals to the motherboard that the motherboard should wake. The motherboard will then either boot (from S5) or resume (S1-S4). 

External Hardware
It should be noted that whilst S4 and S5 reinitialise all the hardware, remote wakes from S1-S3 may not issue wake signals to external devices (such as monitors), so while your PC may wake up, your monitor might remain off.  

BIOS Passwords
It's also worth noting that wakes from S4 and S5 will reinitialise the BIOS and therefore if you have configured the BIOS to request a password before booting, the PC may not boot past the point until one is supplied. 

"Wakeup Frames" 
Wakeup Frames are not supported by all network card vendors (and are supported in different ways by different vendors).  Where they are supported, they can range from a simple ICMP echo (ping) to the PC or simply any traffic at all directed to that PC. on a network where one PC may check for the presence of another at regular intervals it is inadvisable to use wake up frames as PCs will often repeatedly wake for short periods and then sleep again.

"Magic Packets" 
Magic Packets are specially crafted ethernet packets solely used as a wakeup call. They have the advantage over wakeup frames that a PC will only wake when specifically instructed, but do require specialised software to generate them.

As any PC on the LAN is capable of sending a magic packet, some cards support a feature called SecureON which requires an additional password to be encoded into the magic packet, preventing unauthorized users waking the PC.

At the time the wake up packet is sent, there is no operating system running to decode the network traffic, it is therefore directed to an individual ethernet address rather the a TCP/IP address. As the PC you wish to wake may not be on the same subnet  as the PC you are waking from, the packet must first be encapsulated in a UDP packet, which is then translated into an ethernet broadcast when it reaches to desired subnet. The packet is traditionally sent to port 7, however as the port is not used, it can in fact be sent on any port (which may aid it passing through firewalls).

Wide area Networks
Normally these packets are allowed to pass freely between LAN routers, but WAN > LAN routers (especially consumer grade ones) are known to block IP directed broadcasts, which means that performing WoL from the internet to a PC on a private subnet my require reconfiguration of the router, or may simply not be possible at all. Given that Wake on LAN was only ever intended for LAN use, it seems a reasonable limitation.

Configuring Network adapters
It varies from network adapter to network adapter how to change which type of wake up message it responds to. In Windows you can often do using by editing the advanced settings whilst configuring the network adapter in device manager.


However it is often easier to achieve by using the Power Management tab (only present for adapters that support it).


This tab presents you with three options relevant to Wake on LAN

"Allow the computer to turn off this device to save power." 
This has a very misleading description, as it is required for the PC to wake using the device (and therefore obviously won't turn it off it that circumstance). "Allow the computer to control the power state of this device" would be more fitting.

"Allow this device to bring the computer out of standby" 
Checking this will turn on both type of wakes for a network adapter (Magic Packet and WakeUp Frame).

only allow management stations to bring the computer out of standby" 
This also has a misleading description.  It actually means PCs will only be woken using the Magic Packet and not by whatever "Wakeup Frame" that network adapter supports.
   
Once a PC has been configured with the options, any tool capable of sending the appropriate wake up message to the PC, should wake it, assuming your PC hardware and network infrastructure support it.
 


This document is (c) PeachWorx LLP 2010 and may not be reproduced without permission.

PeachWorx are the developers of TaskForceCO2, an easy to use system management tool for both shutting down and remotely resuming Windows PCs. For more information on TaskForceCO2 and PeachWorx please visit http://www.peachworx.com

+ Recent posts