Wake-on-LAN (tutorial)

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 22:09, 13 April 2010 (edit)
Phuzi0n (Talk | contribs)
(Step Three: Wake On LAN over the Internet - - assigning a static ARP entry pointing to the broadcast MAC address is bad!)
← Previous diff
Revision as of 23:00, 13 April 2010 (edit) (undo)
Phuzi0n (Talk | contribs)
(cleanup the page layout)
Next diff →
Line 1: Line 1:
 +==Introduction==
WOL provides the ability to wake-up a sleeping, hibernating, or powered-off computer. Chances are your computer has the WOL feature. WOL provides the ability to wake-up a sleeping, hibernating, or powered-off computer. Chances are your computer has the WOL feature.
Line 5: Line 6:
* You run a server or computer all the time, and want it to shut down in case of over-temp or other situations. If this happens, you may still need to access documents on the server, from inside or outside the home network. * You run a server or computer all the time, and want it to shut down in case of over-temp or other situations. If this happens, you may still need to access documents on the server, from inside or outside the home network.
-==WOL: First steps==+==Preparation==
-:Windows XP:+You will need:
-::You will need:+
# A PC which supports WOL. Most modern PC's can be set-up this way. # A PC which supports WOL. Most modern PC's can be set-up this way.
# Administrative access to the computer you want to sleep/wake-up. # Administrative access to the computer you want to sleep/wake-up.
# The '''WOL''' computer should have a static IP address, one manually assigned or through static DHCP. In the example below, we assume your router LAN is 192.168.1.x (the default) and the static IP '''WOL''' computer is 192.168.1.254. # The '''WOL''' computer should have a static IP address, one manually assigned or through static DHCP. In the example below, we assume your router LAN is 192.168.1.x (the default) and the static IP '''WOL''' computer is 192.168.1.254.
# Ideally, a second PC to test the WOL abilities of the first one. You can also use the DD-WRT device's Web Interface to send test packets, in place of a second PC. # Ideally, a second PC to test the WOL abilities of the first one. You can also use the DD-WRT device's Web Interface to send test packets, in place of a second PC.
-##On the LAN adapter of the computer (physical ethernet adapter, WOL does not work over wireless connections!), choose Properties/Configure. 
-##Power Management tab (far right). Check the second and third boxes to enable WOL. Press OK until you are back at Network Connections. Now the computer can normally be started from Hibernate, Standby, or PowerOff modes via a special management packet. 
-##Get ready to test your set-up by using a utility like WOL Magic Packet Sender http://magicpacket.free.fr/ (free). Install it on '''both the computer you are using and a second PC on the same physical LAN.''' 
-### On the '''WOL''' computer, open WOL Magic Packet and on the Receive tab, click the green Start button. 
-### On the '''second''' computer, open WOL Magic Packet and on the Send tab, put in: 
-#### IP Address of '''WOL''' computer for Host Name 
-#### 0.0.0.0 for Subnet Mask (select from drop-down) 
-#### MAC address of LAN adapter on '''WOL''' computer. Use the command 'ipconfig /all' if you don't know what this is. 
-### Click the green Send button. The '''WOL''' computer should respond with a pop-up box showing a packet was received. 
-Repeat the previous steps and go over the trouble-shooting tips until they work before proceeding.+==Enable WOL on the Computer==
 +#On the LAN adapter of the computer (physical ethernet adapter, WOL does not work over wireless connections!), choose Properties/Configure.
 +#Power Management tab (far right). Check the second and third boxes to enable WOL. Press OK until you are back at Network Connections. Now the computer can normally be started from Hibernate, Standby, or PowerOff modes via a special management packet.
 +#Get ready to test your set-up by using a utility like WOL Magic Packet Sender http://magicpacket.free.fr/ (free). Install it on '''both the computer you are using and a second PC on the same physical LAN.'''
 +# On the '''WOL''' computer, open WOL Magic Packet and on the Receive tab, click the green Start button.
 +# On the '''second''' computer, open WOL Magic Packet and on the Send tab, put in:
 +## IP Address of '''WOL''' computer for Host Name
 +## 0.0.0.0 for Subnet Mask (select from drop-down)
 +## MAC address of LAN adapter on '''WOL''' computer. Use the command 'ipconfig /all' if you don't know what this is.
 +# Click the green Send button. The '''WOL''' computer should respond with a pop-up box showing a packet was received.
-==WOL: Step two==+Repeat the previous steps and go over the trouble-shooting tips until they work before proceeding.
 +==Test that WOL works within the LAN==
'''Hibernate, Standby, and Power-off the '''WOL''' computer, while clicking Send on the second computer, to test each mode to make sure WOL is working.''' '''Hibernate, Standby, and Power-off the '''WOL''' computer, while clicking Send on the second computer, to test each mode to make sure WOL is working.'''
Line 31: Line 32:
===Troubleshooting=== ===Troubleshooting===
- 
'''Wake On LAN is usually disabled by default in most PCs.''' This feature, if optional, must be enabled in your BIOS otherwise WOL isn't going to work. Consult your motherboard's manual and BIOS screen (DEL at startup, usually). If you don't see the WakeOn-type options in your BIOS, usually somewhere in Power Management, your motherboard may not support WOL. '''Wake On LAN is usually disabled by default in most PCs.''' This feature, if optional, must be enabled in your BIOS otherwise WOL isn't going to work. Consult your motherboard's manual and BIOS screen (DEL at startup, usually). If you don't see the WakeOn-type options in your BIOS, usually somewhere in Power Management, your motherboard may not support WOL.
* A good place to start is here: [http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/WOL-Mini-HowTO] * A good place to start is here: [http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/WOL-Mini-HowTO]
-==Step Three: Wake On LAN over the Internet==+==WOL Methods==
 +===WOL through Telnet/SSH===
 +'''Note:''' This is the preferred method to send WOL magic packets remotely.
-To remotely wake up a computer from the Internet using ''Wake On LAN''- follow these instructions:+If you have local or remote Telnet/SSH access to your router, you can wake up a machine on the LAN by using the following command:
 + /usr/sbin/wol -i 192.168.1.255 AA:BB:CC:DD:EE:FF
 + 
 +Note that the full path to "/usr/sbin/wol" is important. Simply "wol" will not work.
 + 
 +Substitute ''AA:BB:CC:DD:EE:FF'' with the actual MAC address of the computer which you wish to boot remotely. Likewise, replace ''192.168.1.255'' with the actual broadcast address of the network (192.168.1.255 is the broadcast address when the machine has an IP of 192.168.1.x and subnet mask of 255.255.255.0).
-1 Create a [[Port_Forwarding#Configuring_Port_Forwarding|port forward]] rule on the [[Web Interface]] (''Applications & Gaming'' -> ''Port Range Forward'') to the chosen ip:+===Remote Wake On LAN via Port Forwarding===
 +To remotely wake up a computer over the Internet using ''Wake On LAN''- follow these instructions:
 + 
 +1 - Create a [[Port_Forwarding#Configuring_Port_Forwarding|port forward]] rule on the [[Web Interface]] (''Applications & Gaming'' -> ''Port Range Forward'') to the chosen ip:
wol | '''9''' | 9 | udp | 192.168.1.254 | x wol | '''9''' | 9 | udp | 192.168.1.254 | x
* Here, '''9''' is the default, but you can use any port number so long as your client wake-up application can talk to a port other than 9. ''Consider that most WOL services will use either UDP port 7 or 9.'' * Here, '''9''' is the default, but you can use any port number so long as your client wake-up application can talk to a port other than 9. ''Consider that most WOL services will use either UDP port 7 or 9.''
-2 Add a static ARP entry by typing the following two lines into the Web Interface ''Administration'' -> ''Commands'' section and save with ''Save Startup''.+ 
 +2 - Add a static ARP entry by typing the following two lines into the Web Interface ''Administration'' -> ''Commands'' section and save with ''Save Startup''.
ip neigh change 192.168.1.254 lladdr [MAC address to wake] nud permanent dev br0 ip neigh change 192.168.1.254 lladdr [MAC address to wake] nud permanent dev br0
ip neigh add 192.168.1.254 lladdr [MAC address to wake] nud permanent dev br0 ip neigh add 192.168.1.254 lladdr [MAC address to wake] nud permanent dev br0
-''Previous it was suggested to set the mac address to ff:ff:ff:ff:ff:ff (the broadcast address) because it would ensure that the magic packet propagated if you have additional switches in your network. However, in doing so you will interfere routing for the WOL host because the router will send all of the host's routed traffic to the broadcast MAC address instead of the hosts real MAC adddress. If you use additional switches between the router and the host that needs WOL, then you ought to use a more graceful method.''+''Previous it was suggested to set the MAC address to ff:ff:ff:ff:ff:ff (the broadcast address) because it would ensure that the magic packet propagated if you have additional switches in your network. However, in doing so you will interfere routing for the WOL host because the router will send all of the host's routed traffic to the broadcast MAC address instead of the host's real MAC adddress. If you use additional switches between the router and the host that needs WOL, then you ought to use a more graceful method.''
- +3 - Reboot router, or execute the startup commands manually.
-3 Reboot router, or execute the startup commands manually.+
* To wake your computer from the internet using the DD-WRT device DynDNS name (or if you know it, the public IP of the router), try one of the following services; * To wake your computer from the internet using the DD-WRT device DynDNS name (or if you know it, the public IP of the router), try one of the following services;
Line 62: Line 72:
##Click the green Send button. ##Click the green Send button.
- +===Automatic Wake-On-LAN Daemon===
-==WOL Scripts==+
- +
-# Wake up a specific host when triggered from the internet (decent alternative to Step Three) [[Useful_Scripts#Web_Server_Wake-up|Web Server Wake-up]].+
-# To wake by name, see [[Useful_Scripts#Name-based_WOL_.28wake.sh.29|Name-based WOL]].+
- +
- +
-===Troubleshooting===+
-As before, use the WOL Magic Packet software in Receive mode to show received magic packets while the computer is on. This is much easier troubleshooting than having the computer off and not knowing which, if any, packets are arriving at the WOL computer.+
- +
-== Automatic Wake-On-LAN daemon ==+
The Automatic WOL daemon will send out a periodic wake on lan packet at the intervals you specify. This may be useful to keep a system online most of the time even if it is turned off. (eg: A Media Center PC). The Automatic WOL daemon will send out a periodic wake on lan packet at the intervals you specify. This may be useful to keep a system online most of the time even if it is turned off. (eg: A Media Center PC).
Line 86: Line 86:
A useful tool for watching the WOL packets on a Windows computer is available at [http://www.depicus.com/wake-on-lan/wake-on-lan-monitor.aspx www.depicus.com/wake-on-lan] (use port 40000 when monitoring) Or you can use a more generic protocol analyzer tool like [http://www.wireshark.org/ Wireshark]. A useful tool for watching the WOL packets on a Windows computer is available at [http://www.depicus.com/wake-on-lan/wake-on-lan-monitor.aspx www.depicus.com/wake-on-lan] (use port 40000 when monitoring) Or you can use a more generic protocol analyzer tool like [http://www.wireshark.org/ Wireshark].
-==WOL through Telnet/SSH==+===WOL Scripts===
-If you have local or remote Telnet/SSH access to your router, you can wake up a machine on the LAN by using the following command:+# Wake up a specific host when triggered from the internet: [[Useful_Scripts#Web_Server_Wake-up|Web Server Wake-up]].
- /usr/sbin/wol -i 192.168.1.255 AA:BB:CC:DD:EE:FF+# To wake by name: [[Useful_Scripts#Name-based_WOL_.28wake.sh.29|Name-based WOL]].
- +
-Note that the full path to "/usr/sbin/wol" is important. Simply "wol" will not work.+
- +
-Substitute ''AA:BB:CC:DD:EE:FF'' with the actual MAC address of the computer which you wish to boot remotely. Likewise, replace ''192.168.1.255'' with the actual broadcast address of the network (192.168.1.255 is the broadcast address when the machine has an IP of 192.168.1.x and subnet mask of 255.255.255.0).+
==See Also (forum discussions)== ==See Also (forum discussions)==

Revision as of 23:00, 13 April 2010

Contents

Introduction

WOL provides the ability to wake-up a sleeping, hibernating, or powered-off computer. Chances are your computer has the WOL feature.

Reasons to use WOL with DD-WRT:

  • You do not want a computer on all the time, yet you want to use it from outside your home or office, and there is a DD-WRT-enabled device as the Internet gateway for that computer, powered on all the time.
  • You run a server or computer all the time, and want it to shut down in case of over-temp or other situations. If this happens, you may still need to access documents on the server, from inside or outside the home network.

Preparation

You will need:

  1. A PC which supports WOL. Most modern PC's can be set-up this way.
  2. Administrative access to the computer you want to sleep/wake-up.
  3. The WOL computer should have a static IP address, one manually assigned or through static DHCP. In the example below, we assume your router LAN is 192.168.1.x (the default) and the static IP WOL computer is 192.168.1.254.
  4. Ideally, a second PC to test the WOL abilities of the first one. You can also use the DD-WRT device's Web Interface to send test packets, in place of a second PC.

Enable WOL on the Computer

  1. On the LAN adapter of the computer (physical ethernet adapter, WOL does not work over wireless connections!), choose Properties/Configure.
  2. Power Management tab (far right). Check the second and third boxes to enable WOL. Press OK until you are back at Network Connections. Now the computer can normally be started from Hibernate, Standby, or PowerOff modes via a special management packet.
  3. Get ready to test your set-up by using a utility like WOL Magic Packet Sender http://magicpacket.free.fr/ (free). Install it on both the computer you are using and a second PC on the same physical LAN.
  4. On the WOL computer, open WOL Magic Packet and on the Receive tab, click the green Start button.
  5. On the second computer, open WOL Magic Packet and on the Send tab, put in:
    1. IP Address of WOL computer for Host Name
    2. 0.0.0.0 for Subnet Mask (select from drop-down)
    3. MAC address of LAN adapter on WOL computer. Use the command 'ipconfig /all' if you don't know what this is.
  6. Click the green Send button. The WOL computer should respond with a pop-up box showing a packet was received.

Repeat the previous steps and go over the trouble-shooting tips until they work before proceeding.

Test that WOL works within the LAN

Hibernate, Standby, and Power-off the WOL computer, while clicking Send on the second computer, to test each mode to make sure WOL is working.

Once this step is working, you can go on to making WOL work when you are outside your LAN, such as at a cafe or another remote location.

Troubleshooting

Wake On LAN is usually disabled by default in most PCs. This feature, if optional, must be enabled in your BIOS otherwise WOL isn't going to work. Consult your motherboard's manual and BIOS screen (DEL at startup, usually). If you don't see the WakeOn-type options in your BIOS, usually somewhere in Power Management, your motherboard may not support WOL.

  • A good place to start is here: [1]

WOL Methods

WOL through Telnet/SSH

Note: This is the preferred method to send WOL magic packets remotely.

If you have local or remote Telnet/SSH access to your router, you can wake up a machine on the LAN by using the following command:

/usr/sbin/wol -i 192.168.1.255 AA:BB:CC:DD:EE:FF

Note that the full path to "/usr/sbin/wol" is important. Simply "wol" will not work.

Substitute AA:BB:CC:DD:EE:FF with the actual MAC address of the computer which you wish to boot remotely. Likewise, replace 192.168.1.255 with the actual broadcast address of the network (192.168.1.255 is the broadcast address when the machine has an IP of 192.168.1.x and subnet mask of 255.255.255.0).

Remote Wake On LAN via Port Forwarding

To remotely wake up a computer over the Internet using Wake On LAN- follow these instructions:

1 - Create a port forward rule on the Web Interface (Applications & Gaming -> Port Range Forward) to the chosen ip:

wol  |  9  |  9  |  udp  |  192.168.1.254  |  x
  • Here, 9 is the default, but you can use any port number so long as your client wake-up application can talk to a port other than 9. Consider that most WOL services will use either UDP port 7 or 9.

2 - Add a static ARP entry by typing the following two lines into the Web Interface Administration -> Commands section and save with Save Startup.

ip neigh change 192.168.1.254 lladdr [MAC address to wake] nud permanent dev br0
ip neigh add 192.168.1.254 lladdr [MAC address to wake] nud permanent dev br0

Previous it was suggested to set the MAC address to ff:ff:ff:ff:ff:ff (the broadcast address) because it would ensure that the magic packet propagated if you have additional switches in your network. However, in doing so you will interfere routing for the WOL host because the router will send all of the host's routed traffic to the broadcast MAC address instead of the host's real MAC adddress. If you use additional switches between the router and the host that needs WOL, then you ought to use a more graceful method.

3 - Reboot router, or execute the startup commands manually.

  • To wake your computer from the internet using the DD-WRT device DynDNS name (or if you know it, the public IP of the router), try one of the following services;
  1. Mestrona's online WOL. You need to forward port 9 udp in step one, to use this service.
  2. Remote Wake-On-LAN. Seems to work both on ports 7 and 9 and allows WOL by a single URL of the form: http://mobile.wakeonlan.me/?ip=HOSTNAME&mac=MACADDRESS
  3. To use the WOL Magic Packet application from a second PC:
    1. Host Name: DynDNS name of your DD-WRT device.
    2. Subnet Mask: 255.255.255.255
    3. MAC Address: WOL computer MAC address, not the DD-WRT MAC.
    4. Click the green Send button.

Automatic Wake-On-LAN Daemon

The Automatic WOL daemon will send out a periodic wake on lan packet at the intervals you specify. This may be useful to keep a system online most of the time even if it is turned off. (eg: A Media Center PC).

For Interval you can enter a value in seconds as low as 15 seconds and as high as 86400 seconds (1 day). Host name should be the broadcast address for your LAN. eg: 255.255.255.255 or 192.168.1.255. SecureON Password is computers that have a BIOS feature that secures the WOL function. If you do not have a BIOS that requires this form of password then you can leave the box blank or type in 00-00-00-00-00-00. MAC Address(es) should contain the MAC address of the networked machines you want a WOL to be sent to on your LAN.

The packets generated by the WOL daemon are sent to UDP port 40000. You likely will not need to worry about this unless the system you are attempting to send the WOL packet is on another subnet or you are trying to monitor the packets.

note: the UI says that the Interval accepts a range of 1-86400 seconds but it will only send out a WOL packet at a minimum of 15 second intervals. All values below 15 are accepted but the interval will still be every 15 seconds.

A useful tool for watching the WOL packets on a Windows computer is available at www.depicus.com/wake-on-lan (use port 40000 when monitoring) Or you can use a more generic protocol analyzer tool like Wireshark.

WOL Scripts

  1. Wake up a specific host when triggered from the internet: Web Server Wake-up.
  2. To wake by name: Name-based WOL.

See Also (forum discussions)

References