Posts | Tags | Archive

Wake-on-LAN: Configuring your PC, Tomato & iPhone

Note

This post is heinously out of date but I'm keeping it around for historical purposes anyway

So this article at Lifehacker got me thinking about setting up Wake-on-LAN (WoL) for my system. For several years I just left my PC on 24/7 to VNC into it anytime, which I stopped doing because it was a massive waste of electricity (i.e. money dollars). I don’t need into my computer remotely very often but WoL turned out to be the optimal solution for when I do. My personal setup required several things:

Enable WoL in the computer’s BIOS

  • Configure Linksys router running Tomato USB firmware
  • Setup DynDNS to always be able to locate my network from the internet
  • Find an iPhone app to send the “magic packet“, which tells your computer to turn on
  • Enabling WoL in your BIOS

Both my PCs are somewhat older and don’t have settings labeled “Wake-on-LAN” but instead “Wake-on-PME” (power management event) which is the same thing, enable the option and boot your computer.

On Windows 7 both my machines had WoL enabled by default but to verify you can open your network adapter in Device Manager and check the Advanced tab to see if the property pertaining to WoL is enabled. For me one machine used the property “Wake on Magic Packet” and the value “Enabled”, another used the property “Wake-On-LAN Capabilities” and the value “Pattern Match & Magic Packet”. It’s all driver specific so yours could be a variation of those.

Ethernet adapter in Device Manager:

Wake-on-LAN Device Manager

WoL doesn’t always work when the computer is off (depends on the machine), because the network card has no power and thus can’t receive the magic packet, so your PC may have to be in Sleep or Hibernate mode. In Win7 you can change the default shutdown option to hibernate; click the Start orb and right click on Shutdown, choose properties, change the Power button action drop-down to Hibernate and click OK.

Configuring Tomato for WoL

After you have Tomato (or Tomato USB) installed take a few minutes to secure it for remote access. This will let you log into the web interface or SSH in to a command line for testing or other uses in the future.

Tomato has built in WoL functions under Tools->WOL where you can click any MAC address listed to send the wakeup command. For easier identification I’ve given all my devices static IPs and names under Basic->Static DHCP. Worst case you can always log into your router this way to boot your computer, bypassing the complexity and problems of WAN control as Tomato effectively sends the command from inside your LAN.

The hiccup for internet control of WoL is when your computer has been off for 20 minutes or so you won’t be able to send the magic packet from the WAN anymore. You can still login to Tomato and wakeup the computer but that’s it. This is because it’s address has expired from the ARP cache and you’re boned. The Tomato WoL page lists device status, if it is “Active (In ARP)” then internet WoL commands will work, otherwise no go.

The solution is to send the magic packet to the broadcast address for your subnet (generally 192.168.1.255) but Tomato won’t allow that, so we work around it by turning 192.168.1.254 into the broadcast address by adding these two lines to Administration->Scripts->Firewall:

1
2
ip neigh change 192.168.1.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br0
ip neigh add 192.168.1.254 lladdr ff:ff:ff:ff:ff:ff nud permanent dev br0

How Tomato looks:

Tomato firewall settings

Reboot your router. If you secured your router for remote access as suggested earlier, SSH into it and run the following command to see if the output includes your new settings:

1
2
user@server$ ip neigh show
192.168.1.254 dev br0 lladdr ff:ff:ff:ff:ff:ff PERMANENT

You’re in business, now go to Port Forwarding and setup a forward for UDP on some high port (5500, 8888, whatever) to internal address 192.168.1.254. Now internet originated magic packets will be broadcast to all devices on your network, but only the machines with the correct MAC address within that packet will respond.

This workaround of the ARP expiration problem does introduce a minor security issue that most home users can safely ignore. We’ve created what is called a Subnet Directed Broadcast which if an attacker knows your WAN IP, the port number you forwarded, and that there is a SDB on that port they could initiate a type of DDoS called a Smurf attack. In reality you could be just as easily DDoS’ed without SDB set up and besides, the bad people are more concerned with infecting your PC to steal data, sell you fake anti-virus software or act as a zombie in some botnet, not blocking you from playing World of Warcraft.

Setup DynDNS to locate your network from the internet

While you could just use your WAN IP address directly, available from the Tomato status page or icanhazip.com, the pro route is to setup a DDNS (Dynamic DNS) service like DynDNS as detailed here. That way you get an easy to remember subdomain like SweetMeats.DynDNS.org and when your ISP inevitably changes your IP address Tomato will notify DynDNS and you won’t notice anything has happened.

At this point you should be able to boot your computer via the internet, hibernate your computer and use this handy website to send a magic packet. If my instructions are worth their salt you should hear your loud-ass computer booting up, WHIRRR.

Sending the Magic Packet from your iOS Device

I tried a few WoL iPhone apps before settling on RemoteBoot Lite which is free and works perfectly. For the most part paid WoL apps in the AppStore are ripoffs, why pay $3+ for a function as basic as sending the magic packet? Anyways, type in your DynDNS domain under Name, the MAC address to your computer (from Tomato: Status->Device List or via other methods), tap the DNS button which will resolve your domain to an IP address and set Target Port to whichever port you setup for UDP forwarding earlier.

RemoteBoot Lite

That’s it, tap the Boot button and if your computer is hibernating or asleep it should wake up. It took a lot of trial and error to get to this point however and I did a lot of backtracking so don’t give up if it doesn’t work on your first attempt, but if I was to do it all over again this would be the shortest path.

Well this ended up being a lot more in-depth than originally intended. Hopefully someone can use it.

© Justin Montgomery. Built using Pelican. Theme is subtle by Carey Metcalfe. Based on svbhack by Giulio Fidente.