Intro

Proxmox VMs don't support wake-on-lan per se. But there is another solution to mimic this behaviour.

 

Guide

This is how I did it.

      1. Get the zip from this post on the Proxmox forum; https://forum.proxmox.com/threads/update-wake-and-other-on-lan-for-vms-v0-3.26381/post-302172.

      2. Copy the zip to all your proxmox-nodes.

      3. Make sure you have unzip, socat and vim installed on the proxmox-nodes.
        # apt install unzip socat vim

      4. Unzip the archive to a subfolder called dosthol-0.6.
        # unzip dosthol-0.6.zip -d dosthol-0.6

      5. See instructions on where to put the files in the Proxmox forum post https://forum.proxmox.com/threads/update-wake-and-other-on-lan-for-vms-v0-3.26381/.

      6. According to §5, copy the file dosthol.service to /etc/systemd/system.
        # cd dosthol-0.6
        # cp dosthol.service /etc/systemd/system

      7. According to §5, copy the file dostholc.sh and dosthold.sh files to /usr/local/bin.
        # cp dostholc.sh dosthold.sh /usr/local/bin/

      8. Make the system aware of the new daemon.
        # systemctl daemon-reload

      9. Activate the new daemon.
        # systemctl enable dosthol.service

      10. Start it.
        # systemctl restart dosthol.service

      11. Confirm it's running.

        # systemctl status dosthol.service
        * dosthol.service - dosthol (Do something on LAN)
        Loaded: loaded (/etc/systemd/system/dosthol.service; enabled; preset: enabled)
        Active: active (running) since Tue 2024-08-06 10:38:28 CEST; 21min ago
        Main PID: 1876279 (dosthold.sh)
        Tasks: 4 (limit: 125514)
        Memory: 1.9M
        CPU: 23ms
        CGroup: /system.slice/dosthol.service
        |-1876279 /bin/bash /usr/local/bin/dosthold.sh
        |-1876281 socat -u udp-recv:9,readbytes=102 -
        |-1876282 xxd -u -p -c 102
        `-1876283 gawk "{\$1=\$1}1" FPAT=.{2} OFS=:

        Aug 06 10:38:28 cyndane5 systemd[1]: Started dosthol.service - dosthol (Do something on LAN).

      12. You're done setting this up.
        You may also have a look at the Update header below.

 

 

Waking up a shutdown VM

  1. Ssh into one of your Proxmox nodes.
    # ssh servername

  2. Waking a VM is done like so. The VM can be off, sleeping or hibernated.
    Let's wake up the jenkins server. It's called jenkins and has the following MAC address; 02:c0:d3:c3:b6:de.
    # dostholc.sh -m D6:F2:3E:BF:47:97 -f toggle

  3.  Confirm in the Proxmox web GUI that the VM has indeed started.

 

What if you don't know the MAC address? Finding the MAC address

Open a terminal and run the following command. Last output shows the MAC address.

# ping -c 3 jenkins && arp -n
PING jenkins (192.168.0.22) 56(84) bytes of data.
64 bytes from jenkins (192.168.0.22): icmp_seq=1 ttl=64 time=0.329 ms
64 bytes from jenkins (192.168.0.22): icmp_seq=2 ttl=64 time=0.302 ms
64 bytes from jenkins (192.168.0.22): icmp_seq=3 ttl=64 time=0.281 ms

--- jenkins ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2055ms
rtt min/avg/max/mdev = 0.281/0.328/0.403/0.046 ms
Address HWtype HWaddress Flags Mask Iface
192.168.0.1 ether 14:59:c0:5a:4a:f3 C vmbr0
192.168.0.100 ether dc:4a:3e:79:4e:5c C vmbr0
192.168.0.15 ether 00:11:32:87:27:17 C vmbr0
192.168.0.24 ether 26:27:66:39:53:b5 C vmbr0
192.168.0.7 ether 6c:62:6d:ca:f4:d8 C vmbr0
192.168.0.31 ether e6:39:9c:90:d6:57 C vmbr0
192.168.0.5 ether 00:24:e8:4a:fa:d1 C vmbr0
192.168.0.30 ether 1a:e6:18:95:91:9f C vmbr0
192.168.0.23 ether fe:89:fe:ed:b5:85 C vmbr0
169.254.0.1 ether b0:83:fe:c7:b8:99 C idrac
192.168.0.10 ether bc:24:11:72:22:03 C vmbr0
192.168.0.22 ether 02:c0:d3:c3:b6:de C vmbr0

 

 

Update

Apparently there is a newer version available in this Proxmox forum post; https://forum.proxmox.com/threads/update-wake-and-other-on-lan-for-vms-v0-3.26381/post-447531.

This version adds some more dependencies as laid out in https://forum.proxmox.com/threads/update-wake-and-other-on-lan-for-vms-v0-3.26381/post-463891.

The wakeup is done as below.

# bash /usr/local/bin/dostholc.sh -f wakeup -m XX:XX:XX:XX:XX:XX -v 1

 

 

 

Sources

https://forum.proxmox.com/threads/wake-on-lan-for-vm.84355/
https://forum.proxmox.com/threads/update-wake-and-other-on-lan-for-vms-v0-3.26381/post-302172
https://www.cyberciti.biz/tips/linux-send-wake-on-lan-wol-magic-packets.html

 

 

 

 

 

 

 

 

 

Stop Spam Harvesters, Join Project Honey Pot

 

Get a free SSL certificate!

 

The leading nonprofit defending digital privacy, free speech, and innovation.

 

The Linux Foundation provides a neutral, trusted hub for developers and organizations to code, manage, and scale open technology projects and ecosystems.

 

Kubuntu is an operating system built by a worldwide community of developers, testers, supporters and translators.

 

 43ef5c89 CanonicalUbuntudarktext