NETSetup can integrate with Wake-on-LAN (WOL) to remotely trigger machine setup or
maintenance tasks - useful for automated deployments. The netsetup CLI exposes
wake-machine, wake-machines, enable-wol, and query-wol-status (see the Usage
section in netsetup.adoc). This doc covers enabling WOL on the
target machines themselves.
Prerequisites
Network and hardware must support WOL. This typically involves:
-
BIOS/UEFI settings enabling WOL for the network adapter.
-
Network interface card (NIC) supporting WOL.
-
Proper network configuration to allow WOL packets.
Configuring WOL on Linux targets
For Linux-based systems that netsetup might be deploying or managing, WOL can be
configured as follows.
Required packages
sudo apt-get update
sudo apt-get install build-essential libelf-dev ethtool
Identifying network interfaces
Network interfaces are often named enp1s0 and enp2s0 on systems like H4. Check
your system’s interfaces with:
ip link
Checking and enabling WOL
Check if WOL is enabled for an interface (e.g. enp1s0):
ethtool enp1s0 | grep Wake
Alternatively, check all interfaces:
grep . /sys/class/net/*/device/power/wakeup 2>/dev/null
Temporarily enable WOL for an interface:
sudo ethtool -s enp1s0 wol g
Persistent WOL configuration
To enable WOL persistently across reboots, create a systemd service at
/etc/systemd/system/wol@.service:
[Unit]
Description=Wake-on-LAN for %i
Requires=network.target
# After=network.target
After=network-online.target
[Service]
ExecStart=/bin/sh -c "ethtool -s %i wol g"
Type=oneshot
[Install]
WantedBy=multi-user.target
Then enable and start it for your network interface (e.g. enp1s0):
sudo systemctl enable wol@enp1s0.service
sudo systemctl start wol@enp1s0.service