Wednesday, May 26, 2010

Waking up your PC over the Internet

To save power, particularly during the hot summer months, I’ve wanted to be able to wake up home PCs remotely.  I tend to use my home PCs to troubleshoot network connectivity issues while at work but other than that there’s really no need for the PCs to be on during the day.

Wake-on-LAN (WOL) has been around since the 90s and provides a way to wake up a PC remotely.

What does it take to make it work?

  1. WOL must be supported and enabled in the BIOS.
  2. WOL must be supported and enabled on the Network Interface Card (Device Manager –> Network Adapter properties –> Advanced).
  3. Power Management must be enabled for the NIC (Device Manager –> Network Adapter properties –> Power Management though this may vary from driver to driver).
  4. A program that will send the magic-packet.  The Wikipedia entry for Wake-on-LAN links to several programs that will do this.
  5. Forwarding a UDP port through the firewall to the LAN broadcast address.  In my case I forwarded UDP port 9 to 192.168.0.255.

On Windows there are other ways to remotely wake up a PC.  Devices that support the “Network Device Class Power Management Reference Specification”, a Microsoft standard described here, defines 2 additional methods: a network wake-up frame and detection of a change in the network link state.  The NIC has to support pattern-match based WOL to take advantage of the Network Wake-Up Frame method.

Both the magic packet or the Network Wake-Up Frame can be delivered in 3 ways: NetBIOS broadcast, ARP resolution and Unicast.

Since we intend to do this remotely we can rule out NetBIOS broadcast and ARP because the PCs are behind a firewall whose protection we want.  That leaves Unicast.  Windows registers the MAC address with the NIC driver as a pattern.  An IP packet with the MAC address and IP of the NIC will therefore serve as a Network Wake-Up Frame and bring the PC out of Sleep.

Since the PCs are behind a firewall 1 or more ports will need to be forwarded.  On my D-LINK 855-DIR router forwarding port 9 to the broadcast address for the internal network (192.168.0.255 in my case) does the trick!

1 comment :

  1. Great site for Wake-On-LAN from the Internet - http://wakeonlan.me

    ReplyDelete