Enabling WakeOnLan

Wake-on-LAN (WoL) allows a machine to be powered on remotely by sending a “magic packet” over the network. This is useful for servers or workstations you want to reach without physical access.

WoL is not always active by default; the network interface may reset to a no-WoL state on every boot. To make it persistent, we create a small systemd service that runs ethtool at startup to re-enable it each time.

Note

Replace eno1 with the name of your main network interface. To find it, run ip a and look for the interface that carries your primary IP address.

# Install ethtool
apt-get update
apt-get install --no-install-recommends ethtool

# Create systemd service
cat > /usr/lib/systemd/system/wake-on-lan.service << _EOF
[Unit]
Description=Wake-On-Lan service

[Service]
Type=oneshot
ExecStart=ethtool -s eno1 wol g

[Install]
WantedBy=multi-user.target
WantedBy=network-online.target
_EOF

# Activate it
systemctl daemon-reload
systemctl unmask wake-on-lan
systemctl enable wake-on-lan