Wake on LAN
Appearance
Wake on LAN (WoL) is a method used to turn on the target computer over the network.
1 Hardware Settings
Wake on LAN can be enabled when the following two conditions are met:
- Target computer's motherboard and Network Interface Controller (NIC) has Wake on Lan support.
- Target computer has to be physically connected (with a cable) to a router or to the source computer for WoL to work properly or your wireless card has Wake on Wireless (WoWLAN or WoW) support.
Prepare BIOS/UEFI:
- Enable the Wake on LAN feature. Different motherboard manufacturers use slightly different language for this feature. Look for terminology such as "PCI Power up", "Allow PCI wake up event" or "Boot from PCI/PCI-E".
- (If available in BIOS/UEFI) Make sure that ErP is disabled, otherwise your Ethernet card will not be powered and will not be able to recieve any wake-up packets sent form another device.
2 NixOS Configuration
2.1 Enable Wake on Lan for a Network Interface
The following example enables Wake on Lan for ens3 interface and opens port 9 (WoL UDP Port) for target computer.
networking = {
interfaces = {
ens3 = {
wakeOnLan.enable = true;
};
};
firewall = {
allowedUDPPorts = [ 9 ];
};
};
2.2 Source Configuration and usage
After setting up the target computer, install wakeonlan package on the source computer.
environment.systemPackages = with pkgs; [
wakeonlan
];
The output of the ip a command contains the link/ether address under the ens3 interface. Copy this and run it as shown in the example command. In this example Target IP is 192.168.1.50.
wakeonlan -i 192.168.1.50 {your_link/ether_adress}