Make one Proxmox node to wake-on-lan another
Nothing is eternal, especially the relevance of documentation. I think help.ubuntu.com is an absolute winner, holding the largest number of outdated and irrelevant pages. But that's not a topic for today's post. One of my Proxmox cluster nodes can't power itself on after the outage. But it supports wake-on-LAN, so I decided that another node could power it on. And the simplicity of this task was overrated by me.
⚠️ Wake on LAN doesn't work across VLANs. Magic packets could be sent and received only inside a single subnet.
The victim
First of all, even after enabling "Wake up on PCI event" or something in BIOS it was not working because WoL was still disabled on a software level. It can be checked with:
ethtool enp1s0
Where enp1s0 is a physical network interface of a Proxmox node, not a bridge.
There should be Wake-on: setting among others. In my case it was Wake-on: d, which means that wake-on-LAN is disabled, according to ethtool documentation:
p Wake on phy activity
u Wake on unicast messages
m Wake on multicast messages
b Wake on broadcast messages
a Wake on ARP
g Wake on MagicPacket(tm)
s Enable SecureOn(tm) password for MagicPacket(tm)
d Disable (wake on nothing). This option clears all previous options.
We need to set it to wake by the MagicPacket(tm).
for Proxmox 8 or older
We need to create a config file for this to be enabled on system start. But first we need to:
ip link show enp1s0
and write down our network device MAC address. Then create a file:
nano /etc/systemd/network/90-wakeonlan.link
with the next content:
[Match]
MACAddress=<mac-address-here>
[Link]
NamePolicy=kernel database onboard slot path
MACAddressPolicy=persistent
WakeOnLan=magic
for Proxmox 9
We need to create a systemd service that will be launched on system start and change the WOL setting with ethtool.
Create a file:
nano /etc/systemd/system/wol.service
with the next content:
[Unit]
Description=Enable Wake On Lan
[Service]
Type=oneshot
ExecStart=/usr/sbin/ethtool --change enp1s0 wol g
[Install]
WantedBy=multi-user.target
changing enp1s0 to your interface name. Enable the service:
systemctl daemon-reload && systemctl enable wol.service
then
After that we need to reboot and check WOL status again:
ethtool enp1s0
Now Wake-on should be set to g.
The one who bothering
On another node we need to install an util that will be sending a magic packet:
apt update
apt install etherwake
Now we can power the victim off and try to wake it with:
etherwake -i vmbr0 <mac_address>
Where vmbr0 is a bridge network interface of current Proxmox node, and <mac_address> is a MAC address of the victim's physical network interface.
If it works, we can now add a cron job to wake our victim upon current node startup, adding some delay to make sure the network is ready:
crontab -e
Cron job line to add:
@reboot sleep 30s && /usr/sbin/etherwake -i vmbr0 <mac_address>