Wake-on-lan

From ComputingPlugs

Jump to: navigation, search

You can use the Sheeva Plug to wake up other computers on your local network. This is useful if you have a separate computer that is not alway on but needs to be every so often. This is also useful in an office environment where you want to wake a group of office PC from a centralized point. With the Sheeva Plug, you can create very elaborate alarms which you cannot do with the PC's BIOS alarm clock.

The application to generate the wake-on-lan(WOL) magic packet is call wakeonlan and you can get it by:

apt-get install wakeonlan

That is the easy part, now to set up the remote computer so that it will respond to the wake-on-lan magic packet.

Contents

Hardware needed for Wake-on-lan

Almost all modern computer hardware(within the last 10 years) will do wake-on-lan, but here are the basics:

  • Power supply that can run in standby mode. This means that it is always suppling a little bit of power to wake up itself.
  • Motherboard that supports wake commands. There are many wake up options, not just wake on lan.
  • If you are using a separate network card, you will need a wake on lan cable that connects the network card and motherboard. If the network adapter is part of the motherboard, you likely don't have to worry about this.

Set up the remote computer's BIOS

The remote computer's BIOS has to be set up so that it will power up the computer when the network adapter tells it to do so. This part varies wildly from computer to computer. However, you will have to at least configure the BIOS to "wake on lan" or "wake on PCI device". There are other "wake on <events>" and it may be one of those instead. There may be a bit of trial and error in this step.

Set up the network adapter to respond to WOL

It is almost impossible now to get a network adapter that doesn't support wake on lan. However, the network adapter does not respond to wake on lan packets by default, so it must be configure to wake on lan. This step is different base on the operating system you are using.

Windows WOL configuration

Windows

To configure the network adapter in Windows, go to the Network Properties and find the network adapter you want to enable wake on lan. Then go to the Properties of that network adapter and click Configure. You will then see a new window that looks similar to the picture on the right. Select Advanced and you will see the capabilities of the network adapter. One of the capability should be wake on lan. Highlight that and make sure it is enabled.

Linux

to configure wake on lan in Linux, first make sure you have ethtool install on your remote system. Then, determine which network adapter you want to use for wake on lan (ie, eth0, eth1...). Then to enable wake on lan on that adapter (eth0, in my case), you type:

ethtool -s eth0 wol g

Make sure you run the command as root. The command returns nothing if it works. You will get an error message if the command doesn't work. The difference between Windows and Linux in wake on lan is that Windows will set up the wake on lan bit in the network adapter every time it boots. Linux, on the other hand, requires you to enable wake on lan manually each time. A lot of people run into this difference and can't figure out why their Linux box woke up once correctly but couldn't do it again.

To fix that, edit /etc/rc.local and add the command

ethtool -s eth0 wol g

so that it is enabled each time the machine boots.

Wake on lan over WiFi

I have been told wake-on-lan doesn't work over WiFi. I have been told that it didn't work before but it works now. I have been told that it had always worked. I don't know which is true because I have never tried it. All I can say in this matter is to get wake-on-lan working on a wired network first, then tried it over wireless.

Send the magic packet

Write down the MAC address of the remote computer and turn the remote computer off. Then, type the follow command on the Sheeva Plug:

wakeonlan 00:11:22:33:44:55

In this case, I use the MAC address of "00:11:22:33:44:55". If everything was configure correctly, the remote computer should power up. If not, I suggest checking the BIOs and try different settings.

Wake-on-wan

This has nothing to do with the Sheeva Plug but it is useful information anyway. You can wake your computer at home from another computer on the Internet. Some say it cannot be done because wake-on-lan magic packets are broadcast packets, and most routers will drop broadcast packets. This is true, but with a little setup you can send a unicast packet from the Internet to your external IP address and then have your router broadcast the packet to your computer. First, the setup:

                 
                   24.165.51.150
+------+                  +--------+    +------+
| PC 1 |<--> Internet <-->| Router |<-->| PC 2 |
+------+                  +--------+    +------+
                             192.168.1.1    192.168.1.100

You are trying to wake PC 2 sitting in your home from PC 1 at the office. PC 1 has a connection to the internet. PC 2 is connected to your home router. The Router has the external IP address 24.165.51.150 that is visible to the Internet and an internal IP address of 192.168.1.1. PC 2 is connected to the internal network and has the IP address of 192.168.1.100. The router in this example is any consumer grade router like a Linksys or Netgear. This should be a very typical home network setup.

Needless to say, PC 2 has to be configure correctly for wake-on-lan before it will work for wake-on-wan. So be sure to test the wake up function of PC 2 with another computer on the internal network before attempting wake-on-wan.

To configure the router to rebroadcast a wake-on-wan is actually very simple. You just have to know that wake-on-lan magic packets uses UDP port 9. This is the UDP discard port usually and is not process. So you need to configure your router to forward UDP port 9 to the broadcast address of your internal network. That is the trick to make wake-on-wan work, forward the magic packet to the broadcast address. In my case, my broadcast address is 192.168.1.255, so that is what I put into my router's port forwarding table.

After the setup, you can use wakeonlan from PC 1 in this fashion:

wakeonlan -i <IP address> <MAC address>

where the IP address is your external IP address and MAC address is PC 2's MAC address.



Comments:
  • Kenny Says:

    Please keep comments clean and constructive. Inappropriate comments will be removed. Thank you.

  • Andy Says:

    Most routers I've worked with (Netgear included) do not allow you to redirect ports to a broadcast address. This is what I'm struggling with. So that bit is not as easy as you might think.

  • Kenny Says:

    I guess I've been lucky then because the two that I've had do allow redirect ports to a broadcast address. The one that's working right now is a D-Link DIR-655. I know my old Belkin also works but I don't know the model number (it broke so I've already tossed it away).

  • Mark Says:

    Hi, how do I determine the broadcast address of my router?

  • Kenny Says:

    You can figure it out with the netmask and the router's IP address. So if your router's address is 192.168.1.1 and the netmask is 255.255.255.0, then your broadcast address is 192.168.1.255. Another example, if your router's address is 10.1.1.1 and your netmask is 255.255.0.0, then your broadcast address is 10.1.255.255.

Click here to leave a comment




... ...

Did you find this page useful?
Help others find this site
by linking here.

... ...
Personal tools