Skip to main content

Wake on LAN

Verify WOL supported

Not all cards have the Wake on LAN feature so it is good to verify that you have the capability. Ensure ethtool is installed

sudo apt install ethtool

Identify the correct interface

ip route | grep default

The output for my PC is the following, and my interface is enp4s0f0 network-interface

Use ethtool to check if the network card supports WOL

sudo ethtool <NETWORK INTERFACE>

Check the Supports Wake-on section for g, which means it supports wake on magic packet. Multiple letters may be present indicating additional features:

  • p: Wake on PHY activity: The network interface can wake up the system when there is physical layer activity (e.g., the cable being plugged in or signal detected).
  • u: Wake on unicast packets: The interface can wake up the system when it receives a unicast packet addressed specifically to this machine.
  • m: Wake on multicast packets: The interface can wake up the system when it receives multicast packets.
  • b: Wake on broadcast packets: The interface can wake up the system when it receives broadcast packets.
  • g: Wake on magic packet: The interface can wake up the system when it receives a magic packet, which is the standard packet used in most Wake-on-LAN implementations.

wol-supported

Example of a card that does not support WOL

wol-not-supported

The value for Wake-on shows the current status of the card, and it may need to be enabled to be used. The next section covers how to enable a service that re-enabled Wake-on when the PC is booted.

Enable Wake On in the BIOS

Whether using an ethernet port that is built into the motherboard or one that is installed in a PCI-E slot, ensure Wake-On support in enabled in the BIOS. Typically the Wake On setting is located in the "Power" or "Advanced" sections. There may be entries for enabling wake/resume by "Onboard LAN" or "PCI-E Device"

ASUS

wake-on-asus

MSI

wake-on-msi

Enable Wake On in the OS

If the motherboard or PCI-E card supports Wake-on, it is a good idea to ensure that it is re-enabled at boot. There are times when it may get disabled so to ensure that it remains enabled a simple service can be created. Start by creating the service

sudo nano /etc/systemd/system/wol@.service

Add the service code

[Unit]
Description=Enable Wake-on-LAN on %i
After=network-online.target

[Service]
ExecStart=/sbin/ethtool -s %i wol g

[Install]
WantedBy=multi-user.target

Enable the service for the specific interface identified above, which will run the service at boot

sudo systemctl enable wol@<interface>

Get MAC address

In order to send a magic packet, the MAC address of the interface is needed

ip addr show

mac-address

Send Magic Packets

A PC with WOL enabled can be turned on via sending a magic packet. You will need the wakeonlan package installed to do this:

sudo apt install wakeonlan

To wake the PC, send a magic packet by specifying the MAC address of the network card with WOL functionality

wakeonlan <MAC ADDRESS>