Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configure Wake-on-LAN on Ubuntu

In this doc, we will configure & persist Wake-on-LAN on a Ubuntu machine using Netplan.


Wake-on-LAN (WoL) lets us remotely power on a machine/pc using a magic packet.

To enable WoL, first we need to check if our network interface supports Wake-on-LAN:

sudo ethtool <interface-name>

## Look for Output:
# ...
# Supports Wake-on: pumbg
# Wake-on: d
# ...
  • g in Supports means it supports magic packet WoL.
  • Wake-on: d means WoL is currently disabled.

We can temporarily enable WoL using ethtool:

sudo ethtool -s <interface-name> wol g

But this will not presist over restart.

💡 We will also have to enable WoL in the BIOS/UEFI as well before OS can utilize it.

⚙️ Enable Persistent WoL via Netplan

Edit/Add your Netplan config:

sudo nano /etc/netplan/01-wol.yaml
network:
  version: 2
  ethernets:
    <interface-name>:
      wakeonlan: true

Replace <interface-name> with actual interface name.

Then apply changes:

sudo netplan apply

This should presist WakeOnLan. We can verify again after reboot using command:

sudo ethtool enp3s0 | grep Wake-on
# Should return: "Wake-on: g"

Try Wake-on-Lan by sending a Magic Packet ✨

Now, let us shutdown the machine and try to boot it using WoL. Before shutdown copy the Mac address on the machine using ip a command. Next, we can install wakeonlan utility to send our magic packet.

sudo apt install wakeonlan

Then send a magic packet to target machine on the same network:

wakeonlan <MAC-ADDRESS>

Make sure the target PC is connected to the same network and its BIOS/UEFI has WoL enabled.




< Go to Home >