Last friday I was at work and a collegue of mine asked me some info, that I know to have on my own home pc.
Unfortunately there was 2 issue: my home pc was shutted down and nobody was at home. So I had no way to remotely log in my machine as it was unpowered.
Therefore today I’ve decided to configure my home network and pc to be remotely turned on, and of course to do this I have to use the Wake-on-Lan protocol.
This is my configuration
ADSL modem-router: LynkSys WAG120N V1.00.12
Motherboard: Asus p7p55d-e premium
Operative system: WIndows 7 Ultimate
Mobile: LG-E900 (Windows Phone 7)
The goal was to turn on the pc by using my Windows Phone. But to achieve this all the 4 pieces above have to cooperate.
WoL protocol is quite simple, basically WoL enabled network card says partially powered even if the pc is shutted down and waits for a so-called “magic packet”. when they intercepts it on the wire they send a particular message to the motherboard, that simulates the pressure of the power button (… ok I’ve made a long story short…)
First of all: you need a motherboard (and/or a network card) that supports the WoL protocol, and you have to configure it correctly to accept the magic packet.
Fortunately the major part of the motherboard today supports WoL, but you have to enable it.
On my Pc I had to do two different things:
Enter the BIOS and then in Power –> APM Configuration I have to turn to ENABLED
Power on PCI Devices and
Power on PCIE Devices.
To tell the true I suppose that only one of these is required, if you discover which one please let me know I’m bored to reboot my pc for today
Then on the Power page of the bios you have to turn on DISABLED
EuP Ready. This is Because otherwise the Network card will go to sleep completely when the pc is turned off, and doesn’t waits for the magic packet: see the help text on the right!
At this point your BIOS is ready: save and exit and start Windows 7 in all its glory!
In windows you have to be sure that the network driver is configured to wake up the computer.
So go in Control Panel –> Device Manager
Select the network adapter at which the router is connected to and then
make sure that Wake on Magic Packed is set to Enabled, and that
all these cutie checkboxes in the Power Management section are selected
Now also Windows is happy to be waked up by a “phone call”
Let’s do the hardest part now, prepare the switchboard operator (our router) to forward the call to the correct recipient, even if it is sleeping.
This part is quite tricky, mainly because consumer-level modem router doesn’t allows all the cute things that enterprise class devices does, but fortunately there is a workaround.
The problem is that the WoL protocols intended to be broadcasted on a subnet, the magic packet itself contains the MAC address of the device that have to be turned on, but my router disallow (explicitly) to forward broadcast message.
This is because (I’ve discovered) of an important security reason, an attacker could broadcast ping on a large subnet by creating an evil the ping packet which in turn contains as reply address the IP of the target of the attack.
Generating this packet and broadcasting it on a large subnet it is a smart way to have a large number of ping response back, directed to the target, that can possibly saturate the bandwidth causing DoS smart and cheap (for the attacker!)
So on consumer router this feature is disabled by default and some router explicitly neglect this possibility.
The workaround is to forward a port to the machine we want to turn on, instead of broadcasting it, the effect is the same and we will have a port dedicated to the powering of a machine.
If we want to turn on different machines, unfortunately we have to create 1 port forward for each machine that needs to be turned on… but if you have 100 pc probably you are not using a consumer level router.. isn’t it?
so let’s see how to set up the Router and the Pc.
first of all let’s assign a static IP to the machine that needs to be turned on (this is necessary to make the port forwarding effective…, but check the notes below for more info)
Set a static IP on it
I’ve set 192.168.1.100 for my pc
And now set up the router.
I’ve a particular IP assignation in my home network the important thing is that the address you assign to the pc you want to be powered up will be static
on my router this means that 192.168.1.100 is static,then I have 49 dynamic ip that DHCP server can assign, then the remaining are static again.
then switch on the “Application and gaming” tab
and add a rule like this
this forwards the port 9000 UPD to my pc IP… Note: some ISP blocks lo ports suck 7 and 9 so if you want to use the port 9 that is usually the standard one for WoL, it may not work… just because your ISP blocks it, then try something higer. My port 9 is blocked and I have to use 9000
One last thing: you need your router IP to be reachable… I have a dynamic IP assigned by my ISP therefore I use DynDNS to have a way to always reach my router
The DynDNS service is free if you are happy with a third level domain name. or you can pay it if you want a full-fledged second level domain name (I’ve both but for the router I use the third level one)
At this point also your router is configured and you can always reach it from everywhere using the domain name you have choose!
Now take your Windows Phone in your hands: go to the market place and search an app called “Wake-On-Lan”
This app doesn’t looks very nice but works well! so take it, it cost just 0.99 I’ve bought it without thinking too much.
Start the app and then configure it: it’s very easy
you just have 5 fields
- Title: a friendly name you want to use to identify the machine you want to turn on
- Host Name: use the Host Name you have configured in your router Dynamic DNS page, or the static ip of your connection, if you have one (in my case XXXXXX.homeip.net)
- MAC address: the physical address of the network adapter connected to the router on the PC you want to turn on, you can discover it by typing “ipconfig /all” from a command prompt on the machine that needs to me waked up (be carefull to look at the correct network adapter!) I’ve entered my mac address in the format X1:XZ:2Y:34:56:WK so I’ve used colon symbol, and it works!
- subnet mask: for me is 225.225.225.0, just use the subnet mask of the LAN where the machine that you want to wake is.
- Port: the port we have forwarded: 9000 for my example.
if you want you can save this set up so you have to not re-enter all these data every time.
And now it is done!
You can now test the set up: there is a very handy program to do the test, you can find it on depicus together with other dozen of wonderful resources and docs about WoL.
just run it and configure init the port you have forwared (9000 for me) and press start.
Then from the Windows Phone App send the magic packet: if something appears on the screen, then everything is configured correctly (remember to enable the windows firewall to allow the monitor app to access the network for listening a port…)!
If it doesn’t work, probably the port you have choose is blocked by your ISP: choose another one (and reconfigure the port forward on the router accordingly.. and update the WP7 app too!)
One the monitor works it is time to make a real test! turn of your pc and then send the magic packet! it should wake up Mine does, and I’m very happy with it!
Notes:
I’ve not understood well how the port forwarding works: I’ll try to explain me better.
If the pc is shouted down the OS is not running, therefore there is no IP stack listening the wire… therefore no IP address… then why we need to forward to an IP address?
I’ve tried to forward the port to a non-existing address, as I’ve thought that the message pass on the wire anyway and the NIC will pick it pup if it sees the magic packet with its MAC in it.. but it doesn’t work in this way, it could work in this way if your router support subnet message broadcasting.
as mine does I have to forward it to an IP. it is still unclear to me why it works only if I forward the message to the correct IP, even if no IP stack listening that address is running… I suppose the router remembers the last mac associated to that IP, but I’m not certain of it, but probably this is the answer. so be sure that the router have seen that IP associated to that MAC at least one time (you have to configure the parts when they are already connected together, not offline!)
Enjoy your WoL!
UPDATE 07 Nov 2015:
some months ago i've updated to windows 10, it's turn out that WOL doesn't work anymore. That's not an issue with the above mentioned procedure: it is the default Microsoft driver for my realtek NIC that'doesn't support WOL correctly
the solution is easy, just to install the last version from the realtek site
even if my NIC is a "Dual Gigabit LAN controllers Realtek 8112L/8110SC Gigabit LAN, that doesn't appear on the vendor driver page download list it just download it and install, to me it worked great, the installation went successfully and everything returned to work!
Just a funny thing, now the LED on the NIC port turns off when the pc is shutted down, ut the magic packet is able to turn it on anyway! :) YAY!
Tags: