Enable Wake-on-Lan (WoL)

Enable Wake-on-Lan (WoL)

Allow your server to be switched on remotely

Last updated:

linux ubuntu

Overview

Wake-on-Lan (WoL) enables you to turn on your machine remotely. This is ideal if you have machine in another room, like a server in an out of the way place. The machine wakes up when it receives a special message called a magic packet. You can send magic packets from other computers or even from your mobile phone. The message is sent over your network using Wi-Fi or a wired connection.

This article will show you how to enable Wake-on-Lan on your linux machine.

Enable BIOS Power Management Events

For Wake-on-Lan (WoL) to work the BIOS needs to be set to accept Power Management Events (PME). Different vendors might have a different name for them, but in my Asus BIOS it was labelled Power on by PME.

List network Interfaces

To enable Wake-on-Lan (WoL) you need to find out what your Ethernet Interface is called. This is how your computer connects to your network.

ip command

This shows or manipulates routing, devices, policy routing and tunnels.

ip link show

This will output something like this:-

1: lo: <loopback,up,lower_up> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <broadcast,multicast,up,lower_up> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:xx:yy:xx:yy:z0 brd ff:ff:ff:ff:ff:ff</broadcast,multicast,up,lower_up></loopback,up,lower_up>

In the above output my network Interface is called eth0. If I had two Interfaces the second one would be called eth1, and so on. If I have Wi-Fi installed I might have an interface called wlan0.

Change Interface settings

Now that we know what our Interface is called, in my case eth0, we need to install a program that can set or update settings on our Interface. The program to do this is called ethtool.

Install ethtool

ethtool displays or sets Ethernet device settings.

Let's check whether ethtool is already installed.

whereis ethtool

If ethtool is not found, we can install it.

sudo apt-get update
sudo apt-get install ethtool

Once ethtool has been installed check to see if out network interface supports Wake-on-Lan.

Make sure you replace eth0 with the name of your network interface.

sudo ethtool eth0
Settings for eth0:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Half 1000baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Link partner advertised link modes:  10baseT/Half 10baseT/Full
                                             100baseT/Half 100baseT/Full
                                             1000baseT/Half 1000baseT/Full
        Link partner advertised pause frame use: Symmetric Receive-only
        Link partner advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 0
        Transceiver: internal
        Auto-negotiation: on
        Supports Wake-on: pumbg
        Wake-on:
        Current message level: 0x00000033 (51)
                               drv probe ifdown ifup
        Link detected: yes

The entry Supports Wake-on indicates whether your Interface supports Wake-on-Lan (WoL). The flag for WoL is g. In my example Supports Wake-on has a value of pumg, with the g in pumg indicating that the network interface does support Wake-on-Lan.

However, Wake-on currently has no value. So my Interface supports WoL but my Interface is not currently set to Wake-on-Lan. A value of d would indicate that wake-on-lan is currently disabled.

Run the following command to enable Wake-on-Lan.

Remember to replace eth0 with the name of your network interface.

sudo ethtool -s eth0 wol g

To see if WoL is now set, re-run this command:-

sudo ethtool eth0

You should now see that Wake-on is set to g.

Set WoL to work after reboot

When you restart your machine the Interface will forget the WoL setting. We need to create a systemd service that runs at boot and sets the wake-on-lan flag to g.

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

Add the following configuration:-

# /etc/systemd/system/wol.service
# Systemd service to enable Wake-on-LAN at boot
# Enable wake-on-lan for a specific network interface

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

[Service]
Type=oneshot
# Set WoL to magic packet mode on the specified interface
# Change 'eth0' to match your network interface name
ExecStart=/usr/sbin/ethtool -s eth0 wol g
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

To save a file opened using nano, do Ctrl + o to output the file and Ctrl + x to exit and return to the command line.

Enable and start the service

Enable and start the service so wake-on-lan is configured on every boot.

Reload systemd to recognise the new service file.

sudo systemctl daemon-reload

Enable the service to start at boot.

sudo systemctl enable wol.service
Created symlink /etc/systemd/system/multi-user.target.wants/wol.service → /etc/systemd/system/wol.service.

Start the service immediately.

sudo systemctl start wol.service

Verify the service is running correctly.

sudo systemctl status wol.service
● wol.service - Enable Wake-on-LAN
     Loaded: loaded (/etc/systemd/system/wol.service; enabled; preset: enabled)
     Active: active (exited) since Mon 2026-02-23 22:32:14 UTC; 12s ago
    Process: 5134 ExecStart=/usr/sbin/ethtool -s eth0 wol g (code=exited, status=0/SUCCESS)
   Main PID: 5134 (code=exited, status=0/SUCCESS)
        CPU: 2ms

Feb 23 22:32:14 nas systemd[1]: Starting wol.service - Enable Wake-on-LAN...
Feb 23 22:32:14 nas systemd[1]: Finished wol.service - Enable Wake-on-LAN.

Wake-on-Lan is now enabled and will persist between reboots.

Testing Wake-on-Lan (WoL)

I use an app on my mobile phone called Wake On Lan that wakes-up my server by sending a WoL magic packet. I highly recommend this app.