I had Wake-on-LAN issues myself what feels like ages ago…
Eventually I managed to get it working properly.
Admittedly with the help of AI (!!)
fair disclaimer: AI is not infallible, but in my case this solution has been working perfectly ever since.
I wrote the following down back then ( and hey!! I even found my notes again today
)
Enabling Persistent Wake-on-LAN on Debian/Ubuntu (systemd method)
Introduction
Under Linux, the network interface card (NIC) is typically configured during shutdown in a way that disables Wake-on-LAN (WOL).
This means that after a full shutdown or power loss, WOL may no longer be active unless it is manually re-enabled on the next boot.
If you want to reliably use Wake-on-LAN , for example, to power on a machine via magic packet after a power outage, you need to enable WOL persistently.
This guide explains how to achieve this on Debian- or Ubuntu-based systems using a systemd service.
- Identify Your Network Interface
Run the following command in a terminal:
ip link
Example output:
1: lo: …
2: enp1s0: …
Note the name of your active network interface, for example enp1s0
Depending on your system, it might also be called eth0, enp3s0, etc.
- Install ethtool (if not already installed)
If ethtool is not installed, run:
sudo apt update
sudo apt install ethtool
- Create a systemd Service to Enable WOL at Boot
Step 1: Create a new service file:
sudo nano /etc/systemd/system/wol.service
Step 2: Insert the following content into the file:
[Unit]
Description=Enable Wake-on-LAN
After=network.target
[Service]
Type=oneshot
ExecStart=/sbin/ethtool -s enp1s0 wol g
[Install]
WantedBy=multi-user.target
Important: Replace enp1s0 with the actual network interface name you identified in step 1.
Step 3: Save and exit the editor.
Save with Ctrl + O, press Enter, then exit with Ctrl + X.
- Enable the Service
To make the service run automatically at boot, execute:
sudo systemctl daemon-reexec
sudo systemctl enable wol.service
- (Optional) Run Immediately and Verify
To start the service right away:
sudo systemctl start wol.service
To verify that Wake-on-LAN is enabled:
sudo ethtool enp1s0 | grep Wake-on
The expected output should be:
Wake-on: g
Result
Wake-on-LAN is permanently enabled
The setting persists even after a power loss
The operating system no longer disables WOL during shutdown
There is no need to manually re-enable WOL after each boot
Hope this helps someone who runs into the same issue.