Wake On LAN over the Internet

Having recently set up a linux box at home to host things like VMWare Server and generally provide access to things I want remotely while working away, I also wanted a way to be able to fire up the box only when I wanted it to be running. So, I figured I’d set up the Wake On LAN feature of the box to be exposed to the internet.

Here’s how I did it…

  1. Get the code
  2. Set up the router
  3. Send the packet

1) Get the code

Paul Mutton has put up some Java code that allows you to send a Wake On LAN packet. Now the great thing about Java, as everyone knows, is that it is cross platform so all you need is Java to be installed to be able to run the code.

Now, if like me you’re perhaps worried about bots etc on the net that poke around on known internet ports as they crawl the internet, you might want to change the port number that is exposed to the internet so that its a bit more difficult for someone or somebot to work out that it can send a Wake On LAN packet to the address. I know that you need to also specify the MAC address when you send the packet but I just like the extra layer of disguise.

So, open up the WakeOnLan.java file and edit the following line to a port number that you want to use:

WakeOnLAN Port Number Code

WakeOnLAN Port Number Code

There is no change you need to make to the target ‘sleepy’ computer – port 9 is still the port that will be used to wake it up, but we’ll convert the port 9 to port N that you’ve chosen to expose to the internet at the router level (See next step).

Compile the code by opening a command line up to the location of the WakeOnLan.java file and type:

javac WakeOnLan.java

This should create a WakeOnLan.class file so check that there were no errors and that the file was created.

2) Set up the router

Right, now this bit is going to be specific to your router but here’s what you need to do:

  1. Make sure that your ‘sleepy’ computer is known to the router and either has the same IP assigned to it every time locally OR that the router is intelligent enough to map the firewall rule to the same device each time, regardless of which IP it dishes out to it.
  2. Set up the firewall rule to map your chosen exposed port to port 9 on the ‘sleepy’ computer.

For me, I have an O2 Thomson Router (TG585v7) some people on the internet have described that they’ve had to telnet to the router and set up arpadd, this is necessary to enable the permanent routing of the wake packet  even after the computer has been off for a long time (see below).

Here’s how I’ve set it up on my router, if you’re using a different router you’ll have to try something similar:

  1. Go to the router web page and navigate to Toolbox > Game & Application Sharing.
  2. Click “Create a new Game or Application”
  3. Name it as you like, I’ve called mine WoL
    Firewall Rule Name

    Firewall Rule Name

    Be sure to select “Manual Entry of Port Maps”

  4. Select UDP and enter in the exposed port number range in the first boxes and the target port of 9.
    Port Range

    Port Range

    I’ve used 12345 as an example port exposed to the internet here, but use whichever port you’ve chosen. Click Add when you’re done.

  5. Now we need to assign this rule to the ‘sleepy’ computer… Click on “Assign Game or Application” near the bottom of the page:

    Assign firewall rule link

    Assign firewall rule link

  6. Assign the newly create rule to the computer you want to wake and click Add

    Select device

    Select device

  7. You’ll have to define a static ARP entry on the router, just creating a static IP from within the GUI wasn’t enough for me – after a while if the ‘sleepy’ computer was off-line then the Wake packet seemed to have no effect. I think this is because of the dynamic nature of the router perhaps marking the device as down and no longer forwarding packets. Anyway, based on a similar issue to here, this is what you need to do:
  8. telnet o2wirelessbox.lan
    (Google for the password)

    (If there is an entry for your device then use arpdelete to remove it first)

    Select intf and hit return
    Use the down arrow to select LocalNetwork and hit return
    Fill out the IP and MAC address also

    When done, type arplist and see that there is an entry with STATIC listed

    NOTE: I had this gotcha when I had to redo this on my router after a hard reset… You need to have your target machine powered down once you delete the ARP entry, otherwise it gets assigned another one dynamically – so beware of this if you find that your new entry is still DYNAMIC rather than STATIC.

    If you don’t make sure it is STATIC then the route times out after a while and your WOL packet won’t get sent on.

  9. Tab to cancel to exit the menu
  10. Type “saveall” to persist the configuration after a reboot
  11. Type “exit” to log out of the telnet session.
  12. Done!

3) Send the packet

So hopefully, the router rule is set up with the same port that you’ve coded into the Java class and are ready to send the packet from the internet to the router.

I’ve set up a DynDNS address so that I don’t have to find out the IP address every time. Most modern routers support the ability to update a Dynamic DNS service such as DynDNS, it will mean that you don’t need to know the IP and it will automatically get updated should your internet connection be reset for any reason.

So, the information you need to be able to send the packet using the ‘customised’ code is:

  1. The external IP address of the router OR the Dynamic DNS address that you’ve set up
  2. The MAC address of the network card that’s listening for a Wake on LAN packet on your ‘sleepy’ computer

Upload the code you compiled in step 1) to a computer you’ll be using from outside the local network and execute the code from the command line in the folder you’ve placed the code. For example:

java WakeOnLan your.dyndns.address 00:11:22:33:44:AA

You can swap the dynamic address above for the IP address if you wish.

Next step – give the box some time to boot up!


If you’re setting this up at home and have remote access to a computer outside of your local network, it will help you to be able to test and verify that things are working. You can use the external computer to send the Wake on LAN packet from the outside and watch to see if the computer actually wakes up.

I hope this post is useful to anyone trying the same, I’ve written it up mainly for my own benefit to remember how to do it next time around but let me know in the comments if you’ve found a better way for your set up. I personally like the Java code approach as I can run it anywhere and don’t have to install a program to the external computer that’s doing the waking; I use a variety of computers with differing operating systems so I like the light-weight approach 🙂

Firefox 3.5 Addons

FIrefox 3.5 4gb addons

Firefox 3.5 4gb addons

Anyone else see this odd one when upgrading from Firefox 3.0 to 3.5? Everything went smoothly despite the description of 4gb addons and they were all updated but thought this was an odd one…

My first impression of Firefox 3.5 is that it is still a bloated beast when compared to Google Chrome or Safari 4. The load times for the application itself seems sluggish still, Chrome opens in an instant and I think Safari is a mid ground between the two. It’s all a bit speculative as I’ve not done a proper test but they’re my impressions anyway.

I’ve become very fickle with browsers and use whatever suits my mood but when it comes to work I use Chrome and Firefox if I have to because of some compatibility issues on a few sites for Chrome. For home use I tend to use Safari 4 at the moment but I have Firefox 3.5 and even Flock installed, though I don’t even remember the last time that was fired up!

I look forward to when XMarks is available for Safari 4 as it will help maintain my favourites across systems and browsers, its a shame Chrome isn’t even on the list yet though!

Up until now, you might notice I’ve left out a certain (pointless) browser out of the picture but I feel I have to mention it purely because of the rediculously comical PR stunt as shown at lifehacker! Hilariously they believe that IE8 is more secure, private and reliable than Firefox or Chrome, all I can say is HAHAHA Microsoft are branching out as global comedians. Thanks for the laughs lol

Safari 4

If like me, you use Safari and had the Safari 4 beta installed before the actual release came out, you may have found that its a bit slow after the update.

Well, I remembered that the beta stored a ridiculous amount of cache for the top sites previews and thought, hrm I wonder if thats the cause… turns out it was (at least for me anyway!). You can clear out the cache in the official release by going to the Safari menu > Reset Safari and selecting the options below.

Safari 4 Reset Top Sites and Clear the preview cache

Safari 4 Reset Top Sites and Clear the preview cache

Of course you can select more if you want to.

Facebook loaded much faster, as did iGoogle. Not sure how efficient the public release will be at maintaining a tidy web page preview cache but the above steps not only made the pages load faster, it stopped the errors I was getting for some reason – I can only guess that Safari was having a hard time trawling through the cache and gave up the ghost and pretended it didn’t have a connection by timing out… that’s just my guess obviously.

Anyway hope this helps anyone else who has a similar problem.

GlowWorm is a Leopard Killer

Right, if any of you own a Mac with Leopard on it… AVOID GLOWFORM FIREWALL LIKE THE PLAGUE. Yes its my fault for trying it out without reading other people’s comments on http://osx.iusethis.com before installing it but in my curiosity I just went ahead and tried it.

Big mistake, apple discussion forums and comments on iusethis all say that it breaks Leopard. It doesn’t just temporarily break things, in my case I installed it, ran it, it crashed, then every other program running crashed, then i couldn’t log out or restart! Only thing left was to hold the power button and try and restart and uninstall.

Well that didn’t work because on boot up, you can’t get past the blue screen before the login window. Most people with this problem have managed to safe boot their mac and delete the application files. Just my luck that I can’t even get that far!

So yes, avoid this software completely! More fool me for thinking that I could need more than the OS X built in firewall. Thankfully I have everything backed up on my time machine so I’ll just wipe and restore when I dig up the Leopard install DVD.

I almost don’t want to post the icon of this page but I think it deserves to be shown so you know to associate this logo with MacMurder…

Update: I called up applecare who told me of another little keyboard shortcut for startup – the ALT a.k.a Option key. This asked for my firmware password then allowed me to select the Leopard install disk. From there you can select Utilities > Restore System From Backup and use your Time Machine to restore the system completely.

It’s going to take a while (3 and half hours) but at least it will be restored! No idea why on my particular issue, none of the other startup key commands would work.

Google Docs

Yet again, Google have made another release of some funky online based software – Google Docs is the replacement for the spreadsheet only site and combines spreadsheets and text documents! Not bad for simple note taking that you want available to you on any computer with an internet connection!

« Previous Entries