Published on : 2026-02-23 18:09
This is an update to my earlier post:
(DIR) Using Wake On Lan so you don't have to use your fingers
For context, I use Wake-on-LAN so I don't have to manually power
on my cluster of Lenovo machines (worker nodes) every morning.
The script checks the MAC addresses of each machine and sends a
"magic packet" to wake them up.
Recently, my script stopped working. My master node Tiny kept
running this script but the workers didn't wake up. The reason is
that Wake-on-LAN packets are sent as broadcast messages. Without
specifying the broadcast IP, the packets were only being sent to
a single IP, which doesn't always reach sleeping machines. This
is why my machines stopped waking up.
The fix was simple: add the broadcast IP to the script.
Here's the new working version:
#!/usr/bin/env bash
# Broadcast IP
IP="192.168.1.255"
# MAC addresses (Not the real ones)
MAC1="D2:CB:3B:20:DC:AE" # lenovo1 mac
MAC2="D2:CB:3B:20:DD:37" # lenovo2 mac
MAC3="D2:CB:3B:20:D6:04" # lenovo3 mac
MAC4="6C:0C:84:A9:4C:83" # lenovo NAS
# Wake up the machines
wakeonlan -i $IP $MAC1
wakeonlan -i $IP $MAC2
wakeonlan -i $IP $MAC3
wakeonlan -i $IP $MAC4
echo "Cluster workers have been woken up!"
This post exists to save you a few hours of frustration.
If you're using wakeonlan and your machines suddenly stop waking
up, check whether you're sending to the correct broadcast address.
It might be the simplest fix you didn't think of.
(DIR) Back to my phlog