Wake-on-LAN (WoL) is a feature to switch on a computer via the network.
This details how to enable WoL on our system.
- Turn on your Server from anywhere!
- [Motherboard]How to set and enable WOL(Wake On Lan) function in BIOS
-
Check if your motherboard supports WoL and how to enable it.
-
In general, head to the motherboard's BIOS and enable WoL:
-
Click the Advanced tab.
-
Select APM Configuration.
-
Under Power On By PCIE, select Enabled.
-
Press the F10 key to save and exit the BIOS.
[!NOTE]
In some cases, you may need to also disable ERP if it was enabled by default by the motherboard. -
-
Get the name of your network interface and its MAC address:
ip addr show
This will return several results/interfaces on our system, including virtual ones. We are interested in the physical interface which connects us to the network.
In most cases, it is the second interface returned. For example:
2: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000 link/ether 80:eg:f9:5f:06:28 brd ff:ff:ff:ff:ff:ff inet 192.168.0.125/24 brd 192.168.0.255 scope global noprefixroute enp7s0 valid_lft forever preferred_lft foreverFrom this example, the interface name is
enp7s0, and the MAC address is80:eg:f9:5f:06:28. -
Use
ethtoolto check if WoL is supported/enabled:sudo ethtool enp7s0 | grep "Wake-on"
Sample output:
Supports Wake-on: pumbg Wake-on: gThe
gin the output of Supports Wake-on indicates that WoL is supported, and thegin the output of Wake-on indicates that WoL is enabled. -
If WoL is not enabled, enable it on said interface (i.e.
enp7s0):ethtool -s enp7s0 wol g
To make it persistent, either create a
wol@systemdservice or install thewol-systemdpackage on Arch Linux based systems.Create a
wol@.servicesystemdservice:sudo nano /etc/systemd/system/wol@.service
Copy the content of the sample wol@.service file, paste it into the service file you created, and save it.
Alternatively, install the
wol-systemdpackage from theAURusingyay.Lastly in either options, start and enable the
wol@systemdservice for the network interface. Assuming the network interface isenp7s0, the service name would bewol@enp7s0.service.
This details how to trigger WoL on a system from another system.
Important
This only works if the target system is connected to the same network (via Ethernet) as the system you are triggering the WoL from.
-
Install the
wakeonlanpackage usingyay.It is also available on
homebrewfor macOS:brew install wakeonlan
-
Run the
wakeonlancommand with the MAC address of the target system that you wish to wake (i.e.80:eg:f9:5f:06:28):wakeonlan 80:eg:f9:5f:06:28