This page explains how to enable use of Wake-on-LAN (WoL) in systems that have Ubuntu installed.

Introduction

Wake-on-LAN enables users to turn on a computer across a network from another network device. It can be very useful in situations where computers are not all next to each other or there are a lot of machines. WoL works by sending a packet of data called a Magic Packet™ to the target machine. When the packet is received, the target machine's network device (Network Interface Controller or NIC) wakes-up the rest of the machine.

Setting Up Wake-on-LAN

In order to use WoL it must be supported and enabled as necessary in the BIOS, NIC and other network hardware (routers, switches etc). You may also need to configure some software if things don't work out-of-the-box.

This section may differ depending on whether or not you have a NIC integrated into your motherboard.

Using an Integrated NIC

To enable WoL in the BIOS, enter the BIOS setup and look for something called "Wake up on PCI event", "Wake up on LAN" or similar. Change it so that it is enabled. Save your settings and reboot.

Using a Non-Integrated NIC

If your NIC is not integrated into your motherboard, you will still have to configure your BIOS to allow devices to wake up your computer. Boot your computer and enter the BIOS settings menu. In one of the sub-menus there will hopefully be the option to allow USB and/or PCI devices to wake-up the computer. Enable the setting that is appropriate for your NIC. Save your settings and reboot.

PCI NICs sometimes require a cable connection to the power supply in order to stay awake when the computer is off/asleep. Check your manual to see if yours does and install if necessary.

Enabling WoL in the NIC

Determining whether the NIC supports WoL

First, determine which NIC will be used, and then check whether it supports the Magic Packet™ using

sudo ethtool <NIC>

where <NIC> is the device name of your NIC, e.g. eth0. This command will output some information about your the capabilities of your NIC. If this output contains a line similar to the following:

Supports Wake-on: <letters>

where <letters> contains the letter g, the NIC should support the WoL Magic Packet™ method (for the other letters look at man ethtool).

Enabling WoL in the NIC

To check whether WoL is enabled in the NIC, one could use

sudo ethtool <NIC>

and look for

Wake-on: <letters>

If <letters> contains g and not d, then Magic Packet™ is enabled. However, if <letters> does contain d, WoL needs to be enabled by running the following command:

sudo ethtool -s <NIC> wol g

On most systems, issuing this command is required after each boot. If the system's networking is configured via ifupdown, then it is easy to add the line up ethtool -s <NIC> wol g below the interface's configuration stanza in /etc/network/interfaces. For example:

shahar@shahar-backup:~$ cat /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface

auto lo
iface lo inet loopback
# The primary network interface

auto eth0
iface eth0 inet static
 address 10.0.0.1
 netmask 255.255.255.0
 gateway 10.0.0.138
        up ethtool -s eth0 wol g

This will ensure that WoL is enabled in the NIC on each boot. Fore more information see the interfaces manual.

Testing Wake-On-LAN

Test WoL by powering off the system and trying to send it the magic packet using:

GTK+ tool

Configure other operating systems

If the system dual-boots with other operating systems, they should be configured to also enable or, at least, not disable WoL in the NIC. This is beyond the scope of this document but here's a starting point for Microsoft's OS's.

Troubleshooting

If WoL is not working as expected, there are a number of lines of investigation to follow:

CategoryNetworking CategoryPowerManagement