Wake On LAN
Wake On LAN (WOL) enables other systems on your local area network (LAN) to turn on your system over the network. Support for WOL is required in your network card, motherboard, UEFI/BIOS boot firmware and operating system network configuration.
Hardware
Your first step towards booting your computer from over the network is to make sure your network card and motherboard support some type of Wake On LAN (WOL) feature.
Motherboards with onboard NICs usually support WOL without the need for any pins/cables.
- Newer motherboards use a WOL pin on the PCI bus, negating the need for the cable.
- Older motherboards use a WOL three pin connector between your network card and your main board. Both headers are usually labelled ‘wol’.
- Some motherboards support both and only provide the header for backwards compatibility with network cards that don’t support the PCI pin.
Examples
Firmware
In the UEFI/BIOS boot firmware settings under power management or network you may have a clear, intuitive option labelled «Wake On LAN». If you do not have that option, there may be another power management or network option that enables WOL.
Examples
Software
After activating WOL in hardware and firmware, it must also be activated in software.
First check if WOL functionality is already activated.
If it is activated, then you can power down your system, and then use another system to wake it.
If it is not activated, then you need to enable automatic activation. You can use the integrated WOL functionality of systemd networkd, NetworkManager or ifupdown. Alternatively you can activate it manually.
Checking WOL
You can check if WOL is enabled using the ethtool command from the ethtool package:
$ sudo ethtool eth0 Settings for eth0: Supported ports: [ MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Supported pause frame use: No Supports auto-negotiation: Yes Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Full Advertised pause frame use: No Advertised auto-negotiation: Yes Speed: 100Mb/s Duplex: Full Port: MII PHYAD: 1 Transceiver: external Auto-negotiation: on Supports Wake-on: g Wake-on: g Link detected: yes
Wake-on: g means it is enabled.
Enabling WOL
ifupdown
You can check if you manage network by ifupdown with ifquery. This is the default on Debian installations.
Since squeeze ethtool parameters can be set directly from an interface configuration file. See the documentation in /usr/share/doc/ethtool/README.Debian for more information.
Add an interface config file /etc/network/interfaces.d/eth0 (or modify the global interface config file /etc/network/interfaces):
auto eth0 iface eth0 inet dhcp ethernet-wol g
systemd-networkd
You can check if your network is managed by systemd-networkd by networkctl list command.
Set the WakeOnLan field to one of the available options in the [Link] section of the .link file for the network interfaces you want to use WOL on:
Beware that only the first .link file is applied and that there is a 99-default.link. The name needs to be lexicographically smaller.
sudo networkctl reload sudo networkctl reconfigure
NetworkManager
You can check if your network devices are managed with nmcli d command.
NetworkManager supports WOL since version 1.0.6 and you can enable it from either your desktop network configuration GUI, or the nm-connection-editor GUI from nm-connection-editor, or from the nmcli command-line tool using this command:
$ sudo nmcli c modify "wired1" 802-3-ethernet.wake-on-lan magic
Manual
The ethtool command from the ethtool package can tell the network interface to respond to the magic packet. Replace eth0 with your network interface device name:
$ sudo ethtool -s eth0 wol g
Using WOL
WOL utilities typically require the target host’s NIC MAC address; this can be found by running standard network configuration utilities on the target (e.g. ip a, ifconfig), or by pinging the target system and then checking the local arp table (arp).
Install the etherwake package in the controlling system for the etherwake command to send the «Magic Packet» to my computer to wake it up. The program must be run as root to send the packet (I use sudo to execute it).
$ sudo apt install etherwake $ sudo etherwake
The wakeonlan package is also available, wakeonlan is a program that uses UDP packets not TCP, and hence does not need to be run as root. It is also slightly more configurable.
$ sudo apt install wakeonlan $ wakeonlan
Troubleshooting WOL
I found that I didn’t want any of the Wake On LAN settings except Wake on «Magic Packet» (g). I only wanted my machine to turn on when I specifically told it to, not on unicast messages (u), broadcast messages (b) or multicast messages (m).
However, if you do want Wake On LAN on any of these events (other than «Magic Packet»), you may find conflicts with pm-utils. At the time of writing, scripts in this package will set the wake option for all relevant interface cards to «Magic Packet» only , (g). This will be a problem if you want your machine to wake «on-demand», when it receives traffic (u), for example. The issue and a fix is discussed below.
WOL Persistence
Hardware looks up to spec, you think the BIOS is set right, but it still doesn’t work without some tweaking using the software. According to the Wake On Lan client FAQ most Linux drivers disable the WOL feature on boot 1 , so we need to get it going.
Kernel 2.6
With a 2.6 kernel we’re using /etc/modprobe.d. You may be using /etc/modprobe.conf, but if it’s not including /etc/modprobe.d you’re probably getting told about that each time you boot and some stuff may not be configured properly. I’m using /etc/modprobe.d and I added a file local.conf into the directory:
install 8139too /sbin/modprobe -i 8139too; /sbin/ethtool -s eth0 wol g
ethtool comes from the ethtool package, so you’ll need to install that unless your card supports a load option to set WOL. If that’s the case I’d make an local.conf file with the appropriate options line, maybe something like:
options 3c59x enable_wol=1