Wake On Lan Trials and Tribulations
I’ve been playing around with Wake On Lan on my network for quite some time. Wake on Lan is a system whereby remote computers can wake up other computers that are sleeping. This allows people to set their PCs to sleep to save energy, but then access the computer at a later time by waking it. Wake On Lan (wol) requires four things to work. Firstly, the BIOS must support it. Most newer computers have this. Secondly, the PC NIC (network interface card) needs to support it and be properly set up. This website gives a good guide on how to do this. Next, you must be able to send a magic packet from your remote computer to the computer that needs to be awoken, the Depicus website outlines this quite well. Lastly, your home network needs to be set up to handle the magic packet and wake on lan.
It was pretty easy to configure my Vista PC for wol, and using my laptop I was able to send magic packets to it without trouble. I used a Magic Packet Sender to send the magic packet. As well, I used this program on the Vista PC in order to monitor receiving the packets for troubleshooting. Things seemed to work pretty well. Next I tried to use my NAS to send the magic packet. To do this I downloaded a FreeBSD package called wol (here is a link to a thread which outlines how to get wol working on FreeNAS). Once I got this working I was able to send magic packets to my PC. However, it would not wake the computer. I was pretty miffed. I tried all sorts of different magic packet programs to troubleshoot the problem, programs such as those from Depicus and dslreports. I didn’t make much progress though.
I then decided to take a closer look my router. It dawned on me that there could be a broadcast issue. Since the PC is asleep, the router is not able to discern the PC’s IP address. I had set the router to forward the magic packet via port 9 to the PC IP address which was 192.168.1.150. I assumed that the router kept some type of arp table which remembered which port corresponded to which IP address. My experiments with the Magic Packet Sender indicated that this is how it worked. Instead, I decided to forward port 9 to a broadcast address. In other words, port 9 was forwarded to 192.168.1.255, and all computers on the 192.168.1.0 subnet would receive the packet. Lo and behold, this worked. I guess the Magic Packet Sender was broadcasting the packet the whole time without me realizing it. And since my testing was done at home within the subnet, the router wasn’t playing a role.
So there you have it. I can now wake my PC at home from both my NAS and from the web. It’s pretty simple once you figure out how to broadcast the magic packet. I can now use my NAS to wake the PC in the middle of the night to run an automatic backup, which was my primary motivation in getting this working.