Wake-on-LAN on Linux (Local Network Only)

This guide explains how to enable Wake-on-LAN (WOL) on Linux after it has already been enabled at the hardware / firmware level.

Wake-on-LAN on Linux works only with wired Ethernet connections. It does not work reliably over Wi-Fi.


Supported systems

This guide applies to most modern Linux distributions, including:

Applies only to systems using:


Prerequisites

Before continuing, make sure that:

If BIOS / UEFI is not configured yet, do this first:

Enable Wake-on-LAN in BIOS / UEFI

No MAC address is required at this stage.


Step 1: Identify the Ethernet interface

Open Terminal and run:

ip link

Look for the active Ethernet interface.
Common names include:

Ignore:

You will use this interface name in the next steps.


Step 2: Check Wake-on-LAN support

Run the following command, replacing INTERFACE with your Ethernet interface name:

sudo ethtool INTERFACE

Look for the line:

Supports Wake-on: Wake-on:

Example:

Supports Wake-on: pumbg Wake-on: d

Meaning:

If g is not listed under Supports Wake-on, the network card does not support Wake-on-LAN.


Step 3: Enable Wake-on-LAN

To enable Wake-on-LAN (magic packet):

sudo ethtool -s INTERFACE wol g

Verify the change:

sudo ethtool INTERFACE

The output should show:

Wake-on: g

This enables Wake-on-LAN at the operating system level.


Step 4: Make the setting persistent (important)

On many Linux systems, Wake-on-LAN settings reset after reboot.

You must make the configuration persistent.


Option A: NetworkManager (most desktop systems)

Create or edit a dispatcher script:

sudo nano /etc/NetworkManager/dispatcher.d/99-wol

Add the following content:

#!/bin/sh

if [ "$2" = "up" ]; then /usr/sbin/ethtool -s INTERFACE wol g fi

Replace INTERFACE with your Ethernet interface name.

Make the script executable:

sudo chmod +x /etc/NetworkManager/dispatcher.d/99-wol


Option B: systemd service (generic method)

Create a systemd service:

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

Add:

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

[Service] Type=oneshot ExecStart=/usr/sbin/ethtool -s INTERFACE wol g

[Install] WantedBy=multi-user.target

Replace INTERFACE with your Ethernet interface name.

Enable the service:

sudo systemctl enable wol.service


Step 5: Power state considerations

Wake-on-LAN on Linux works when the system is in:

Requirements:


Step 6: Verification (optional)

After shutting down the system:

This indicates the network interface is still powered and listening.


Common problems and solutions

Wake-on-LAN resets after reboot


Works from sleep but not from shutdown


Interface name changes