Monday, November 10, 2008

WOL - Wake On LAN through Linksys router

Want to learn more about WOL before starting?

How I got my Linksys WRT54G to Broadcast WOL Packets to my LAN
In my particular set up I have a cable modem, piping internet to a VOIP router piping internet to a wireless Linksys WRT54G router piping internet to my machine.

I wanted to be able to turn on my computer at home without having to call my dear wife and ask her to march downstairs and fire it up. Here are the steps that I performed to make it work:
  1. Prep the NIC Card: Start>Control Panel>Network Connections>Local Area Connection>Properties>Configure> Then looked around for Wake Up, Wake On LAN, settings under the advanced tab and made sure that everything was enabled for magic packets.

    Then I went into the power management tab and unchecked the "Allow the computer to turn off this device to save power" checkbox.

  2. Prep the Motherboard: While my computer is booting I see the Dell logo and some text about how to get into settings or BIOS (typically F2 or F10 or F something). Once I was inside the BIOS I looked around for settings in regard to Wake on LAN sometimes abbreviated WOL. I made sure that WOL was enabled.

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

    2) 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 then your form tag might be <form name="portRange" action="" 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">

    On the VOIP router I just forwarded the port I decided to use as the Linksys WRT54G which forwards to the broadcast on my LAN.

    Wait, what UDP port am I forwarding you ask? It doesn't really matter. Typically WOL is on 7 or 9 but as long as you pick a port that isn't being used by another application (in other words pick something really high) then you're probably just fine.
  4. Test the setup: So, to test the Wake on LAN settings I used this WOL monitor and wrote my own application for sending packets. Why would I write my own packet sender? Because I couldn't find one out there that didn't apply the subnet mask to the IP and broadcast the message. With my setup I wanted the packet to go directly to my VOIP router, so I built my own WOL application. It's pretty simple:

I also added functionality to send the packet every few seconds so that I could power down my machine while I had a remote machine sending packets to me every 60 seconds and see if my machine turned back on. If you don't want the click once installer you can download it from Like usual, if you find the app useful, please drop me a line.

If you're having a hard time getting WOL to work for you, then try this forum to get your particular issue sorted out.

New! I have an Android App available for WoL and WoW. It's called WoL Wake on Lan Wan. Check it out here:
Download it:

Disclaimer: The views expressed in this blog entry are provided "as-is" with no guarantee expressed or implied. If tweaking this stuff bricks your box or your router I'm not responsible. Any sites I've linked to are not to be construed as an endorsement and I cannot be held responsible for anything that goes on within other internet sites and their products or forums.


Unknown said...

Hi there,

Thanks for posting this, it was just the solution i was looking for. I was struggling to get my WRT54GS to WoL but now it works perfectly!

Although i must admit that I could not get the most crucial step to work.. step 3.. at first anyway! I did try with the DOMI method, but it couldn't seem to get it to work and I did not quite understand the HTML method.

Instead I loaded the page in firefox, disabled Java, entered 255, restarted Java and clicked 'Save Settings'.

Thanks for your help!


Ben said...


Good thinking! I hadn't really thought about changing that setting *while* the page was loaded. Glad to hear that it worked out for you, isn't it ridiculous that they don't have an administrative override for this functionality?

Unknown said...

Yes it is frustrating, I did toy with the idea of upgrading the firmware with a custom version - but I thought it was too risky!

One thing I forgot to add is that you need to click 'outside' the text box after entering '255' as this is when the java script would normally kick in.

Unknown said...

I wanted to thank you for this little tutorial and ESPECIALLY for the WoL app that you wrote. This info and the app I needed to get Wake on Wan working. I actually ended up using a different work around for the broadcast forwarding:

left the router subnet at the default

created a port forward to on port 9 udp and saved the settings.

returned to the router subnet setup and changed it to and saved the settings.

Now that the forward was set previously, it didn't run the verification for accepted ips to forward( is broadcast on the first subnet).

fired up your WoL app and viola!

Unknown said...

I've tried almost everything I found here and there but nothing seems to work for me.

WoL works perfectly if I invoke it with a computer on the same LAN, however it doesn't work over the internet.

Both methods for imputing *.*.*.255 as my broadcast address failed. I decided to change my subnet to *.*.*.128 which means my broadcast address should br *.*.*.127. Still no luck.

I have a "Magic Packet Monitor" and it doesn't register a packet sent over the internet. It works perfectly on the LAN itself.

I'm running Firmware Version: 1.01.08 on a Linksys WAG200G.

Any ideas guys?
Thanks in advance!

Unknown said...

I've used my own app to wol in the past written in c# with code taken from:

and it has worked fine until VOIP go into the picture.
Your app works great when I turn off broadcast. Would you be willing to share your code? Or perhaps tell me how you've turn off broadcast in your app.
I tried remming SetClientToBrodcastMode but that didn't work.

Ben said...

Well, I build the packet myself and send it. That way I don't have to bother with any of the higher-level programming getting in the way.

Unknown said...

Saviour! (sort of...) I can wake up my home pc with your software, but not via depicus woli or any of the other online web interfaces for WOL that I know of. It's your "Do Not Broadcast" tickbox which seems to be the difference. Are there any web interfaces that have similar functionality? Restriction to your software may be a problem because at work etc. I'm behind a proxy server which authenticates, and I doubt it will work behind it. [ Perhaps the code could be adapted for PocketPC and I could wake via that? ] These are small problems that I'm sure I can fix somehow.

One of those who replied had a WAG which caused grief. I have one of those too (a WAG54GP2v2), so here's how I fixed the problem (after setting the router up with, which will certainly make this less messy because many of the linksys routers have functionality with built in). Look over another good tutorial at I could only get this to work if I followed their instructions for A) static DHCP (associating a specific internal IP address with a specific mac address) + B) the recommendation to use wireshark proved very useful. After using that, it seems that the only 'listening' port I could forward was UDP 5938 - UDP 9 seems to be no good for me. Hence, now I forward 5938 UDP to (the static DHCP which I set for my home pc). In WOL, I use MAC | host service name from DynDNS | all 255s for subnet | 5938 as the port | and 'Do not broadcast' WORKS GREAT, thanks!

NB. It's probably redundant now for me(?), but this might be useful for others: I found another way to port forward to the otherwise-out-of-range '.255' (I could use the DOM inspector to change the value to .255, but I couldn't seem to save it. How do you achieve that?). The linksys firmware has ability to backup/restore to/from a txtfile (Administration tab; "Backup&Restore") => set up the port forward as explained in the tutorial, but leave the last number as something within your router's scope (I used .31, but at that stage I had some other subnet. It shouldn't matter what final number you use, as long as it's within range). Backup to text file; edit the textfile in notepad; search for a line which looks like forward_port=WakeOnLan:on:udp:5938:5938>31 (I called the portforward 'WakeOnLan' so use whatever label you inputted earlier as the search criterion); change the '31' to 255; save; restore from the same window in the firmware. Done!

Ben said...

Hi Brad,

I did code this into a web application, but it looks like my hosting company won't allow sockets to be made from websites. If anyone was willing to host the application for me in a fully trusted environment we could get something out there -sigh-.

Unknown said...

Hi Ben,

You really have pulled together a nice tutorial. Unfortunately, I have a WAG54G2 and following your instructions, I think Linksys stepped up their security. I, for one, cannot think of any possible reason why they cant enable this feature, not go and step it up. I am hating linksys right now. Even my friends (no name) Chinese router has the ability of WOL. Please, if you know any other references or link or if you know something yourself, please let me know. I have googled all sort of queries and im not coming up with anything.

Thanks for your informative tutorial though, at first I was excited, only to find it doesnt work for my model even though the web interfaces and router configurations are almost teh same.

Fleck said...

I found a simpler way of tricking a Linksys router into accepting the broadcast address. Worked with FF but haven't tried IE. Basically you just get to the Port Range Forward page and then turn off JavaScript in the browser. Fill in your information (including broadcast address 255 for example), change from that field get to a different field and then re-enable JavaScript in the browser. Save your settings. It saved just fine for me, but unfortunately I can't test WOL as it's with a friend's router that doesn't have WOL enable on the computer.

Brionius said...

Blogger Matthew said...

I found a simpler way of tricking a Linksys router into accepting the broadcast address.

This worked great for my WRT54G2 - fantastic tip. Thanks Matthew!

Josh Breslow said...

Step 3 doesn’t work for me. Using Firebug, I removed the onBlur and changed the value to 255 and it either doesn’t keep the value or gives me this error, “The values you entered are invalid. Please try again.”. The error is not a JS alert, but actually written out to the screen with the “Continue” button.

I also tried disabling JS and saving the page and editing the HTML, all with the same results.

It is as if they are doing “server-side” validation now.

Unknown said...

I struggled with this and managed. Actually sdtacoma, I looked into your firebug thing and used it and it just worked for me :-)

You simply remove ONLY the javascript in the input field using firebug. and save it.

Unknown said...

but even though my linksys router have saved the broadcasting ip which ends with 255, I cant wake my computer from WAN. I can do with LAN perfectly but not WAN

Unknown said...

my software seems to check it on the html page and on some server page... i can send it 255, but it sais unsuccessful, any ideas?

Unknown said...

My backup file was encrypted, disabling JS was not useful, and using DOM to force the 255 failed. Thus, if you are using firebug or any java editor, first edit the blur rule for the input blank to allow 255 then you need to edit the script that runs when you press the save settings button. change submitF( to submit( and then pressing the button will just make the setting save vs checking to make sure the settings are valid before saving.


MP said...

Awesome work, I have tested the Android app with your configuration and the same router.

It works the first time but if I want to start the computer again I have to change port number next time I run the app?

Ben said...

I've from some users that this is a router configuration issue. As for my particular firmware, I've no problem reusing the same port. Other users recommend using dd-wrt instead ( ) if you run into an issue where it only works once.

MP said...

It seems to work if I try start the computer after I just have shut it down. If it's been of for some hours it's completely dead.

What firmware are you using?

Unknown said...

This app seems to work perfectly for my home computer which uses a regular cable hook up. But for some reason i can not wake up my office computer? It uses a T-1 connection with a cisco asa firewall any suggestions?

universalove said...
This comment has been removed by the author.
universalove said...

^ Ok, i'vebeen at it for a few hours now. Trying to get this to work on my ANDROID.

PC Settings -
Port Forwarded via Router: / UDP: 9
Static IP (wireless via OS): w/ subnet (also tried all 255s w/ port forwarded to .254)

Android App Settings -
MAC: **-**-**-**-**
IP or Domain: (and tried 254)
Port: 9
Sent As Broadcast (only works when this is ticked w/ wifi on the router)

But it only works when I have my android phone connected to wifi on the router (using 'Wake On Lan Monito'r to test). I tried port forwarding w/ UDP 9 and no matched static ip, same result. Tried NO static ip w/ same settings, same result.

Could someone be clear if this is stil working without being on wifi? I want to be able to wake the PC up from anywhere using my mobile 3g connection. Is there a domain name i could put in the android app to solve this? I'm a noob w/ networking, but savvy, please help me out. :)

Questions: Do i have to somehow get my IP Static to and Subnet to all 255s? Because it doesn't let me, says its invalid. I'm doing this using my OS, not web browser via router.

Great app btw. Just want it to work for me.

Anonymous said...

Hi universalove:

It took me hours to figure out how to get this to work. First set your pc to a static IP. Follow the instructions here:

Next install dd-wrt on your router. Then follow the tutorial on this page (take it slow and follow all the steps and it should work) Use the Port Forward method about half way down the page:

On my android device I unchecked the broadcast option.

This magic Packet Sender was useful to see if my computer was receiving the magic packet when sent over the internet from another pc, but was useless when sending from my android for some reason. The only way that I was able to see if I had my android set up properly was to turn off my pc and try to turn it on over 3g with my android.

Nick said...

Liking the idea of the app but im just curious, does it work over 3G? I want to be able to wake my pc from my phone while im at work. Been experimenting but cant get it to work.

Mike said...

How do I save the DOM modifications or revised .htm page to the router?

Unknown said...

Hi there!

I'm trying to use the app together with Tasker, but I'm lost after the long-press and Tasker Export? Is the PC or Group supposed to appear under Tasker's Tasks? Or do I have to go into the Task menues to find it there? I have read the linked Help page, but was hoping to avoid the Action Intent manual route... :-)

Ben said...

Hi Senso, you'll want to import the task to Tasker after exporting it from my app:

How can I import/export individual profiles, tasks etc ?


Go to the main screen, long click on the tab for the type of thing you want to import.

go to the main screen
long-click on the thing you want to export

Billy said...

Just curious, asking for feature request. Would it be easy to make it so the app doesn't open on screen if I click a shortcut? I'd be fine with a notification "packets sent" but it'd be cool if the app window didn't flash up at all.

Janis said...

I just want to note that in many instances (all I've ever seen) a DHCP reservation (letting the router dole out the specific ip without the pc having an opinion) works as well as a static ip, and it eliminates managing the ip from the client side altogether. HTH

Stu said...

Hi Ben,

Fantastic work! This app and your android app are the only ones that work for me because they have the option to not send as broadcast.

Is it possible to run the windows app from the command line?

arpe said...

Every now and then, one comes across something really neat and nifty. Ben's WOL is one of these moments. Very well done!!! Even at home, I'm getting used to turning my PC on by phone :-)

MickO said...

problem, bug?
go to import a profile from csv.
Get the warning that importing profiles may overwrite.
Click OK
Imports the fault with no option to file search folders.
I'm sure the mechanism in previous versions was an option to search. How else would I be able to import a csv that has been saved/downloaded into an another folder? e.g. I send the profile by email attachment to someone who I offer the opportunity to WOL.They save it to their phone, possibly in the download folder. Where is the mechanism to import from that folder by searching?

Otherwise, brilliant piece of work, Works wonderfully well and magicaly.

Unknown said...
This comment has been removed by the author.
Unknown said...

Please, can anybody explain with more details, how this work thru a router, after all the settings where made.
I have one ASUS RT-N56U, one Samsung Galaxy Note 3, Wol Wake on Lan Wan installed.
I have made all 3 steps with Wake on LAN from BIOS and Network adapter.
I tried with DOM Inspector.
It works only with WIFI, but 3G or 4G nothing.

Karl said...
This comment has been removed by the author.
Karl said...

Thank you for the detailed post. For those perhaps a bit technically challenged at times like me, or simply to impatient to read carefully, one element that helped me implement this approach is realizing the IP address to send packets to should be the cable company assigned IP, as apparently suggested in the next post. Also the newer versions of Linksys routes seem to have found how to prevent DOM inspector from adjusting the broadcast IP, I get a unique error message after attempting to adjust the DOM value.

Linksys router login said...

Thanks for sharing valuable information...
Linksys Router Login

Rea said...

I can't port forward to .255 in Linksys e5600. I don't understand the DOMI things - no such addon anymore, I tried using Firefox Developer (firebug lives in it now) but didn't understand anything like how to even find the value to change... or edit the html (wdym how in the world you edit & save a live web page?).

#disable java did nothing.
#changing the subnet & port forward the new broadcast address accordingly didn't work.
#the backup file is encrypted in .bin, found an amazing guy made an online tool to decrypt and encrpyt a .bin tp-link file but understandably doesn't work with my router .bin
#added an ARP entry .254 to ff:ff:ff:ff:ff:ff (broadcast MAC) by telnet & portforward to .254 also didn't work.

I disabled router firewall. WOL over LAN works fine btw. My tenda router doesn't need broadcast address for WOL over WAN but I used it elsewhere & don't want to buy a new router or any secondary device.

I don't want to use open-wrt because the wi-fi range is worse than stock firmware (confirmed by some guy in the forum, beamforming doesn't work with it's open-wrt apparently & no plan to support it, looks like). Though, it's been days I scoured the internet... I'm beginning to think about it, sigh...

Anyone has other workaround I can try? or maybe teach me that DOM or html/script editing thing, please. 'Cause I'm lazy atm to surf the web for it, some people couldn't get the WOL over WAN work even though they can save the .255 port forwarding - server side auth.?

I think some people get it to work by modifying the stock firmware, I skipped it because it looks difficult & risky for a noob like me, maybe I will look into it again when I've gone mad or something...