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.
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.