This article deals with Wake-on-LAN (wol, wake on lan), what it is, how it can be used from an Arch Linux computer, and its general uses.
- 1 What is Wake-on-LAN?
- 1.1 Does my motherboard support Wake-on-LAN?
- 1.2 Wake-on-LAN in different situations
- 1.3 Additional Notes
What is Wake-on-LAN?
Basically put, Wake-on-LAN, otherwise known as 'wol' is the ability to switch a computer that is connected to a network (be it the internet or intranet) on. This can be a very useful ability.
Does my motherboard support Wake-on-LAN?
Wake-on-LAN in different situations
In all situations
There are four essential things needed in order to use Wake-on-LAN on a target PC:
- Some kind of Wake-on-LAN software on the host (your) PC
- A connection to the internet or intranet of the target PC
- The MAC address of the target PC
- The internal or external IP of the target PC
- Firstly, install the Wake-on-LAN software from the AUR. In this article, wol will be used.
- It is recommended that you read the documentation of wol
man wol wol --help
- wol requires several parameters, the most basic needed:
- But it is good practice to include the IP address or hostname, therefore this syntax should be the minimal used:
wol -i HOSTNAME_OR_IP MACADDRESS
- The documentation of wol states that:
- Each MAC-ADDRESS is written as x:x:x:x:x:x, where x is a hexadecimal number between 0 and ff which represents one byte of the address, which is in network byte order (big endian).
- To obtain the MACADDRESS of the target computer:
ifconfig | grep HWaddr
The port, IP or hostname of the target PC will be addressed in the relevant following sections.
Across your intranet/network (no router)
For two computers connected to each other
For computers connected to a non-firewalled router
wol -i INTERNAL_IP_OF_TARGET_PC MACADDRESS_OF_TARGET_PC
- To find the internal IP (it's the first grepped entry):
ifconfig | grep 'inet addr'
- Since you are not firewalled, then there is no need to worry about port redirects.
- If you intend to continue using Wake-on-LAN, it is recommended that you assign your computer's MACADDRESS to a specific IP on your router. Consult your router for details as to how to do this.
Across your intranet/network (router)
The syntax used in this situation:
wol -p PORT_FORWARDED_TO_INTERNAL_IP -i INTERNAL_IP MACADDRESS_OF_TARGET_PC
- When you send the MagicPacket signal to the target computer via a specific port, the signal passes through your router. The router must be instructed to forward any signal heading for that specific port to the internal IP of the target PC.
- It is recommended that for multiple computers connected to one computer, to assign a different port forward to each internal IP
- For port forwarding help, please consult http://portforward.com/ (though this website has some Windows specific content, it has a very large database of router web interfaces)
Across the internet
The syntax needed in this case:
wol -p X -i HOSTNAME_OR_EXTERNAL_IP_OF_TARGET MACADDRESS
- Assuming that you know the external IP of the target machine, and that the router ports on both sides have been forwarding correctly, then this should be exactly as the syntax states.
A common problem with the Wake-on-LAN in computers running linux is that the network drivers have Wake-on-LAN switched off by default.
- To manually switch on the Wake-on-LAN feature on your driver:
pacman -Sy wol ethtool -s ethX wol ubmg
- This command does not last beyond the next reboot. To execute the command everytime you start up your computer, add the command into /etc/rc.local
- For more information on this, please read the wol FAQ (not available at the moment - 11/12/2008)
- If for some reason, you find that after using the command to switch your network drivers Wake-on-LAN feature on, the computer shuts down normally but then starts again, experiment with combinations of [u/b/m]g
- Another problem is that a lot of people forget to switch on the Wake-on-LAN feature in their BIOS.