PDA

View Full Version : Internet Wake on WAN guide



sandman_1
11-18-2011, 12:59 AM
I have spent all kinds of time on this over the past several weeks trying to get this working, which I did finally. I thought I would write this guide to help people over the hurdles of trying to wake their PC from WAN.

I won't cover Wake on LAN (WoL). It is easy enough to do behind a router. All that needs to be done, is to send a packet to the router's broadcast address, usually 192.168.1.255 or 192.168.0.255. Unfortunately most routers, most will not let you dothat from the WAN side for security reasons and thus lies our problem. Also you could say, WoL is pretty useless to begin with since you have to be somewhat in the vicinity of your PC to begin with so what's the point.

I won't cover every detail in this guide. I will assume that you have some basic knowledge of Windows or the OS you are using. So with that said, on with the show.


Step 1: Enabling WoL from your BIOS

Go into your BIOS and in your Power Management settings, you will see the options for WoL and your NIC. Enable your NIC to respond to WoL "magic" packets.


Step 2: Setup WoL in OS

For Windows, go to your NIC adapter settings, select configure>>advanced, to get into your NIC's WoL settings. I have a Realtek NIC and it has 3 options for WoL: Wake from magic packet, Wake on pattern match, WoL & Shutdown Link Speed. The first two I have enabled. The 3rd one I have set to 100Mbps, for other purposes, but you may have it set for 10Mbps ,which is ok. Lastly, go into the Power Management settings in Windows and make sure "Turn off NIC to conserve power" is disabled.


Step 3: Router Setup

If your router supports WoL, well you should be a happy camper. Enable it and set it up, probably easy to do.

This is where it gets tricky. A lot of consumer grade routers don't support WoL from WAN. Also most will not allow you to forward to the routers broadcast address either without some kind of "hacking". I wouldn't recommend doing this for security reasons but I will tell you some of the ways to do it that I have come across in my ramblings.

Use at your own risk!!
---------------------
1. Go to your port forwarding settings and select a port you want to forward (WoL traditionally uses 7 or 9 but it can be different)
2. Enter your routers broadcast address to forward your port to: usually either 192.168.1.255 or 192.168.0.255
3. Disable Java in your browser
4. Click save, enable, or whatever
5. Go back and enable Java in browser

*This usually won't work on some routers even though it may look like it took the settings.

Another way I have read but haven't tried is to use Firefox and the DOM extension to alter the Java check range for legit values.

Excerpt from http://blog.benfinnigan.com/2008/11/wol-wake-on-lan-through-linksys-router.html



Prep the Routers:
This is where it gets interesting. Linksys doesn't natively support forwarding ports to the broadcast IP of 255 (you get some JavaScript error "IP value is out of range [0 - 254]"), so to get around it you can try one of two methods (they both worked for me):
1) I used firefox and DOM Inspector to change the value of the IP for port forwarding thereby circumventing the Javasacript validation. You have to have DOMI installed in Firefox, then inspect the page with the port forwarding for applications and gaming, then right-click the value in DOMI, choose edit, and set it to 255. After that is complete just save the settings.

I also tried saving the html page and modifying the form manually. This also worked like a charm. You need to remember to change the action property of the form to prepend the url of the router. If your router was 192.168.1.1 then your form tag might be <form name="portRange" action="http://192.168.1.1/PortRange.tri" method="post"> assuming PortRange.tri was what you orginally found in the form. You also need to change the value of the IP you're forwarding to be 255. This is what my HTML looked like when I was done:
<input class="num" onblur="check_valid_value(this,0,254,errmsg.err34,this.defaultValue,lanip,networkip,broadcastip)" maxlength="3" size="3" value="255" name="ip1">


-----------------------------------------------

Now if you don't want to forward to your routers broadcast address, then you are going to have do something different. Also I haven't covered another problem with routers and WoL, the routers ARP cache. Once your PC is off, the router will eventually flush the ARP cache entry for it. So even if you forward the correct port to your PC's LAN address, it may work for a few minutes/times but it will stop working after awhile when the router clears its cache entry for it. To get by this, you can try to create a static ARP entry for your PC. This usually involves telneting into your router and adding the setting. If you can't do that then you will have to do something else.

But usually the syntax for arp static entry is:

arp -s LANIP MACAddress

However I have read that if you reboot your router, it will wipe the settings out. You could wright a boot up script to avoid this but I am not going to go into that because I do not know enough about it. Google it...

---------------------------------------------------------------------------

If you can't telnet into your router or you are like me and your router hasn't got a lot of memory for custom firmware, measley 2MB on my part, the only option is to use a hub. Why a hub? Hubs are dumb and they do not direct traffic like routers and switches. Hubs and this is the key word here, "broadcast", the data to all devices connected to it. You can find hubs usually on the cheap. I got one off of Ebay for $15 and it is business grade, Netgear DS104. Make sure it is a true hub before you buy it!! A lot of advertised hubs are really cheap switches so be absolutely sure.

Now there are two ways you can get this to work:

1. Plug the hub in front of your router
2. Plug the hub behind your router (better)

If you plug it in front of your router, you are going to have to use a 2nd NIC if you want to still use your router. Plug one NIC, router, and cable modem directly into the hub. Disable the that NIC in Windows/OS so if someone malicious somehow got a hold of your NIC's MAC address, they couldn't do much of anything when Windows/OS boots up.

If you are going to plug it behind the router, you are going to have to have a device on the hub that is always on so the router won't kill the line, VoIP or something. Plug the hub in one of the routers LAN ports. Plug your PC and the always on device into the hub. Also if you have a setting "WoL & Shutdown Link Speed" for your NIC, you should probably set it to whatever the other device supports just to be safe, usually 100Mbps. I have read that there could be some incompatibilities that may arise on a hub with different link speeds. I don't know but better safe than sorry.

You then should create a reserved LAN IP for the always on device so it never changes to a different LAN IP. Then you will need to port forward to the always on device. Some of you may be scratching your head as to why should we port forward to the always on device and not the PC, well that is the beauty of the hub. It will broadcast the packet to it regardless which device you have port forwarded to. The reason you port forward to the always on device is that your router needs a "live" device to keep the ARP entry alive. The router forwards the packet to that LAN IP address to the hub. The hub then broadcasts the packet to all devices because it doesn't know who it is intended for. Thus your PC will wake despite it going to the other device.


Step 4: Use an app/website to wake up your PC

You will need to get your NIC's MAC address first. Next you will need your WAN IP address. The app/website will ask for this info. Next, put in the port that you forwarded on your router.

I am using an app on my phone called "WoL Wake On Lan Wan". It works great and I always have my phone on me.

If everything goes right, take stock in the fact that you can wake up your PC from almost anywhere on the planet. :)

*Please feel free to add or point out anything I might of missed.

peteding
07-13-2012, 07:46 AM
Sandman
I did what u suggested ie Plug the hub behind your router (better) so that the 2 PCs hangs out from the hub.

I used port 3389. Using the wireshack software, I saw was the magic packet sent to the (always alive ) PC with the magic packet containing the mac address of the sleeping PC. It stops there though and the sleeping PC does not wake up. Am I missing something?

sandman_1
07-22-2012, 03:51 PM
[WAN]-----[Router]--[LAN]-----[Hub]-----[Always on PC/Device]<---Packet forwarded to here
|
|-------[WoW PC]


That is how it should look. I assume you have it hooked up that way?

If the packet goes to the hub, the hub should broadcast the packet to all devices that are attached. If it is only going to one device, then it is not a true hub. What kind of hub do you have?

I got my Netgear DS104 off of Ebay for $15 shipped. They had several DS104 for sale too for around that price point at the time I got mine.

Edit:

Might want to change the port to 9 or something. 3389 is for RDP but I guess you could use it. It shouldn't matter but who knows.

peteding
07-23-2012, 07:22 AM
[WAN]-----[Router]--[LAN]-----[Hub]-----[Always on PC/Device]<---Packet forwarded to here
|
|-------[WoW PC]


That is how it should look. I assume you have it hooked up that way?

If the packet goes to the hub, the hub should broadcast the packet to all devices that are attached. If it is only going to one device, then it is not a true hub. What kind of hub do you have?

I got my Netgear DS104 off of Ebay for $15 shipped. They had several DS104 for sale too for around that price point at the time I got mine.

Edit:

Might want to change the port to 9 or something. 3389 is for RDP but I guess you could use it. It shouldn't matter but who knows.

I have tried port 3389. I am using a linksys EW5HUB. The configuration is as per what u indicated.

sandman_1
07-23-2012, 04:14 PM
When you shutdown the PC that is to be awoken, from the OS, does the light stay green on the hub that the WoW PC is connected to?

When I shut mine down, the light is still green for the line that the PC is connected to the hub. It must be green or else the line would be dead.

If you don't have a green light, then something is configured incorrectly. Check your BIOS and OS settings for WoL and make sure they are set correctly. Make sure any Power Management for that NIC is not set to turn it off when not in use.

Also try port 7 or 9 for giggles. Those are WoL ports. Make sure that you have made a rule to forward UDP packets, not TCP.

Zseusz
08-05-2012, 05:18 PM
Hi there Sandman_1

Thanks for your wake-on-wan write-up. Hopefully you can let me know what I am doing wrong.
The case is that I have done all you said with regard to the HUB being behind the router. Yes I can easily wake up my second PC on the LAN, but when I try waking it up from WAN it does not work. I used Wireshark to confirm that the Magic packet is being broadcast and I noticed some thing a bit odd.

1. When the Magic Packet is sent from the LAN PC that is always on the header is FF FF FF (broadcast) followed by some other data then finally FF FF FF FF FF FF and the MAC of the PC I want to wake - 16 times. Obviously the PC wakes up.

2. When the Magic Packet is sent from WAN the header is 00 00 40 (unicast) followed by some other data then finally FF FF FF FF FF FF and the MAC of the PC I want to wake - 16 times. The PC does not wake.

Please let me know if you have any work around this. Cheers.



When you shutdown the PC that is to be awoken, from the OS, does the light stay green on the hub that the WoW PC is connected to?

When I shut mine down, the light is still green for the line that the PC is connected to the hub. It must be green or else the line would be dead.

If you don't have a green light, then something is configured incorrectly. Check your BIOS and OS settings for WoL and make sure they are set correctly. Make sure any Power Management for that NIC is not set to turn it off when not in use.

Also try port 7 or 9 for giggles. Those are WoL ports. Make sure that you have made a rule to forward UDP packets, not TCP.

sandman_1
08-09-2012, 03:04 AM
You didn't give me any info to help you.

What is the device attached to the hub that is always on?

What is the manufacturer and model of Hub?

Is the indicator light, for the WoW PC attached to the hub, still illuminated when PC is shut-off?

What are your router settings for the always on device?

Are you sending the magic packet while on your WiFi to your WAN IP? If so, this sometimes will not work. Try waking from an outside network, i.e. cell network or neighbors WiFi.