Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Thursday, February 14, 2013

Wake On Local Area Network (LAN)

Wakeup is an utility that can wake up a computer within the same subnet as the initiator of this command. All what is needed is the mac address of the computer that you want to start up. A second requirment is that the destionation computer needs hardware that support wakeuplan.
download here
Changelog:
1.01: Added the notation with :
Example usage:
Both example below wake up a computer with a network card that has the mac address 00508BCC0983. Notice that in both examples the mac address is the same only the last one has the notation with :
       wakeup 00508BCC0983
       wakeup 00:50:8B:CC:09:83
=====================
Wake-on-LAN (WOL) is an ethernet computer networking standard that allows a computer to be turned on or woken up by a network message.
The message is usually sent by a program executed on another computer on the same local area network. It is also possible to initiate the message from another network by using subnet directed broadcasts or a WOL gateway service. Equivalent terms include wake on WAN, remote wake-up, power on by LAN, power up by LAN, resume by LAN, resume on LAN and wake up on LAN. In case the computer being woken is communicating via Wi-Fi, a supplementary standard called Wake on Wireless LAN (WoWLAN) must be employed.[1]
The WOL and WoWLAN standards are often supplemented by vendors to provide protocol-transparent on-demand services, for example in the Apple Bonjour wake-on-demand (Sleep Proxy) feature.[2]
---------------
Wake on LAN (WoL) support is implemented in the motherboard of the computer. Most modern motherboards with an embedded Ethernet controller support WoL without the need for an external cable. Older motherboards must have a WAKEUP-LINK header onboard and connected to the network card via a special 3-pin cable; however, systems supporting the PCI 2.2 standard coupled with a PCI 2.2 compliant network adapter typically do not require a WoL cable as the required standby power is relayed through the PCI bus.
Wake on LAN must be enabled in the Power Management section of the motherboard's BIOS. It may also be necessary to configure the computer to reserve power for the network card when the system is shut down.
In addition, in order to get WoL to work it is sometimes required to enable this feature on the card. This can be done in Windows from the properties of the network card in the device manager, on the "Power Management" tab. Check "Allow this device to bring the computer out of standby" and then "Only allow management stations to bring the computer out of standby" to make sure it does not wake up on every single network activity that occurs.
=========================
Wake On LAN (WOL) "How to"
Configuring Wake-on-LAN
http://www.energystar.gov/index.cfm?c=power_mgt.pr_power_mgt_wol
Another way to ensure that sleep settings do not interfere with the distribution of administrative software updates (such as Windows security patches and antivirus definitions) is to utilize Wake-on-LAN features. With Wake-on-LAN activated, a network administrator can wake up sleeping machines at any time in order to perform on-demand software patches or updates.

Overview

Wake-on-LAN (WOL) allows a computer to be powered on or awakened from standby, hibernate or shutdown from another device on a network. The process of WOL is the following:
  • The target computer is in standby, hibernate or shutdown, with power reserved for the network card.
  • The network card listens for a specific packet, called the "Magic Packet."
  • The Magic Packet is broadcast on the broadcast address for that particular subnet (or an entire LAN, though this requires special hardware and/or configuration).
  • The listening computer receives this packet, checks it for the correct information, and then boots if the Magic Packet is valid and if contains the network card's MAC address.

Enabling WOL on Computers

WOL must be enabled in the both the basic input/output system (BIOS) and the network card. In order to enable WOL in the BIOs quickly and easily, some manufacturers provide methods for managing BIOS settings remotely or through scripts. For example, BIOS settings can be configured remotely on Dell computers using Dell Open Manage and on HP/Compaq computers using Insight Manager. To see if this is available for you computer, please contact your manufacturer. In order to enable on the network card, please take the following steps:
  • Click on "Network Connection" (in Control Panel) and then click on "Properties."
  • Click on "Configure" next to the network card the connection is using.
    Wake-on-LAN Local Area Connection Properties
  • Click on the "Advanced" tab. (The settings in this example are specific to the Marvell Yucon card but should be similar for other network cards.)
  • Enable "Wake From Shutdown" (may be different depending on the model of network card) by setting the Value to "On".
    Wake-on-LAN Marvell Yukon network adapter settings
  • Enable "Wake Up Capabilities" (may be different depending on the model of network card) by setting the Value to "Magic Packet".
    Wake-on-LAN Marvell Yukon network adapter settings
  • Click on "Power Management" tab. (The settings in this example are specific to the Marvell Yucon card but should be similar for other network cards.)
  • Enable "Allow this device to bring the computer out of standby" by checking the box.
  • Enable "Only allow management stations to bring the computer out of standby" by checking the box. This will require a Magic Packet to wake up your computer. Not selecting this will allow any traffic directed to your computer to wake it up.
Wake-on-LAN Marvell Yukon network adapter settings

Waking Up a Computer

Once WOL is enabled, the computer can be awakened by sending a Magic Packet. A Magic Packet is a broadcast sent on port 0, 7, or 9 that contains the destination computer's MAC address. All computers on the subnet get the packet. If the MAC Address matches the network card, the computer will wake up.
For use in an enterprise, WOL is usually used in conjunction with a management system that already stores this subnet and MAC address information. If using a management system such as Microsoft Systems Management Server (SMS), Altiris, or LANDesk, WOL capabilities may be built in or add-ons may be available. A few free applications available for waking up computers using WOL are provided below. (Inclusion in this list does not constitute EPA ENERGY STAR program endorsement, approval, or certification of these software packages.)
Other Notes:
  • For waking up computers on other subnets, the MAC address and subnet for each computer will be needed and must be updated if a computer is moved to another subnet.
  • Since WOL uses Directed Broadcasts to send Magic Packets to the destination computer, some network configuration may be to necessary wake up computers on a different subnet. On most routers Directed Broadcasts are disabled by default due to vulnerabilities associated with them. To securely enable Directed Broadcasts, access lists should be created or modified to allow them from one or more IP address or subnets and deny them from all others. This allows Magic Packets to be sent from management computers but keeps the rest of the network secure from Directed Broadcast vulnerabilities. This access list would have to be added to all routers between the source of the WOL Magic Packet and the destination computers that will be woken up.
=========================
Wake-computer-from-sleep-standby-without-bios-support-for-wol
You can use Task Scheduler to wake the computer.
  1. Click Start, type Task Scheduler in the Start Search box, and then click Task Scheduler in the Programs list.
If you are prompted for an administrator password or for confirmation, type your password, or click Continue.
  1. In the Actions pane of the Task Scheduler dialog box, click Create Task.
  2. In the Create Task dialog box, click the Conditions tab.
  3. Click to select the Wake the computer to run this task check box.
  4. In the Create Task dialog box, configure the options on the other tabs as appropriate for your needs, and then click OK.
 --------------------------
I've been able to rig up a solution using my router with DD-WRT installed.
The computer will wake up from standby if it receives a "magic packet" from the LAN, so I've configured SSH on the router, and I just run a script that will SSH into the router and then execute the wake-on-lan script from the router interface.
I created a variation of this script: DD-WRT Useful Scripts
=========================
http://en.community.dell.com/support-forums/network-internet-wireless/..19437693.aspx
the power options on our ethernet controler
WakeUpMode    
= "None"
= "Magic Packet"
= "Wake Up Frame"
= "Both"
 default is both what ever that is..i am assuming it magic packet and frame...
--------------------------------------
  My system is a dell xps 720 (A06 Bios) running XP and i had a problem very similar to what wickpica wrote. More specifically i was trying unsuccessfuly  to get Logmein on a client computer  to wake up my remote host computer the dell xps 720. The client computer just could not wake up the host computer. I believe i have solved the problem and wish to share it.
On the power management tab of the 57xx gigabit controller (nic card?) settings, i had to unclick the box beside "only allow management stations to bring the computer out of standby".  (the other 2 boxes above that stayed clicked on). 
This solved the problem. I am now able to remotely access the dell xps 720 via "wake on lan" WOL.  However, a new problem arose and luckily i figured that out also.
The new problem was that under this new setting, the computer kept coming out of standby on it own without me touching the mouse or keyboard.  I made a guess  that logmein was causing the computer to come out of standy (based on the packets i could see thru viewing the network activity of comodo firewall).  Also I read a very good post at http://en.community.dell.com/forums/p/19301828/19601275.aspx and figured out that under the Advanced tab of  the 57xx gigabit controller settings --wake on lan capabilities,  i should choose --magic packet
.....not  --both
.....where both would include "wake up frame" and "magic packet".
By choosing .--magic packet on the drop down menu, the annoying wakeup from standby problem caused by logmein was solved.  (on the other dell forum above, it was suggested to disable wake on directed packets, this must be a similar function as "wake on frame" ...it seems that disabling them prevents random wakeups form standby )
The last comment is about the following quote from wickpika above:
"The worst part...
After attempting to "wake on LAN", I cannot get the PC to resume from standby, even at the console. My only option is to power down the PC by holding the power button"
i experienced this same real hassle although in my case it was a slightly different change in the behaviour of standby mode (related to the time it took to come out of standby and how deeply it went into standby). It was almost a bit of a nightmare because it was permanently doing this.  I realize that the only change i had made was switching from S3 default setting to the S1 setting (in the bios) under power management (i think).  I know (or i'm pretty sure) that this bios change caused the annoying change in standby - probably a registry change corruption (?). It shouldn't have caused it but that is the nature of random events.   Going back to an earlier restore point (3 hours earlier) solved this problem for me.
=============================
http://communities.intel.com/thread/29566?start=30&tstart=0
I think I FINALLY found the answer. I'll document it in case some other poor soul has this problem and googles it.

In the BIOS menu there's an option to display the Intel ME prompt during boot. It's together with the options to display F2 to enter setup, F10 to enter boot menu, and so on. I enabled it just to see what it was. Upon restart, sure enough, right at the end of the POST there's a prompt to press CTRL+P to enter Intel ME. I did. Apparently it's kind of an extension to the BIOS menus. Among the few items inside, there was a "remote wake up" thing which was set to Enabled. I set it to Disabled. Now the computer doesn't reply to pings when it's sleeping. As I said, it will be a couple of days until I can be sure that I've solved the problem, but it does look promising.

I have to say, this Intel ME thing (I think it's Management Engine) is not documented anywhere, nobody seems to know about it, and why Intel put those options there instead of in the BIOS menus with the rest, is beyond me. Even the prompt to enter Intel ME is disabled by default, I was lucky to stumble upon it after trying everything.

Anyway, I hope it works permanently. I would like to thank everyone for your suggestions, especially rseiler. I may have ended solving the problem by myself (hopefully!), but I appreciate the time you took to contribute.
=============================
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/S3: Standby. 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 off RAM Powered off Wake Devices Powered Off PC can resume Power can safely be removed PC can be woken remotely
S0 (Running) No No No No N/A No N/A
S1 Yes No 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.

No comments: