Geeks With Blogs
Tex-blog Mobile and other stuff
Ever wanted to wake your computer over the internet? I did, and it took me a while to find a way. It was easy to do it over the LAN, but a bit tricky to do it over WAN. My network/PC configuration is as follows:

- Linksys BEFSR41 V3 router connected to ADSL modem, with static IP
- one of the PCs behind router is configured to Wake On Lan, you can do it in your BIOS setup

Whats important is configuration of router, on 'Applications & Gaming' page I added new entry, to forward all 7 to 9 -th port accesses to 192.168.1.255 IP address. The rest of my router config is mostly what you get after reseting it to defaults.

Now comes the fun part, we need to send a magic packet to router-s IP Address. It can be done using web sites like:

http://www.rshut.com/products/wol/

or you can use the following perl script to send it yourself:

#!/usr/bin/perl -w
use IO::Socket;
use strict;

# Static IP Address where magic packet will be sent (localhost as example)
my $ip = "127.0.0.1";

# MAC address of network interface that will receive magic packet
# This is what ipconfig /all returns in a fOllOwing form: 00-01-02-03-04-06
my $mac = "\x00\x01\x02\x03\x04\x05";

my $sock = IO::Socket::INET->new(
    Proto    => 'udp',
    PeerPort => 7,
    PeerAddr => $ip,
) or die "Could not create socket: $!\n";

my $secretPacket = "\xFF\xFF\xFF\xFF\xFF\xFF";
for (my $i =0; $i < 16; ++$i ) {
    $secretPacket = $secretPacket.$mac;
}
$sock->send($secretPacket) or die "Send error: $!\n";


More on WOL (or rather Wake On WAN) can be found it the following sites:
http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wol-mini-howto-2.html
http://forums.hexus.net/networking-broadband/73364-how-turn-pc-remotely-wake-lan.html Posted on Wednesday, March 12, 2008 7:20 PM | Back to top


Comments on this post: Wake PC over the internet - aka. "Wake On WAN"

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
Great script, been looking for something like this for a while to play around with.

Has anyone been able to get this working though?

I can get WOL working with the rshut tool, but using this as CGI script with my IP and mac address just doesn't work (no 501, just doesn't WOL).

IO::Socket and strict modules are both installed.

Any feedback would be much appreciated.

Thanks.
Left by Neil on Mar 31, 2008 5:44 PM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
It appears that the line,
PeerPort => 7
in the perl script is set to use udp:7. As do most websites providing Wake-On-WAN services, rshut.com uses udp:9.
Change the script accordingly, and it should work.
Left by cdaaawg on Aug 13, 2008 12:01 AM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
Hi,
I am not good as computer, but I really need to turn on my compuer from internet (remoting, I already knew by using logmein).

Could you please teach me how to do it (wake up my PC from internet) step by step. it will really helpfull to my life!

Thank you,
Ngoc
Left by Ngoc di on Sep 12, 2008 7:52 AM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
I was going over this and can you tell me how to set this in the router 192.168.1.255 IP address. when I try it give me that it has to be in the range of something linke 1 - 254
Left by sumeet on Feb 26, 2009 1:04 AM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
sumeet - from what I know some linksys routers does not allow to setup port range forwarding to IP addresses ending with 0, 1 or 255. I am not sure if that is your case.

As for the more detailed steps if any one is interested:
1. You need to setup port forwarding on your router - just as it is stated above. How to do it - it depends on your router - look into its documentation.
2. To wake up your computer remotely from Windows, I suggest installing free perl implementation from activestate.com. Then copy above script to file won.pl, and run it from command prompt with command like:

perl won.pl

dont forget replacing >my $ip = "127.0.0.1";< line with your remote computer IP. And maybe change >PeerPort => 7< to >PeerPort => 9< if nothing works as was suggested above.
Left by martin on Feb 26, 2009 10:01 PM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
Thanks for the discussion, I am also anxious to get Wake over Internet working, Wake over Lan is easy. I have a Linksys router that will not allow port forwarding to a broadcast address. If I try to forward the port7/9 packet to the ip address of my server it will not work because as you know the ip stack is not up and the server cannot recognize the packet. There is a router feature that broadcasts Wake over Internet packets over the attached LAN. My Linksys WRTP54G does not implement this, sorry but Linksys routers really are stinky devices they do not provide anything but bare essentials.
Have you ever found a list of routers which do implement the forward Wake over Internet packets feature.
Thanks.
Left by Keith on Mar 19, 2009 1:25 AM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
Hy. I;m trying to achieve wake on wan for some time now, wake on lan work perfectly. I have searched a lot o forums and i found out that for wake on wan to work i have to forward the broadcast addres of my networ to a port, and when the router recieves the "magic paket" on that port it will forward it to the whole lan thus wakeing the machine with the MAC form the packet.

I dit just that and it still doesn't work . Can anybody help me.

I have to mention that i have a DLink DIR-635 router...

Thanks in advace !
Left by Alex on May 28, 2009 3:36 PM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
Linksys routers are not recommended if you want to do Wake on WAN because of this lack of support for broadcast.

Does the Dlink DIR-635 allow for port forwarding to a broadcast address?
Left by James on Jan 09, 2010 2:07 AM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
we need wake On Wan software
Left by parry on Feb 09, 2010 6:41 PM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
how to work wake on WAN over internet
Left by frank jan on Apr 07, 2010 2:36 PM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
If you wish a Wake On Wan that always runs, when your router doesn't allow the MAC to flow trough, you can read this proposal.

http://www.wollydigital.eu

Dario Padovani
Left by Dario Padovani on Feb 10, 2011 3:22 AM

# re: Wake PC over the internet - aka. "Wake On WAN"
Requesting Gravatar...
Hi, I made the changes you mentioned, but nothing happened, couldnt wake my pc up
I am using a linksys WAG320N as adsl router. my pc runs windows vista and I can wake my station on LAN, but need to do it on the internet.
if you need any details let me know. I'd appreciate your help.
Left by Ahmet on Jun 27, 2011 10:19 PM

Your comment:
 (will show your gravatar)


Copyright © Martinez | Powered by: GeeksWithBlogs.net