Enable Wake-on-LAN to Wake up (or Boot) Ubuntu 24.04 Remotely

Last updated: August 19, 2024 — Leave a comment

This is a step by step guide shows how to enable Wake-on-LAN feature in Ubuntu, so you can wake it up from suspend, hibernation, or shutdown state remotely using another computer or mobile phone.

Wake on LAN, WoL in short, is a protocol allows computer to be turned on or waked up from sleep using network message. It’s based on AMD’s Magic Packet Technology, and also known as wake on WAN, remote wake-up, power on by LAN, and resume by LAN.

WoL uses wired network on target computer for the communication. Though, there’s also Wake on Wireless LAN (WoWLAN) allowing to wake up wirelessly.

Requirements:

This tutorial is tested on Ubuntu 24.04 LTS, though it should work on all current Ubuntu releases, as well as many other Linux distributions.

Before getting started, you need:

  • Motherboard and Network interface card that support Wake on LAN.
  • Keep the target computer or laptop connected with network cable. Some wireless network cards do support WowLAN, and I’ll show you how to enable the feature below, however, it does NOT wake in my case on WiFi.

Step 1: Enable Wake on LAN in BIOS settings

First, start or restart your computer. During the startup process, press a specific key (F1 ~ F12, Esc, or Del depends on your device) to enter BIOS.

Configure following options in BIOS:

  • Enable Wake-on-LAN. The name may vary depends on motherboard manufacturers. It can also be “PCI Power up”, “Allow PCI wake up event”, or “Boot from PCI/PCI-E”.
  • Disable ErP mode if exist. It’s designed to save even more power when in power-off state. Which however prevent WoL to work properly.
  • Enable USB power or similar option. In my ThinkPad, I have to enable “Always on USB” and “Charge in Battery Mode” – charge external device when system is in hibernate or power-off state and in battery mode. Or, it won’t wake up from hibernate or shutdown when on battery.

NOTE: After this step, network interface card still has power when computer is in power-off state. This may cause battery draining problem on some laptops.

ThinkPad BIOS settings for Wake on LAN

Step 2: Enable Wake on LAN in Ubuntu

After enabled the feature in BIOS, you also have to configure your operating system for it to work. As far as I know, there are graphical option and few command line tools to do the job in Ubuntu Linux.

Option 1: Use Network Connection Editor (Graphical Way)

If your run the target computer with Ubuntu Desktop, then the thing is super easy by using the built-in network connections editor tool. However, it works only for the wired network!

First, search for and launch “Advanced Network Configuration” from system start menu or GNOME overview depends on your desktop environment.

Tips: for choice you may run nm-connection-editor command to start the tool from command line..

When it opens, double click to edit the wired network connection. Finally, enable “Magic” option for Wake on LAN under Ethernet tab, and Save.

Option 2: use nmcli command-line tool

For choice, the nmcli command line configuration tool for Network Manager can also do the job for both wired and wireless connections.

1. First, open terminal (Ctrl+Alt+T) and run command to show all the network connections:

nmcli connection show

As the screenshot below shows you, I have the wired network device connected to “netplan-enp0s31f6”, and wifi network device connected to “elite01”.

2. Then, run the last command follow with a network connection name (“netplan-enp0s31f6” or “elite01” in my case) to check its configurations.

For example, run the command below in my case, will show the configurations about the wired network connection (replace netplan-enp0s31f6 to yours).

nmcli connection show "netplan-enp0s31f6" |grep 802

While |grep 802 filter out the part that I need for info about Wake on Lan.

3. As the last screenshot shows you, “802-3-ethernet.wake-on-lan” is the key config option for enable WoL for this connection.

The key value is usually “default”. We have to set it to “magic” to make it work (replace netplan-enp0s31f6 to yours).

nmcli connection modify "netplan-enp0s31f6" 802-3-ethernet.wake-on-lan magic

Also, set ‘802-3-ethernet.auto-negotiate’ to yes which may help if network adapter is powered off on shutdown.

nmcli connection modify "netplan-enp0s31f6" 802-3-ethernet.auto-negotiate yes

(For WoWLAN) If you’re trying to enable Wake on WiFi, then use following commands instead (replace ‘elite01’ with yours wifi network connection name):

  • Check the config options:
    nmcli connection show "elite01" |grep 802
  • Set the “802-11-wireless.wake-on-wlan” option to “magic”:
    nmcli connection modify "elite01" 802-11-wireless.wake-on-wlan magic
  • Disable WiFi power autosave feature:
    nmcli connection modify "elite01" 802-11-wireless.powersave disable

Step 3: Trigger WoL on target machine

1. To trigger WoL, you need the MAC address of the network interface in target machine. Just open terminal (Ctrl+Alt+T), then run the command below to tell:

ip link

Then, copy or write down the mac address (e8:6a:64:d9:d3:66 in my case) for the network device you want to use it to trigger WoL.

2. Next, install a Wake-on-LAN app in remote computer or mobile phone, then set it up for the target machine.

  • For Android, iOS, just search ‘wake on lan’ in Google Play or App Store. There are quite a few apps to do the job.
  • For Linux, search for and install the graphical “gwakeonlan” tool or command line “wakeonlan” tool from system repository.
  • Don’t know any for Windows and macOS, try to search one in system app store.

3. Before suspending, shutting down, or hibernating the target computer, you may first test if it can properly receive the message for WoL.

To do so, open terminal (Ctrl+Alt+T) and run the command below in the target Ubuntu computer:

sudo nc -u -l -p 9

After typing user password, it sticks at blinking cursor waiting for the remote message.

In the remote computer or mobile phone, once you click “Boot” or “Turn ON” button to trigger WoL on the target machine, the terminal window should immediately display the message (though unreadable). If nothing happens, then something must be wrong!

4. If the last step works properly, you can now suspend, hibernate, or shutdown the target computer. Then, try to wake it up using a remote app.

NOTE: Wake on Wireless LAN only supports waking up from suspend, though I can’t get it work in my case because WiFi is always turned off on suspend.

Undo and Disable Wake on LAN

To undo all the changes, first configure BIOS to disable WoL.

Then open terminal in Ubuntu and run command:

  • For wired network, use command to disable wake on LAN:
    nmcli connection modify "netplan-enp0s31f6" 802-3-ethernet.wake-on-lan disabled
  • For wireless network, use this one to disable wake on WLAN:
    nmcli connection modify "elite01" 802-11-wireless.wake-on-wlan disabled

In the commands above, replace netplan-enp0s31f6 and elite01 to yours connection names according to nmcli c show command output.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via [email protected] Buy me a coffee: https://ko-fi.com/ubuntuhandbook1

No Comments

Be the first to start the conversation.

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*