Remotely Waking Up Your PC

My home theater PC is set to automatically enter a low-power sleep mode after 25 minutes of inactivity. This works well with Vista's Media Center, which wakes the machine up when it's scheduled to record. This way I can avoid the additional electricity cost of a computer turned on around the clock. My HTPC doesn't use that much power, but even at a miserly 60 watts idle, that still works out to about $80 per year here.


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2007/02/remotely-waking-up-your-pc.html

It does look like you can wake up over the internet.

Here’s a web page that will generate the Wake-on-LAN “magic packet”:

http://www.dslreports.com/wakeup

You provide the MAC address of the target computer and your internet IP. But before you do…

Looks like most implementations send the “magic packet” via UDP over either port 7 or port 9 according to the Wikipedia entry (the page above specifically says it uses port 9). So you’ll have to make sure that port is forwarded by your firewall/router to the IP broadcast address.

http://en.wikipedia.org/wiki/Broadcast_address

Remember, you can’t send the packet to a specific IP because a computer in sleep mode or powered off has no IP address.

Good post. I found out about this the other week when I noticed that when my eMac would go to sleep, I could no longer print to it. It’s a pain that it doesn’t wake automatically and therefore allow me to save power by being asleep when I’m not using it. Very handy at least to be able to wake up a machine.

Here is some code on how to do it.
If anyone wants to add this to there app…
http://community.bartdesmet.net/blogs/bart/archive/2006/04/02/3858.aspx

Oh, and another thing I found out:

Most home routers will NOT route requests to the IP broadcast address (eg, 192.168.0.255, or 192.168.255.255). This makes it effectively impossible to wake up your PC over the internet using a WOL packet. :frowning:

There is a workaround for routers that run linux, a manual iptables edit:
http://www.dslreports.com/forum/remark,13287946

Er, holy cow. I take that back. I got it to work; I was able to wake up the PC using a magic packet sent over the internet.

I followed the instructions here for my router (a D-Link DGS-4300):
http://members.home.nl/rboerdijk/docs/wol.htm

And I used the “Wake-on-WAN” page here to send the magic packet:
http://www.depicus.com/wake-on-lan/woli.aspx

The .NET code behind this page is available, too:
http://www.depicus.com/wake-on-lan/woli-code.zip

So now I can wake up any PC on my network from anywhere I have access to the internet (well, assuming I keep a list of the MAC addresses with me). Really cool stuff.

Yeah, I experience a whole host of problems when my MacBook Pro goes to sleep. And it’s also nice to see a fellow Toejam Earl geek out there.

Want to wake from your router? Scrap the firmware that came with your router and upgrade to dd-wrt. http://dd-wrt.com/dd-wrtv2/index.php Along with unlocking ‘hidden’ features on your router, you can wake up any attached devices. Really handy when you’re a couple hundred miles away.

Excellent… I love that last comment about spending hours figuring it out rather than walk across the room :slight_smile:

There have been times when I’ve been on-site and wished I could have remoted to my desktop at home (which was asleep at the time).

Red writes: “There have been many occasions when I have been asleep and my PC has needed me to be awake. Sadly, although it knows that there is a magic packet that would wake me, it does not have the ability to make a coffee and roll me a fag, so it’s cries for me to wake me go unheeded”

With a little hardware hacking, it can. There is an example in the front of one of the Java books on controlling a coffee pot via X-10. There are plenty of interfaces for X-10-style home automation available. Making a rolling/stuffing robot shouldn’t be all that difficult - a little MindStorms action, anyone?

This is off-topic, but I just wanted to say that I’ve been reading this site for a while and really enjoy it. One thing that especially strikes me is that even though the people here are programmers, they also know the hardware tools of their trade (i.e., their computers and how to manage them). This article is a perfect example of that. The reason I mention it is that my son is currently in the process of getting a Computer Science degree. He’s finishing his third year. Yet, the school spends no effort trying to educate the students on the ins and outs of the various forms of PCs/Operating Systems out there. Oh, I think he’s got an OS class coming up next year. But, there’s nothing where they lock the students in a room with a pile of parts and some CDs and tell them they can’t get out until they build a PC, load the OS, and install a development environment (I guess that would be considered “training” instead of “education,” so it’s pooh-poohed). I keep telling him he’s got to pick this kind of stuff up on his own, but he’s young and doesn’t understand yet. Anyway, I just wanted to say it’s refreshing to see all this knowledge here.

Hi

Weird -I have the opposite problem. There have been many occasions when I have been asleep and my PC has needed me to be awake. Sadly, although it knows that there is a magic packet that would wake me, it does not have the ability to make a coffee and roll me a fag, so it’s cries for me to wake me go unheeded

For a while I had a cheap webcam hooked up and software that detected if the overhead light was on. When the light went off, it immediately put my computer into standby mode, and when the light was on, it woke up. Obviously not a solution for remote wakeup, but cute nonetheless.

Thank you! I was trying this myself last week. Tried all the same steps, but stopped just short of the property pages and “bingo!”

Thank you for abetting my laziness.

I once had a PC that just wouldn’t stay off. I would shut it down when I was finished using it and then come back hours later to find it up and running. Turns out that the bios was set to wake up on serial port events, and my external modem was generating them whenever the phone rang. What a silly set of features that was! The modem wasn’t going to auto-answer, and there’s basically no chance that the phone would still be ringing by the time the PC finished booting.

To David A. Lessnau: They didn’t teach that stuff when I was school either. I learned it because of an unhealthy obsession with computers starting at an early age. (And I suspect that’s a pretty universal experience.)

On my PCs I don’t have the ‘Wake from shutdown’ in the advanced list so I always just tick the relevant options in the ‘Power Management’ tab.

I generally also tick the ‘Only allow management stations to wake the computer’ otherwise the PC will periodically wake itself up to refresh network settings etc. With this option ticked the only time it will wake up is due to a scheduled wakeup, e.g. to record a TV show, or to run my scheduled backup or when sent a magic wake up packet.

I spent the 2 hours a while ago actually looking up the spec on Wake On Lan (WOL) and writing my own equivalent of mc-wol :wink:

Cheers

Hey,
Do you think this might work in the following situation:
When I need to use my home pc for VNC example, I’m not comfortable with putting it on all day. The only thing that’s active all day is the router. Would it be possible to get the router to send such packet ?

Once I wrestled with wake-on LAN over the internet for exactly the reasons mentioned here : VNC server running but didn’t want to have power-on all day. However, the problem was that my pc was waking up every couple of seconds. I never investigated further, but my best guess is that it was the router trying to communicate with the pc for some reason, and then inadvertently waking it up.

I had the problem of my Netgear router not allowing the broadcast on 192.168.0.255. Solution: change the subnet of your local network to 255.255.255.128, and then the broadcast IP becomes 192.168.0.127. Obviously, this reduces the number of available IPs on the subnet by half, but this should not be a problem for a home network.

Internet packets? A balled up sock will do the trick if you aim for the keyboard/mouse. Try deflecting it off the screen, if possible. If that doesn’t work, and you still have a crappy CRT, go ahead and throw the shoe. If your lucky, you’ll bust your monitor and have a reason to upgrade to the 21" flat screen instead of starting that college fund for your kids.