I wanted to write a quick web application to send a MagicPacket to be able to allow my PC to wake up remotely from a sleep or shutdown, using WOL. There were plenty of samples out there, and it was relatively straight forward.

Two of them that worked great (at least internally)

http://www.codeproject.com/KB/IP/cswol.aspx

http://bartdesmet.net/blogs/bart/archive/2006/04/02/3858.aspx

So I ventured out to do it, and ran into quite a few problems…

I am by no means a networking expert, and am pretty novice in my experience in that area, so naturally I did not understand that I cannot just use simple port forwarding to forward a MagicPacket to a specific IP on the network, because when the computer is shut down or asleep… it has no IP.

So how do you accomplish this? You can send the packet to your public IP and forward to a “broadcast” address (by default will be 192.168.1.255 on most networks, assuming you have not changed your subnet address). This in theory works…but I cannot test this because my Linksys WRT54G router will not allow it, and from the looks of it, not many routers will… (there are JavaScript validation workarounds for older versions of this Linksys firmware if you’re curious, that can circumvent this, http://rotwhiler.wordpress.com/2009/03/24/enable-wake-on-lan-through-linksys-wrt54g/)


So to try and wrap up a long story, here is how I accomplished wake on lan, over the internet using my WRT54G router: By now I am assuming you are using some sort of DNS service such as http://www.dyndns.com/ , to access your networks IP publicly, and that you have your necessary hardware configured properly, both in your OS, and your BIOS.

1) Flash your Router’s firmware with a 3rd party firmware (in my case I used Tomato, http://www.polarcloud.com/tomato ) , but do this at your own risk, and make sure that you are using the correct firmware for your router model and version, or you could end up with a useless router.

2) Once you’re inside the Tomato firmware, turn on remote access to the router, and set up a port number to access the router remotely (default is 8080). (Make sure you are not using any default passwords for your router access)

3) The kicker…. using any browser just access your router remotely, with the specified port number ( thisIsMyComputerDNS:8080 ) , log in to your router, and issue the WOL command from the Tomato interface… Kind of a bummer that I was not able to do this outside of the routers interface, but that’s life… I already wasted a lot of time on this

If this can help one person issue WOL commands over the net, I will be happy.  Good luck!