Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wake_on_lan [2022/01/14 06:12] – Change 1: USB-LAN Adapters removed as there will be too many challenges (e.g. WoL capability and "Always Power On USB"). Change 2: WoL is a Layer 2 protocol. As WoL packages are not going to be routed across subnets anyway they never pass the router. The grandmabettywake_on_lan [2022/09/28 08:52] (current) – [Machine will not wake up] clarification on what batocera does automatically atari
Line 1: Line 1:
 ====== Wake on LAN (WoL) ====== ====== Wake on LAN (WoL) ======
  
-The [[wp>Wake_On_LAN|Wake-on-LAN (WoL)]] feature was implemented in Batocera **v33**. After enabling it, it is possible to turn on/off your Batocera machine by sending a "magic packet" (or something else, more info later) via a network cable. This could be used to turn on the machine by using network protocol call, network-connected IR remote receiver, a packet sent over a virtual network, and many other things!+The [[wp>Wake_On_LAN|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 reasonthen 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 [[homeautomation|automation purposes]], for example to turn on your Batocera system at specific time at night to backup all your userdata and games to NAS and then shutdown again. And many other things!
  
 ===== Requirements ===== ===== Requirements =====
Line 8: Line 8:
   * **BIOS**: The system's BIOS must support WoL (you may have to enable WoL within your system's [[:install_batocera#bios_settings_if_batocera_fails_to_boot|BIOS settings]]).   * **BIOS**: The system's BIOS must support WoL (you may have to enable WoL within your system's [[:install_batocera#bios_settings_if_batocera_fails_to_boot|BIOS settings]]).
   * **NIC**: The system's network adapter must support WoL to stay "awake" while the system is powered off.   * **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.
  
 <WRAP center round tip> <WRAP center round tip>
Line 13: Line 15:
 </WRAP> </WRAP>
  
-After checking for the above, boot Batocera and [[:access_the_batocera_via_ssh|run]] ''ifconfig''. Identify the network interface name of your connection, and then run the appropriate ''ethtool eth0'' command, where ''eth0'' is the name of your network interface. It should give you an output similar to this:+===== Setting up the BIOS =====
  
-<WRAP center round todo> +This section can not be specific to your motherboard's BIOS configuration, so the instructions can only remain broadWith that said, here are the options you must generally set:
-Typical example output here. +
-</WRAP>+
  
-^ Property              ^ Notes ^ +  * **Wake-on LAN**Any setting that's related to this should be **enabled**/activated/unblocked. 
-| ''Supports Wake-on:'' | Shows which hardware WoL capabilities the NIC supports (these values cannot be changed by the user) | +  * **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. 
-| ''Wake-on:''          | Shows which software WoL capabilities are currently enabled (these can be turned on/off by the user) |+  * **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.
  
-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, e.g. ''Supports Wake-on: pumbg''.+When done, save and reboot to apply.
  
-Here is a full list of output possibilities (more info at https://linux.die.net/man/8/ethtool or the ''man ethtool'' command): +<WRAP center round info> 
-  * ''p'' =Wake on PHY activity +You may be wondering if you also need to enable the Wake-on-LAN feature in the NIC'settings as wellYou don't, Batocera will automatically take care of enabling it for you.
-  * ''u'' => Wake on unicast messages +
-  * ''m'' => Wake on multicast messages +
-  * ''b'' => Wake on broadcast messages +
-  * ''a'' => Wake on ARP +
-  * ''g'' => Wake on MagicPacket(tm) +
-  * ''s'' => Enable SecureOn(tm) password for MagicPacket(tm) +
-  * ''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. +
- +
-==== Output example of disabled WoL NIC ==== +
- +
-It may be that WoL is disabled on your NIC which would result in the following output when executing the command above: +
- +
-<code> +
-Supports Wake-on: g +
-Wake-on: +
-</code> +
- +
-This means the machine'NIC is indeed WoL capable but not yet enabledTo enable the according option persistently a udev rule can be utilized. Read the [[#configuring_wol|section below]] on how to do that. +
- +
-===== Enabling WoL via udev ===== +
- +
-First, if it doesn'already exist create the folder(s) at ''/userdata/system/udev/rules.d/''. Thensave the following file into the ''rules.d/'' folder: +
- +
-<file - 99-wol.rules> +
-ACTION!="add|change", GOTO="end" +
-SUBSYSTEM!="net", GOTO="end" +
-ENV{INTERFACE}!="eth*", GOTO="end" +
- +
-TEST=="/sys/class/net/$env{INTERFACE}/device/power/wakeup", RUN+="/bin/sh -c 'echo enabled >/sys/class/net/$env{INTERFACE}/device/power/wakeup'" +
- +
-ACTION=="add|change", SUBSYSTEM=="net", ENV{INTERFACE}=="eth*", RUN+="/usr/sbin/ethtool -s $env{INTERFACE} wol g" +
- +
-LABEL="end" +
- +
-</file> +
- +
-<WRAP center round tip> +
-The code below will enable WoL for all of your system's WoL capable NICs. If for some reason you want to enable WoL only for a specific NIC (e.g. ''eth0''), replace ''eth*'' with the according specific NIC name on the ''ACTION'' code line .+
 </WRAP> </WRAP>
- 
-Reboot the machine. 
  
 ===== Wake up your Batocera device remotely ===== ===== Wake up your Batocera device remotely =====
  
 <WRAP center round important> <WRAP center round important>
-Note: It is important to have your WoL client and your Batocera system within the same [[https://en.wikipedia.org/wiki/OSI_model#Layer_2:_Data_link_layer|Layer 2]] subnet of your network, otherwise WoL will not work as WoL packages cannot be routed over different subnets.+Note: It is important to have your WoL client and your Batocera system within the same [[https://en.wikipedia.org/wiki/OSI_model#Layer_2:_Data_link_layer|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.
 </WRAP> </WRAP>
  
Line 93: Line 55:
   * **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).   * **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 Mask** => [[wp>Subnetwork|Netmask]] of the network's subnet.   * **Subnet Mask** => [[wp>Subnetwork|Netmask]] of the network's subnet.
-  * **Send options** => FIXME (what is this for? Why would I want to change it?) Choose ''Local Subnet''.+  * **Send options** => Choose ''Local Subnet''.
   * **Remote Port Number** => The port to send the traffic on. Acceptable values are generally 9 (default) or 7.   * **Remote Port Number** => The port to send the traffic on. Acceptable values are generally 9 (default) or 7.
  
Line 104: Line 66:
   * 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 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.   * 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 [[:access_the_batocera_via_ssh|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:
 +<code>
 +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
 +</code>
 +
 +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(tm)
 +  * ''s'' => Enable SecureOn(tm) password for MagicPacket(tm)
 +  * ''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(tm) feature when the connection is established. If that fails, in order to turn on WoL manually run the following:
 +
 +<code>
 +ethtool -s eth0 wol g
 +</code>
 +
 +where ''eth0'' is the name of your network interface.
  
 ==== It works great the first time! But not any time after... ==== ==== It works great the first time! But not any time after... ====
Line 109: Line 125:
 If dual booting, the cause is most likely the second operating system turning WoL back off. On Windows, [[:troubleshooting#ethernet_connected_but_no_data|turn off the shutdown WoL feature]]. If dual booting, the cause is most likely the second operating system turning WoL back off. On Windows, [[:troubleshooting#ethernet_connected_but_no_data|turn off the shutdown WoL feature]].
  
 +==== Machine will not wake up anymore ====
 +
 +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.1642140756.txt.gz
  • Last modified: 4 years ago
  • by grandmabetty