I recently looked into options for powering on my computer remotely and came across something called Wake-on-LAN (WoL). This page is a compilation of information I have collected from reading various sources scattered throughout the internet and is by no means a comprehensive or authoritative guide on the subject. Please use this as a starting point for your personal WoL configuration needs and leave a comment below if you’ve found a mistake or if something doesn’t seem to make sense.
What is Wake-on-LAN?
WoL is a way for users to power on computers remotely across a network. Obviously, the computer must be plugged in to a power outlet for this to work, but it does NOT need to be in standby, hibernate or other power saving mode (i.e. WoL works from state S0)! As long as your hardware meets all the requirements and you have all the right settings configured, WoL will let you turn on your computer from anywhere within the local network (possible even over the internet but more on that later).How does it work?
With modern computers, even when they are switched off, the Network Interface Card (NIC) is still powered (you can test this by looking to see if the green light next to the RJ45 Ethernet port is still lit when the computer is off). This means the NIC can still sense and process network traffic, although it does not have an IP associated with it in this off state. WoL works by broadcasting a specially formatted Magic Packet to all computers in the subnet. This Magic Packet includes the MAC address of the target PC repeated 16 times in the data section. The target PC receives this broadcast packet and when the NIC identifies it as a WoL packet and the MAC address is a match the boot procedure is initiated via the appropriate hardware channels.Requirements and Setup
Your motherboard, NIC and operating system must all support WoL in order for it to work. I do not have any definitive lists of supported hardware but these days your chances are pretty good. To check if your motherboard supports it go into your bios and have a look for a Wake-on-LAN, Wake-on-PME or Wake-on-Network option (usually found in power management). If it’s there, enable it and restart. If not, check motherboard manufacturer’s website to make sure.Next you need to find out if your NIC supports it. I don’t know of any simple way to do this. Some people said that by going to Device Manager in Windows XP, navigating to your NIC, going to the properties window and clicking on the advanced tab may reveal some WoL options. Mine however does not have any features in the advanced options pane yet still works.
While we’re in the properties pane for the NIC, if you go to power management you’ll notice a checkbox that says “Allow this device to bring computer out of standby”. This does NOT need to be on for WoL to work (remember, we want to power up from a cold S0 shutdown state, not a stand-by state). You could try to check the manufacturer’s website and dig through online manuals, forums, etc. to make sure WoL is supported but I recommend just trying it first and then trying to find the missing piece if things don’t work.
Some motherboards require you to have the NIC in a particular PCI slot for WoL to work. Again, I don’t know of any way to find out which slot you should connect it to without reading manuals from your manufacturer or trying them all. Obviously, motherboards with onboard WoL capable NICs don’t have such dependencies.Sending the Magic Packet
You’ll need a program or script to send the Magic Packet needed to wake up your PC. Go here for a good source of programs that let you do this. The first one on the list, AMD PCnet Magic Packet Utility, does the job just fine and is free. Download it, extract it to a directory, open up the application, choose to ‘Power on One Host’ from the ‘Magic Packets’ menu, enter your broadcast IP the MAC address (destination Ethernet address) of the target PC and click send. If all the requirements are met and everything is configured correctly your target PC should turn on! If not, then happy troubleshooting… (Scroll down to Broadcast IP and MAC Address if you need more help on these two values).WoL Over the Internet
The ultimate power of WoL comes when you set it up to work over the internet. Think about it. You are able to turn on your home PC from anywhere in the world, at virtually any time! Once on you can setup a VPN connection and access all your files or even better setup a VNC or other remote desktop connection and use your computer as if you were sitting right in front of it. This is good if you’re away on holiday, travel a lot, want to access your files from work or forget your school assignment at home and realise just when you go to hand it in.
Getting WoL to work over the internet can prove to be challenging though as you cannot directly send a broadcast Magic Packet since you are not physically connected to your subnet (i.e. you are separated by one or more routers from your network). Broadcast packets are not forwarded from one network to another for obvious reasons (one packet could flood the whole internet!). This means that you need to send a unicast packet to your router at home and the router must then broadcast this packet to the subnet in question. This sounds simple but unfortunately most low-end routers do not have this feature (including mine).
Setting up a simple unicast port-forwarding rule won’t work because the target PC is off and hence has no IP, so when the router tries to forward the packet it does an ARP query asking ‘who’s IP address is this?’. When nobody responds it drops the packet (or forwards to default gateway if up). This happens even with static allocation as the IP stack is part of the OS and not part of the NIC processor.
I even tried hacking my router to allow me to set up a unicast-to-broadcast forwarding rule (i.e. forward anything received on port xxx to broadcast IP address) and I managed to get the router to recognize the setting, but the packets were never forwarded (as expected). I asked technical support and they said it wasn’t possible on that model.
WoL Over Internet Workarounds
The three workarounds I know of are:
- Get a router that supports unicast-broadcast forwarding (so in essence setting up a NAT entry for broadcasting packets received on a certain port to the whole subnet);
- Get a router with VPN endpoints so that you can set up a VPN connection directly to your router and then send the Magic Packet as if you were directly connected to your home network (broadcast over VPN connection);
- Connect to some other device/server in your local LAN (ssh, telnet, VPN) which is already on and use that to send a Magic Packet (although this defeats the purpose of WoL over WAN as you already need to have an always-on device in your LAN).
FYI - Broadcast IP and MAC Address
The broadcast IP address is a special IP which when used as a destination sends data to all PCs on that subnet. So for example, if your IP address is something like 192.168.1.1 and your subnet mask is 255.255.255.0 then your subnet broadcast IP is 192.168.1.255. If your IP is 169.192.1.1 and your subnet mask is 255.255.0.0 then your broadcast IP is 169.192.255.255. Notice the pattern? A zero in the subnet mask is substituted for 255 in the broadcast IP.
The MAC address is a globally unique (in theory) hardware ID hard-coded into every single NIC. You need to find the MAC of your target PC in order to use WoL. There are several ways of doing this. Easiest way is to turn on your target PC, go to a command prompt and type ‘ipconfig /all’. Look for the ‘Physical address’ of the corresponding NIC. That’s your MAC.
The AMD Magic Packet utility has a feature to scan the network and make a list of all MACs as well. This is useful for large networks where the above procedure would prove tedious.
Some useful links:
Wake on LAN
没有评论:
发表评论