How-To

How to Enable Wake on LAN on Ubuntu

How to Enable Wake on LAN on Ubuntu

Want to remotely start and suspend an Ubuntu PC? You’ll need Wake-on-LAN functionality enabled first. Here’s how to set it up.

Need to work with a PC, but you’re quite far away? Wake-on-LAN was made for this kind of scenario. The technology allows you to remotely wake up a PC without physically being able to press the power button or hit the mouse or keyboard. I’ve used it for years to power up a second Ubuntu-powered PC I keep hidden in the garage.

If you want to wake on LAN using Ubuntu like I do, you’ll need to set things up first. I’ll explain how below.

Check Your BIOS/UEFI Configuration for Wake-On-LAN

Before attempting to use the Wake-On-LAN (WoL) feature in Ubuntu, you’ll need to make sure that your computer’s BIOS/UEFI settings are correctly configured.

WoL relies on the ability of your network adapter to wake the computer from a low-power state when a specially crafted data packet (called a magic packet) is received. This’ll only work if your BIOS/UEFI settings allow for it, however.

  1. First, restart your computer and enter the BIOS/UEFI settings during boot-up. Check your system manual for the right way to do this, but you can usually do it by pressing F1, F12, or DEL on your keyboard (or similar).
  2. Look in your settings for a power-related menu. It might be labeled as Power, Advanced, or Integrated Peripherals. Check with your device manufacturer or system manual if you’re unsure.
  3. From there, look for an option that may be labeled as Wake on LAN, WoL by PME, Resume by, or similar.
  4. Enable the WoL feature if it’s not already active. This might be displayed more simply as Enabled or with a more complex name, such as Resume By PCI-E.
    Enabling Wake-on-LAN functionality in an example UEFI menu
  5. Save your changes, exit the BIOS/UEFI menu, and then boot back into Ubuntu.

After enabling WoL in the BIOS or UEFI, you’ll need to make further changes in your Ubuntu system settings once you restart.

Identify Your Network Interface and MAC Address

Before you can use Wake-on-LAN, you’ll need to identify which network interface you’re using and the MAC address for it. Your MAC address is a unique identifier assigned to each network interface for communication on the physical network segment.

To find your network interface name and MAC address, follow these steps.

  1. Open a new terminal window.
  2. Type ip link show and press Enter to list all of the network interfaces.
  3. Locate your primary network interface. It might be named something like enp2s0 or eth0. Note the link/ether line, as this contains your MAC address.
    Running the ip link show command in Ubuntu

If ip link show doesn’t show you the details you need (such as your network adapter’s MAC address), you might need to use ethtool. This utility provides more in-depth network device information. To display the permanent MAC address with ethtool, follow these steps.

  1. Open a terminal window.
  2. Type sudo apt install ethtool -y and press Enter.
  3. Once installed, type ethtool -P interface_name into the terminal and press Enter, replacing interface_name with your actual network interface name (eg. eth0). The response will include the permanent MAC address—make a note of it.
    Showing your network adapter MAC address using ethtool on Ubuntu

How to Enable or Disable Wake-on-LAN on Ubuntu Using ethtool

Not every network adapter supports the Wake-on-LAN functionality (although most do). If you want to make sure it works before you try, you can check your network compatibility using ethtool from the terminal, which you can then use to enable the functionality.

  1. First, open a new terminal window.
  2. If you don’t have it installed already, type sudo apt install ethtool -y into the terminal and press Enter.
  3. Identify your network device name using the command ip link show.
    Running the ip link show command in Ubuntu
  4. Type sudo ethtool interface_name and press Enter, replacing interface_name with the actual device name (eg. eth0). Look for the line that confirms Wake-on support in the output. Your network interface will list the supported Wake-on-LAN modes. These modes are typically represented by single letters. For example, g indicates support for wake-on-LAN via a magic packet.
    Confirming WOL support in Ubuntu
  5. If the device supports it, type ethtool -s interface_name wol g and press Enter, replacing interface_name with the device name. This will enable Wake-on-LAN functionality, but it remains temporary—you’ll need to repeat it each time your PC starts or create a new service file to enable it automatically.
    Enabling Wake-on-LAN on Ubuntu
  6. To disable it, type ethtool -s interface_name wol d and press Enter, replacing interface_name with the correct device name.
    Disabling WOL on Ubuntu

If your network interface supports Wake-on-LAN and you’ve enabled the functionality, you should now be able to use it to wake your PC up. Several third-party apps exist for this purpose on several different operating systems, including WakeMeOnLan by Nirsoft for Windows devices and gWakeOnLan for Linux users.

Waking Up Your Ubuntu PC

You don’t need to physically touch your Ubuntu PC to wake it up. You can use Wake on LAN on your Ubuntu PC to start it up and make it accessible again. Once you’ve done that, you should be able to access it remotely, whether that’s via SSH or remote desktop.

Wake-on-LAN isn’t just a Linux-only technology, though. As long as your network is set up for it, and your PC is configured correctly, you should be able to use wake-on-LAN on a Windows PC or a Mac, too.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

 

To Top