Implementing WOL

WOL

Wake on LAN (WOL) is a platform-independent networking standard which allows to “Wake-Up” (resume from shut down / hibernate / sleep) a computer remotely by a specifically crafted network message called a magic packet.

In order to use this protocol first of all you must have compatible hardware. This includes the motherboard, BIOS and network card.
You should use an Ethernet network connection as WOL in most cases will not work over wireless (there are some exceptions). As an alternative to wireless, you can use one of many available HomePlug devices. WOL works fine over HomePlug.

Configure Hardware:

First of all boot into BIOS (when the computer boots press F2, DELETE, or other key depending on your motherboard model) and enable WOL support. Normally this is located under the “Power Management” section and can be called Wake-on-LAN, Remote Wake-up, or something similar. Most of modern computers will have this option, however, if you have very old hardware you may be out of luck.

Also, check for power-saving modes in BIOS. Some of them may are not compatible with WOL. There should be explanations next to each mode. Or you can just disable all of them to start with.

If your motherboard and BIOS are compatible with WOL, the integrated network card will be compatible too. However, if you use an external or PCI network card, check the card’s compatibility as well. Some PCI cards need to be connected via a special WOL cable to the motherboard or to be plugged into a specific PCI port.

Configure router / firewall

If you only intend to use WOL on your local LAN network you can skip this part. However, the most useful WOL feature is the ability to wake up remote computers over the Internet.

First of all, if you are on residential broadband, your ISP most likely has issued you a dynamic IP address. This means your WAN IP address regularly changes. To get around that you can use NO-IP or a similar dynamic DNS service. Most routers have some sort of Dynamic DNS support, some even have their own dynamic DNS service.

To make WOL work over WAN you need to forward all WOL magic packets coming from the Internet to your LAN network. In theory, any UDP port can be used for WOL, but normally it’s either UDP port 9 or 7. This works in a similar way as standard port forwarding. The difference is, that when a computer is switched off it doesn’t have any IP address, therefore you need to forward WOL packets to all devices (MAC addresses) on the network. This is normally done by forwarding UDP port 9 or 7 to a broadcast address.

Broadcast address is the last IP address on your local network. In standard home network setups with 255.255.255.0 subnet mask, it will normally end in 255. If your computer’s IP address is 192.168.0.x your broadcast address will most likely be 192.168.0.255. Simply forward incoming traffic on UDP port 9 to your broadcast IP address (192.168.0.255 or other) and you should be fine.
It’s impossible to give exact instructions as web interfaces for different routers can look completely different. If you are unsure check your router’s manual or search online for your router’s model + port forwarding.

Unfortunately, port forwarding to the broadcast address may not work on some routers, especially cheaper and IPS provided devices. In this case, you can try forwarding WOL packets to your computer’s normal IP address, but make sure you set up a static IP reservation for your PC’s MAC on the router. Sometimes it works great, but with some devices, you end up in a situation when WOL only works for few minutes after you shutdown the PC. This is because of ARP cache and how works on some routers. ARP links the device’s IP address to its MAC address. Routers periodically purge the ARP cache removing devices which are no longer on the network. When computer entry is removed from the ARP cache, port forwarding to the IP address is no longer possible. On some routers setting up a static IP reservation makes ARP cache keep that particular IP-MAC entry indefinitely, so it’s worth trying. One more option is to manually enter a static ARP record into the router’s ARP cache. This is not something you will find in cheaper routers and in some cases, it is only possible over SSH/Telnet interface.

If everything fails you may need to find another, more advanced router. It’s also worth checking if your router is supported by DD-WRT. If it is, you can replace your router’s firmware with DD-WRT which will support WOL and many other advanced features.

Send “Magic Packet”

Once the hardware is configured, make sure you know your network card’s MAC address. In Windows, you can find it by running ipconfig /all in a command prompt.

If you want to wake up a computer on the same LAN network you need to send a magic packet to your network’s broadcast address from any other device on the same network.

You can download a free magic packet sender from for Windows PCs from here or here, for Android/Samsung from here, iOS/iPhone from here.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *