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!

Monday, June 3, 2013

Power Management for Network Devices in Windows 7

http://technet.microsoft.com/en-us/library/ee617165%28v=ws.10%29.aspx
Applies To: Windows 7

Networking Power Management
Networking power management refers to the set of features that you can configure to allow the computers in your network to save energy. For example, the most common networking power management feature is Wake on LAN (sometimes referred to as WoL). Wake on LAN allows the computer to be woken up from sleep by desired network traffic. This paper describes the networking power management capabilities of Windows 7, how to use them, and what controls you can use to customize their behavior.

What’s new in the Networking Power Management?

Enhancements in Windows 7 have been made in the areas of Wake on LAN, Wake on Wireless LAN and Low Power on Media Disconnect (sometimes referred to as D3 on disconnect).
  • Wake on LAN and Wake on Wireless LAN . The Wake on LAN patterns in Windows 7 were designed to ensure that the computer wakes when accessed by the network while minimizing spurious wakes. Windows 7 does not wake on directed packets (for example, ping) which have been known to cause frequent and unnecessary wakes.
    In addition to more targeted wake patterns, Windows 7 adds support for Address Resolution Protocol (ARP) and Neighbor Solicitation (NS) offloads. ARP and NS protocols map Internet Protocol (IP) addresses to a MAC address. ARP and NS protocols are commonly used to verify whether a computer is still present on the network, often without actually needing to access the computer. By offloading ARP and NS responses to the network adapter, the computer is no longer woken up merely to maintain network presence. Support for these offloads depends on the network adapter and driver (NDIS 6.20) and may not be available on older hardware.
  • Low Power on Media Disconnect . This is a new Windows 7 feature that enables the computer to save energy by placing the network adapter in the low power state when the LAN cable is unplugged and the computer is running. This feature is only available when supported by the network adapter.
These enhancements in Windows 7 improve the ability of the operating system to stay asleep while still maintaining a network presence. This helps enterprise and home computers to save energy by entering into sleep mode when they are not in use.

Who should use this guide?

Users, IT Professionals, and OEMs that are interested in understanding and configuring the networking power management enhancements in Windows 7.

In this guide

  • Overview of Features
  • Prerequisites
  • Configuring power management using the user interface
  • Configuring Wake on LAN using the command line
  • Configuring power management using keywords
  • Configuring power management using the WMI API
  • Summary

Overview of Features

This section outlines the technical details of the power .management features in Windows 7.
  • Wake Patterns . Wake patterns refer to network packet filters that determine if incoming network traffic should wake the computer. You can enable these patterns on the network adapter. The following wake patterns may be supported by a network adapter:
    • Wake on new incoming TCP connection for IPv4 and IPv6 (TCP SYN IPv4 and TCP SYN IPv6).
    • 802.1x re-authentication packets
  • Bitmapped Patterns . Most network adapters can be programmed with bitmapped pattern filters. Bitmapped patterns are defined by a bitmap mask and a pattern filter. As network packets are received, they are masked using the bitmap mask and then compared to the pattern filter. If there is a match, the network adapter wakes the computer.
  • Magic packet . The magic packet is always supported and does not need or use a pattern. Magic packet is used by some applications including most media sharing applications.
    The patterns that are chosen by default are based on the network adapter’s capabilities and whether the computer is joined to a domain as follows:
    Capabilities supported by the network adapterDefault for a computer that is joined to a domainDefault for a computer that is not joined to a domain
    ARP & ND offloadMagic Packet
    NETBIOS name query
    TCP SYN v4
    TCP SYN v6
    Magic Packet
    NETBIOS name query
    TCP SYN v4
    TCP SYN v6
    ARP offload onlyMagic Packet
    NETBIOS name query
    TCP SYN v4
    TCP SYN v6
    Magic Packet
    NETBIOS name query
    TCP SYN v4
    TCP SYN v6
    NS
    No offloadMagic packetMagic Packet
  • Network Presence . Windows 7 adds support for ARP and NS network presence offloads.
    • ARP offload . ARP offload is the ability of the network adapter to respond to an IPv4 ARP request without waking the computer. Both the hardware and the driver must support ARP offload to enable this feature.
    • NS offload . NS offload is the ability of the network adapter to respond to a Neighbor Discovery Neighbor Solicitation request with a Neighbor Advertisement without waking the computer. Both the hardware and the driver must support NS offload to enable this feature.
  • Low Power on Media Disconnect . Lower Power on Media Disconnect is the ability of the network adapter to go to sleep when it is not in use. When Windows detects that media has been disconnected (for example, a cable is unplugged), Windows will put the device into the low power state and disable the LAN. The computer will automatically detect when the cable is plugged in again and return the network adapter to full power. Low Power on Media Disconnect is disabled when the computer goes to sleep.
  • Wake On Wireless LAN . The Wake on Wireless LAN implementation in Windows 7 represents a superset of Wake on LAN. In addition to the features defined for a wired LAN, devices that support Wake on Wireless LAN must be able to maintain a connection to the access point while the computer is in sleep mode. In addition to receiving packets from the wireless access point and filtering them, the wireless network adapter must be able to handle security key updates. GroupWise Transient Key updates are handled by the wireless network adapter while the computer is in sleep state. For Pairwise Transient Key updates or user authentication, the network adapter must wake the computer and allow Windows to handle the request.
    As with wired WoL, while the computer is in the sleep state, the network adapter will apply the packet filters and respond using power management offloads (if applicable). If the connection is lost, the network adapter may re-establish the connection to the same access point. To roam or connect to another access point, the network adapter must wake the computer.
Power management settings are controlled by standard registry keywords. You can modify the standard keywords using the device properties user interface, the netsh command, or Windows Management Instrumentation (WMI). Networking power management is controlled on a per network adapter basis.

Prerequisites

Update hardware and drivers to NDIS 6.20 . Wake on LAN, Wake on Wireless LAN, power management offloads and Low Power on Media Disconnect must be supported by both the network adapter and the driver. Wake on LAN pattern enhancements will function with both Windows 7 and previous driver versions. For previous driver versions, Windows 7 will translate Wake on LAN patterns to match the older power management capabilities of the driver. Support for power management offloads must be enabled by both the hardware and a Windows 7 version of the driver (NDIS 6.20).

Configuring power management using the user interface

To turn power management features on or off

  1. Open Network and Sharing Center (click the Start button, type Network and Sharing in the Start Search box, and press Enter).
  2. Click the Change adapter settings link in the upper left of the navigation pane.
  3. Right click the network connection you want to enable/disable power management support on and click Properties .
  4. Click Configure .
  5. On the Power Management tab, check or clear the Allow the computer to turn off this device to save power check box.
    • When checked, power management is enabled on the network adapter.
    • When cleared, power management is disabled on the network adapter.
  6. You can enable Wake on LAN for all wake methods or just enable magic packet WoL:
    • To enable Wake on LAN for all methods, check the Allow this device to wake the computer check box.
    • To enable Wake on LAN for magic packet only, check the Allow this device to wake the computer check box and then check Only allow a magic packet to wake the computer check box.
    noteNote
    For devices that do not support ARP and NS offloads, Windows will default to wake only on magic packet.

  7. Click OK .

Configuring Wake on LAN settings using the command line

You can use the netsh command to force the operating system to wake on ARPs, and NS on a per network adapter basis—but only for computers that are joined to a domain.

To force a network adapter to wake on ARP and NS

  1. Open a command prompt with administrator privileges. (click the Start button, type Command Prompt in the Start Search box, right click Command Prompt , and click Run as Administrator .)
  2. Type netsh interface ipv4 show interfaces . This will list all of the available network interfaces; note the index (labeled Idx ) of the network adapter you want to modify.
    noteNote
    You can replace ipv4 with ipv6 for Internet Protocol version 6.

  3. To force the network adapter to wake on ARP and NS type netsh interface ipv4 set interface [index] forcearpndwolpattern=enabled . If successful, OK will be returned.
  4. To revert to system default type netsh interface ipv4 set interface [index] forcearpndwolpattern=disabled . If successful, OK will be returned.

Configuring power management using keywords

You can use keywords to configure which power management features are enabled or disabled. Keyword settings may be modified using either WMI scripts or the advanced properties page of the device properties. Keyword settings influence which patters are programmed on the network adapter. The keywords that a network adapter must support along with their default settings are shown in the following table.
SubkeyName Explanation Default Setting
*WakeOnPattern
Defines if a network adapter is enabled to wake the computer on pattern matches.
0 - Disabled
1 (Default) - Enabled
*WakeOnMagicPacket
Defines if a network adapter is enabled to wake a computer on the magic packet.
0 - Disabled
1 (Default) - Enabled
*DeviceSleepOnDisconnect
Defines if a network adapter is allowed to go to low power when media is disconnected and wake when media is connected again.
0 - Disabled
1 (Default) - Enabled
*PMARPOffload
Defines if a network adapter is enabled to offload ARP when the computer goes to sleep state.
0- Disabled
1 (Default) - Enabled
*PMNSOffload
Defines if a network adapter is enabled to offload NS when the computer goes to sleep state.
0 - Disabled
1 (Default) - Enabled
*PMWiFiRekeyOffload
Defines if a network adapter is enabled to offload GTK rekeying for WoWLAN when the computer goes to sleep state.
0- Disabled
1 (Default) - Enabled

Configuring Power Management using the WMI API

WMI is a programmatic means by which an application or administrator can control power management settings. Example scenarios for controlling power management capabilities using WMI scripting include:
  • Applications may not allow a computer to sleep unless specific Wake on LAN capabilities are supported and enabled. For example, Media Center or Media Center extenders.
  • An OEM, shipping computers with multiple network adapter cards, can enable WoL for selected network adapters. Management utilities can display and allow you to modify the power management capabilities for a network adapter using WMI scripts. These utilities will be able to read hardware capabilities and allow custom configuration.
The following WMI methods allow you to query and control Wake on LAN:
  • GUID_NDIS_PM_ADMIN_CONFIG is used to query and set keyword switches.
  • GUID_NDIS_PM_CAPABILITIES is used to query both the hardware capabilities and the state of current capabilities.

GUID_NDIS_PM_ADMIN_CONFIG

The GUID_NDIS_PM_ADMIN_CONFIG method is called to query or to set keyword values and parameters. Each keyword may be one is the following three values:
  • Unspecified . In a query, it means the keyword does not exist. In a set, it means the user does not want to change the keyword’s current value.
  • Disabled . In a query, it means the keyword is currently disabled. In a set, it means to disable the keyword.
    Enabled . In a query, it means the keyword is currently disabled. In a set, it means to enable the keyword.
    The keywords used in GUID_NDIS_PM_ADMIN_CONFIG are composed in the following struct:
    struct _NDIS_WMI_PM_ADMIN_CONFIG
    { NDIS_PM_ADMIN_CONFIG_STATE WakeOnPattern;
     NDIS_PM_ADMIN_CONFIG_STATE WakeOnMagicPacket;
     NDIS_PM_ADMIN_CONFIG_STATE DeviceSleepOnDisconnect;
     NDIS_PM_ADMIN_CONFIG_STATE PMARPOffload;
     NDIS_PM_ADMIN_CONFIG_STATE PMNSOffload;
     NDIS_PM_ADMIN_CONFIG_STATE PMWiFiRekeyOffload; 
    }
    

GUID_NDIS_PM_ACTIVE_CAPABILITIES

The GUID_NDIS_PM_ACTIVE_CAPABILITIES method will query and return the current capabilities. Each capability will be reported in one of three enumerated values as follows:
  • Unsupported . Means the hardware does not support this capability.
  • Inactive . Means the hardware supports the capability, but a keyword or other logic has this capability disabled.
  • Active . Means the hardware supports the capability and it is actively enabled.
The capabilities returned in GUID_NDIS_PM_ACTIVE_CAPABILITIES are composed in the following struct:
struct _NDIS_WMI_PM_ACTIVE_CAPABILITIES
{ NDIS_PM_CAPABILITY_STATE WakeOnPattern;
 NDIS_PM_CAPABILITY_STATE WakeOnMagicPacket;
 NDIS_PM_CAPABILITY_STATE DeviceSleepOnDisconnect;
 NDIS_PM_CAPABILITY_STATE PMARPOffload;
 NDIS_PM_CAPABILITY_STATE PMNSOffload;
 NDIS_PM_CAPABILITY_STATE PMWiFiRekeyOffload; 
}

Summary

The enhancements made to Windows 7 for managing power settings for network adapters greatly reduces the number of spurious wakes, allowing computers to sleep for longer periods of time when idle. Furthermore, you can configure the power management settings to meet the needs of your users through device properties, standard registry keywords, or WMI. The result is energy savings and a more environment friendly computer.

Did you find this helpful?

Community Additions

ADD

*PMNDOffload Typo

Shouldn't that be *PMNSOffload?
amirpoorani
4/22/2012

WOL tools

There are a number of free tools that can send WOL magic packets. Here is a very simple GUI-based tool that works well (Win7 Ult x64). swb_mct also references this site in the comments above. Weestro
1/4/2012

ARP and WiFi rekey offloads in PM capabilities became inactive in WMI query result

My adapter is capable of wake on magic packet, ARP offload and WiFi rekey offloads, however one day I found ARP offload and WiFi rekey offload did not work any more although magic packet is still working until today.
I used wbemtest to query PM Capabilities of my adapter, it turned out that all the protocol offloads became "1" (inactive), however I'm 100% sure that they're enabled in "Advanced" tab in the adapter's properties. According to this article, "Inactive" means "the hardware supports the capability, but a keyword or other logic has this capability disabled". Now that "keywords" in the "Advanced" tab look correct, there should be some kind of "other logic" disabled them.
Re-installing the driver or using an older driver did not help.
Can someone tell me what "other logic" means or what happened to my Windows?
I guess there must be some settings of my Windows were changed accidentally, but I still don't know what it is after searching throughout the internet.
12/31/2011

Wake up

Eric, you are correct. I found nothing in my extensive searches that would allow an Enterprise to wake up machines reliably. We at one time tried to use Altiris, but even that had it's issues with server hangs and other users messing with the collections and configuration of the Altiris Servers. Currently I am waking up 50,000 workstations using Powershell. I have scripts that read in the dhcp info into SQL every night, and then using Active Directory, I get the list of machines, query the database for a match and that gives me the MAC address and the IP address to send the broadcast. Using magic packet, I have been getting consistent results for over 6 months now. I have not messed with any of these other methods for WOL, but will be looking into it as soon as I can find someone else that is waking machines with something other than magic packets.
12/7/2011

Wake from Remote Desktop

TCP SYN is a way you can wake from RDP. If that pattern is enabled then a system in Standby/Hibernate will wake from the remote desktop connection attempt.

You should enable PME in windows 7 to make Wake on lan work

If NIC drivers upgrade, BIOS upgrade are not helping and you are on windows 7, then probably enabling PME is the solution. See http://techibee.com/windows-7/wake-on-lan-is-not-working-in-windows-7-found-the-solution/980 for more details.
5/3/2011

Answering the question below

Through testing on a Windows 7 Thinkpad notebook used for remote access to systems at vacation home, there are two ways to Wake Up the computer using Wake on LAN. The second, more reliable method described below was a surprise, because my understanding was that normal http or remote desktop requests are not supposed to trigger WoL.
-
If you use this on the internet make sure to configure UDP ports on your port forwarding rules. TCP is default on many router/firewalls.
-
1. If you configure the Windows 7 network adaptor to "Only Allow Magic Packets to wake up the computer" you can send Magic Packets using the free WolCmd.exe command line utility. Since this method was not not 100% reliable I created a batch file that sends the command 4 times as follows using 4 different inbound UDP ports forwarded to the LAN ip address of the Thinkpad. Using 4 different ports was an attempt to improve 'wake-up' and delivery reliability. Sending the command 4 times definitely helped reliabilty. I don't know if using 4 different UDP ports through the firewall made any difference.
-
Batch file commands below inlcludes mac address of Thinkpad, internet address, mask, UDP port
-
C:\wolcmd.exe 001125184f95 echobay.domainname.net 255.255.255.255 35700
C:\wolcmd.exe 001125184f95 echobay.domainname.net 255.255.255.255 35701
C:\wolcmd.exe 001125184f95 echobay.domainname.net 255.255.255.255 35702
C:\wolcmd.exe 001125184f95 echobay.domainname.net 255.255.255.255 35703
-
2. This method is more reliable than above.
I turned off "Only Allow Magic Packets to wake up the computer" and now any connection attempt forwarded to the Thinkpad on the LAN wakes up the notebook. This computer hosts remote desktop on tcp port 35701 and http on tcp port 35700. A Remote Desktop connection attempt or an http connection attempt now wakes up the computer and opens the session about 5 seconds later.
-
I don't care if someone else wakes up the computer because my WoL arrangement is only to wake up the computer from following an AC Power Outage. It only goes to sleep when there is an AC power outage but there is no Power Managmenet method to wake it up upon AC power resumption.
You can get wolcmd.exe here:
http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx
3/29/2011

Missing the Obvious

This article is missing the most obvious information - how to you actually wake up the computer remotely? What tools or utilities are there. What do you actually have to do to send any of
  1. Magic Packet
  2. NETBIOS name query
  3. TCP SYN v4
  4. TCP SYN v6
I have tried Google and Bing, and all I can find are web pages that can send a magic packet, but when I try them they do not work even though I have my target system configured for WOL. Microsoft seem to deliberately be avoiding to implement the most obvious feature of all - WOL from Remote Desktop - as that seems to be the most requested feature on the web.

No comments: