This article describes how to enable Wake On LAN function so that a computer may be powered up remotely.

It was originally composed to address a need to power on a server running XCP-ng hypervisor version 8.20. However, it was clear that the tools needed to implement the changes described herein were missing from the OS installed with XCP-ng. Namely the NetworkManager and nmcli are missing.

There is a need to figure out how nmcli can be installed and so far, despite downloading the package we have not been able to install on the server due to inability to ‘make’ and ‘install’ the tool.

Option 2: use nmcli command-line tool

Network Manager

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

show all the network 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”.

check configurations

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.

Set Magic Key

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

enable Wake on WiFi

(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.

Wake-on-LAN app

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.

Test host can receive WOL packet

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.


This article was first published here

These instructions are also available to setup WOL using the Ubuntu GUI (aka Ubuntu GNOME or Workstation Desktop)


Leave a Reply