Wake on LAN (WoL)

The Wake-on-LAN (WoL) feature was implemented in Batocera v33 where it is enabled on any WoL capable system by default (if you want to disable WoL for your system for whatever reason, then just disable WoL in your system's BIOS). With WoL it is possible to turn on/off your Batocera machine by sending a “magic packet” (or something else, more info later) from a remote WoL client via a network cable. This could be used for automation purposes, for example to turn on your Batocera system at a specific time at night to backup all your userdata and games to a NAS and then shutdown again. And many other things!

On the Batocera machine, the functionality of WoL is dependent on two components supporting it:

  • BIOS: The system's BIOS must support WoL (you may have to enable WoL within your system's BIOS settings).
  • NIC: The system's network adapter must support WoL to stay “awake” while the system is powered off.

WoL is designed for use with wired Ethernet connections, but there are wireless NICs which may support Wake-on-Wireless (WoW). This article assumes you are using a standard wired connection.

If you are dual-booting with Windows on the same machine, you may need to also tell Windows to not disable the WoL shutdown procedure in its drivers.

This section can not be specific to your motherboard's BIOS configuration, so the instructions can only remain broad. With that said, here are the options you must generally set:

  • Wake-on LAN: Any setting that's related to this should be enabled/activated/unblocked.
  • Wake-on PCI: The same as above (enabled), if this option is separated out from the previous one then it usually refers to the powered state of the NIC when the rest of the machine is shut down.
  • Network stack: Set to disabled. Usually, this setting is in relation to whether or not the BIOS itself gains control of the network connection; if it does then WoL cannot function.
  • IP configuration: When done in the context of the BIOS, this means the Network Stack is enabled. If there's no explicit option to turn off the network stack, leaving all the IP-related fields empty should disable it.
  • Power savings profile: When mentioned in relation to the shutting down of devices when the machine is in S3/4, disable this. It may cause the NIC to shutdown after a period of inactivity.

When done, save and reboot to apply.

You may be wondering if you also need to enable the Wake-on-LAN feature in the NIC's settings as well. You don't, Batocera will automatically take care of enabling it for you.

Note: It is important to have your WoL client and your Batocera system within the same Layer 2 subnet of your network, otherwise WoL will not work by default.

It is possible to set up a dynamic DNS and port forwardings on your router to send WoL from other subnets but that is outside of the scope of this article.

To find out the unique MAC address of your Batocera system's NIC, run ip link show.

MAC address

The MAC address for this NIC (eth0) is f0:1f:af:25:dc:8b.

You can now use the given MAC address to wake the Batocera machine up remotely from another device (e.g. PC, Smartphone, …) which is within the same Layer 2 subnet and has a WoL client (GUI based or command line based WoL client) installed.

Example of a WoL client for Windows (Depicus Wake on Lan for Windows GUI):

WoL client settings

Most utilities require the following information (or similar enough to it):

  • Mac Address ⇒ MAC address of your NIC on the Batocera machine.
  • Internet Address ⇒ The IP of the NIC on the Batocera machine (if only one NIC is present on the WoL client, you can leave this empty).
  • Subnet MaskNetmask of the network's subnet.
  • Send options ⇒ Choose Local Subnet.
  • Remote Port Number ⇒ The port to send the traffic on. Acceptable values are generally 9 (default) or 7.

Click on Wake Up to wake the Batocera machine up.

  • Try changing the port number from 9 to 7. If the machine uses an esoteric port this will usually be noted in its documentation.
  • Try sending the packet via Internet instead of Local Subnet if you are using the GUI based WoL client mentioned above.
  • Check if your system does even support WoL by running ifconfig which helps you to identify the network interface name of your according connection (e.g. eth0), and then run the appropriate ethtool eth0 command. It should give you an output similar to this:
Settings for eth0:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Speed: 1000Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 1
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: on (auto)
	Supports Wake-on: pumbg
	Wake-on: g
	Current message level: 0x00000007 (7)
			       drv probe link
	Link detected: yes

The important two parts for getting information about your NIC's WoL capability are:

Property Notes
Supports Wake-on: Shows which hardware WoL capabilities the NIC supports (these values cannot be changed by the user)
Wake-on: Shows which software WoL capabilities are currently enabled (these can be turned on/off by the user)

The value g means that your NIC supports receiving magic packets and therefore is WoL capable. Note that your NIC could also support multiple WoL functions and therefore you would get multiple output values as shown above, e.g. Supports Wake-on: pumbg.

Here is a full list of output possibilities (more info at https://linux.die.net/man/8/ethtool or the man ethtool command):

  • p ⇒ Wake on PHY activity
  • u ⇒ Wake on unicast messages
  • m ⇒ Wake on multicast messages
  • b ⇒ Wake on broadcast messages
  • a ⇒ Wake on ARP
  • g ⇒ Wake on MagicPacket™
  • s ⇒ Enable SecureOn™ password for MagicPacket™
  • d ⇒ Disable (wake on nothing). This option clears all previous options.

The most important value is g. Without it being shown, the NIC does not support WoL at all.

Batocera should automatically turn on the MagicPacket™ feature when the connection is established. If that fails, in order to turn on WoL manually run the following:

ethtool -s eth0 wol g

where eth0 is the name of your network interface.

If dual booting, the cause is most likely the second operating system turning WoL back off. On Windows, turn off the shutdown WoL feature.

If you were successfully using WoL but suddenly it does not work anymore, a power outage of your Batocera system could be the issue. Since WoL functionality relies on a “sleeping” NIC state issued when shutting down the system, the NIC will not be in “sleeping” state anymore after power outage. Therefore you can only make WoL work again by manually booting and then shutdown the system once.

  • wake_on_lan.txt
  • Last modified: 2 years ago
  • by atari