November 15, 201510 yr Wake On Lan for Virtual Machines 6.1+ Based on simoncadman/libvirt-wakeonlan github https://github.com/simoncadman/libvirt-wakeonlan This plugin is a daemon which listens for a wake on lan packet on udp port 7, port 9 and ether protocol 0x0842 then starts the corresponding KVM based virtual machine. I tested it to work with an android app called Wake On Lan, ether-wake and asus router. This will work with 6.1+ This will only work on stopped or hibernated virtual machines. It will not wake up vm's in a sleep state. 1. Copy the plugin url: https://raw.githubusercontent.com/dmacias72/unRAID-libvirtwol/master/plugin/libvirtwol.plg 2. Paste url into install plugin text input and click install 3. Wake On Lan will be added to Settings/VMSettings page for starting the daemon As of 2018.01.13 NerdPack plugin is required to install Python 2 https://raw.githubusercontent.com/dmacias72/unRAID-NerdPack/master/plugin/NerdPack.plg Change Log: ###2019.01.06 - move all python dependencies to virtual environment package - add initial support for virtual bmc ###2018.10.28 - update libvirt-python to 4.7 for 6.6 - remove support link from readme ###2018.01.13 - require NerdPack for Python 2 install - add notification for missing python ###2017.11.28a - update libvirt-python to 3.8 for 6.4 - update python to 2.7.14a for 6.4 - add work around to plugin install services ###2017.11.28 - move to separate repo ###2017.04.11 - update python for 6.2, 6.3 and 6.4 ###2017.01.30a harden code for XSS and CSRF vulnerabilities - fix form not defined and submitting - update libvirt-python to 2.5.0 for 6.3 - update python to 2.7.13 - add support link to readme ###2016.11.05 - fix: continue script on exception e.g. error in vm xml ###2016.10.22 - fix: min and max ###2016.10.15 - add: min and max versions ###2016.10.09 - update for 6.3 ###2016.09.16 - update python to 2.7.12 ###2016.06.04 - add rc script - amend dynamix plugin api ###2016.04.16 - add help button comments - add dynamix plugin API - add white-space: normal to fix status css formatting ###2016.03.23 - remove libpcap package ###2016.03.19 - add wake on lan to advanced view ###2016.03.14 - update package locations ###2016.03.12 - add dual package support for 6.1 and 6.2+ - add python 2.7.11 for 6.2+ - add libvirt python 1.3.1 for 6.2+ - move settings to php file and include in vm settings - move all permissions on scripts to plugin package install ###2016.01.22 - update install and remove scripts - check if config exists - create a default config file ###2016.01.02 - fix not starting with array ###2015.12.21a - fix config file and start/stop - add unRAID version check - add md5 package ckeck - convert install and remove scripts ###2015.12.01 - added fix for other packet sizes ###2015.11.18 - update python to 2.7.9 ###2015.11.17 - fix start and stop event permissions ###2015.11.16 - added promiscuous mode to listen for all packets - will recieve all ether proto 0x0842 packets now ###2015.11.15 - added support for ethertype 0x0842 - tested with ether-wake but asus router still not waking ###2015.11.14c - fix plugin page image and link - pkg variable typo ###2015.11.14 - initial commit Edited January 7, 20197 yr by dmacias
December 1, 201510 yr Hi dmacias, many thanks for your plugin. I want to use it for my virtual gaming machine to be started automaticly if SHIELD TV wants to start a game. But if i sent a "magic packet" the from SHIELD or from my Router to the virtual MAC, nothing happens. I can see the Broadcast with tcpdump in the network. Virtual host will not be started. Also the log (/var/log/libvirt/libvirtwakeonlan.log) is empty. My Setup: unRAID- 6.1.4 Bridged network (br0) If you need more information, let me know it. Thx
December 1, 201510 yr Author Hi dmacias, many thanks for your plugin. I want to use it for my virtual gaming machine to be started automaticly if SHIELD TV wants to start a game. But if i sent a "magic packet" the from SHIELD or from my Router to the virtual MAC, nothing happens. I can see the Broadcast with tcpdump in the network. Virtual host will not be started. Also the log (/var/log/libvirt/libvirtwakeonlan.log) is empty. My Setup: unRAID- 6.1.4 Bridged network (br0) If you need more information, let me know it. Thx Is the daemon running? Under Settings/VM Manger/Wake On Lan does Enable Wake On Lan have a green running next to it? Check the log that after you start the daemon it says something like this. /usr/local/emhttp/plugins/libvirtwol/scripts/start Dec 1 06:08:50 server kernel: device br0 entered promiscuous mode Check there's nothing else that could be blocking the packet like firewall or something else. Can you try wol from a computer or phone app to see if that works? Also there's a log created at /var/log/libvirt/libvirtwakeonlan.log
December 1, 201510 yr Under Settings/VM Manger/Wake On Lan does Enable Wake On Lan have a green running next to it? The daemon is running. Status under "Settings/VM Manger/Wake On Lan" is green. root@Hub:~# ps -ef | grep libvirtwol root 14180 1 0 14:20 pts/0 00:00:00 /usr/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0 dmesg device br0 entered promiscuous mode No logging root@Hub:~# ls -l /var/log/libvirt/ total 16 -rw------- 1 root root 13795 Dec 1 07:44 libvirtd.log -rw-rw-rw- 1 root root 0 Dec 1 14:22 libvirtwakeonlan.log There is no firewall between unRAID system and the clients (same network). I tried a 3rd app on my android phone (Wake On Lan from Mike Webb). No wakeup with SHIELD, Router and the android app.
December 1, 201510 yr Author That's the same android app I used. It uses upd port 9. Only thing I can think is to enable wake on lan in your bios. Maybe the network card is blocking it. I have a tcpdump package in my github. I'll get you the link and some commands to run from unRAID console in a few.
December 1, 201510 yr Author Under Settings/VM Manger/Wake On Lan does Enable Wake On Lan have a green running next to it? The daemon is running. Status under "Settings/VM Manger/Wake On Lan" is green. root@Hub:~# ps -ef | grep libvirtwol root 14180 1 0 14:20 pts/0 00:00:00 /usr/bin/python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0 dmesg device br0 entered promiscuous mode No logging root@Hub:~# ls -l /var/log/libvirt/ total 16 -rw------- 1 root root 13795 Dec 1 07:44 libvirtd.log -rw-rw-rw- 1 root root 0 Dec 1 14:22 libvirtwakeonlan.log There is no firewall between unRAID system and the clients (same network). I tried a 3rd app on my android phone (Wake On Lan from Mike Webb). No wakeup with SHIELD, Router and the android app. That's the same android app I used. It uses upd port 9. Only thing I can think is to enable wake on lan in your bios. Maybe the network card is blocking it. I have a tcpdump package in my github. I'll get you the link and some commands to run from unRAID console in a few. Here's the package. Just wget and installpkg and some commands to test with it. See if anything shows in the console when you send a wol packet. https://raw.githubusercontent.com/dmacias72/unRAID_6.0/master/tcpdump-4.4.0-x86_64-1.txz tcpdump -i br0 ether proto 0x0842 tcpdump -i br0 udp port 9
December 1, 201510 yr New status. There was a typo in the mac-address on the app on my phone . I can now wakeup the virtual machine from my phone with the app but not from the SHIELD TV. tcpdump -i br0 udp port 9 (Wake On Lan app) 19:20:30.361997 IP 10.10.10.152.53474 > 10.10.10.255.9: UDP, length 102 19:20:30.362026 IP 10.10.10.152.55554 > 10.10.10.255.9: UDP, length 102 19:20:30.362106 IP 10.10.10.152.58293 > 10.10.10.255.9: UDP, length 102 tcpdump -i br0 udp port 9 (SHIELD TV) 19:21:28.369284 IP 10.10.10.178.53735 > 10.10.10.255.9: UDP, length 192 19:21:28.369330 IP 10.10.10.178.53735 > 255.255.255.255.9: UDP, length 192 19:21:28.569890 IP 10.10.10.178.53735 > 10.10.10.255.9: UDP, length 192 19:21:28.569908 IP 10.10.10.178.53735 > 255.255.255.255.9: UDP, length 192 19:21:28.770436 IP 10.10.10.178.53735 > 10.10.10.255.9: UDP, length 192 19:21:28.770467 IP 10.10.10.178.53735 > 255.255.255.255.9: UDP, length 192 19:21:43.468351 IP 10.10.10.178.47381 > 10.10.10.255.9: UDP, length 192 19:21:43.468493 IP 10.10.10.178.47381 > 255.255.255.255.9: UDP, length 192 19:21:43.669343 IP 10.10.10.178.47381 > 10.10.10.255.9: UDP, length 192 19:21:43.669478 IP 10.10.10.178.47381 > 255.255.255.255.9: UDP, length 192 19:21:43.870465 IP 10.10.10.178.47381 > 10.10.10.255.9: UDP, length 192 19:21:43.870480 IP 10.10.10.178.47381 > 255.255.255.255.9: UDP, length 192 tcpdump -i br0 ether proto 0x0842 -no output- Only different packet length (102 for the app and 192 for the SHIELD) for the magic packet. Maybe the shield is sending more information in the magic packet than needed which cant be parsed from libvirtwol. I increased the snaplength in tcpdump and loaded it into wireshark: Phone APP (wakeup works): Frame 1: 144 bytes on wire (1152 bits), 144 bytes captured (1152 bits) Ethernet II, Src: LgElectr_16:b5:0e (8c:3a:e3:16:b5:0e), Dst: Broadcast (ff:ff:ff:ff:ff:ff) Internet Protocol Version 4, Src: 10.10.10.152, Dst: 10.10.10.255 User Datagram Protocol, Src Port: 50467 (50467), Dst Port: 9 (9) Wake On LAN, MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) Sync stream: ffffffffffff MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) SHIELD (wakeup doesn't work): Frame 1: 234 bytes on wire (1872 bits), 234 bytes captured (1872 bits) Ethernet II, Src: Nvidia_54:24:52 (00:04:4b:54:24:52), Dst: Broadcast (ff:ff:ff:ff:ff:ff) Internet Protocol Version 4, Src: 10.10.10.178, Dst: 10.10.10.255 User Datagram Protocol, Src Port: 35927 (35927), Dst Port: 9 (9) Wake On LAN, MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09), password: 00:00:00:00:00:00 Sync stream: ffffffffffff MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) MAC: RealtekU_e6:3b:09 (52:54:00:e6:3b:09) Password: 00:00:00:00:00:00 What is "Password: 00:00:00:00:00:00" in tha magic packet from the SHIELD (at the end of the wireshark output)? Can we cut it out from libvirtwol or ignore it? Thx for your time and effort.
December 1, 201510 yr Author Libvirtwol.py mac address section relies on packet size to parse the packet for 16 repetitions of a mac address. For you it doesn't work because of the extra packet size. I was able to reproduce your problem by using etherwake -p 00:00:00:00:00:00 -i br0 macaddress. I'll look at the libvirtwol.py script again and see if I can tweak it.
December 2, 201510 yr Author I updated the script. Let me know if it works. After you update the plugin. You'll have to stop then start the daemon.
December 5, 201510 yr thanks for great plugin, but mostly for KVM virtu idle/sleep dont work proper, like for Openelec ;( i was talked about this with @jonpanozzo and @@eschultz - this is last thing what about dreaming: "wakup virtu like Openelec from Remote and autosleep after some idle time" Let me know if you tested with Openelec - if this will work maybe will be possibility write script with looking on USB activity (some remote)\ and when find it, then call to script wake on lan to resume virtu ... Or maybe somebody will have better idea how this resolve ....
December 6, 201510 yr Author thanks for great plugin, but mostly for KVM virtu idle/sleep dont work proper, like for Openelec ;( i was talked about this with @jonpanozzo and @@eschultz - this is last thing what about dreaming: "wakup virtu like Openelec from Remote and autosleep after some idle time" Let me know if you tested with Openelec - if this will work maybe will be possibility write script with looking on USB activity (some remote)\ and when find it, then call to script wake on lan to resume virtu ... Or maybe somebody will have better idea how this resolve .... I wish I could test with Openelec but my system only supports vt-x. Probably a script involving udev might work. I personally use Nevo Q50 zwave remotes to wake Openelec boxes through a Micasaverde Vera. I send a zwave scene command to Vera which then sends the wake on lan packet to my Openelec boxes.
January 5, 201610 yr Author This is indeed very awesome! Could you perchance implement resumption of paused VMs via magic packet as well? Sometimes my VM gets paused and I have to use the webui to resume it.. I'll see what I can do but when I was writing the VM Manager that unRAID uses now which is based on libvirt php it was hard to determined the a pm suspend paused state and resume which is different than a regular paused state. Now this is based on libvirt python and there are some more options available but some quick tests I tried didn't work. I would suggest you either turn off power management in the vm or change it to hibernate instead which would power off the vm and allow it to be woken.
April 12, 201610 yr Author I updated the plugin about a month ago to work with 6.2. I just tried and was able to wake a ubuntu and windows vm from my asus router and my wakeonlan plugin. 6.2 needs python 2.7.11. Do you have any other python plugins or nerd pack that may install python 2.7.9?
April 13, 201610 yr Author It's possible if your were not on the latest version or upgraded after updating to 6.2 you have the wrong version of libpcap installed. 6.1 needs 1.4.0 and 6.2 has 1.7.4 included so the plugin doesn't install libpcap for 6.2. But if you have the latest and have rebooted since you should be fine. For further testing you can stop the service from the vm manager settings page then go to the command line. Run this command where br0 is your bridge name. Then try sending a wake on lan. Try from different apps if you can. I have a plugin for wol too or try from your router. The script will show if there's an error. python /usr/local/emhttp/plugins/libvirtwol/scripts/libvirtwol.py br0 Also the pcap interface is set to promiscuous mode so all packets are captured. So you don't need to point wol to your server ip.
April 13, 201610 yr Author I'm on my phone through vpn but the wake on lan app by mike webb didn't work when it used to also. It maybe because of the vpn. So in the app, I changed the wake on lan settings for my ubuntu vm from x.x.x.255 broadcast to x.x.x.1 which is my server and it worked. But you said you had tried that. I noticed to that the default in domain.cfg is vibr0. Maybe double check your vm is still br0. Also I don't have spanning tree protocol on. Don't know if that matters. The interface should be listening on the bridge but you could try the script with eth0 instead of br0. See if it works and see if what did work still works also. I will try some more tests when I'm at home. Maybe there are some changes between the different versions of libpcap or libvirt.
April 14, 201610 yr Author That sucks. I haven't had a chance to test anything yet. Let me know what you try again. I would try other apps and point it to your unRAID ip also.
April 16, 201610 yr Author I ran some tests starting up a Ubuntu and Windows 7 VM using the WOL android app, my wol plugin and Asus router. I tried both ip of the unRAID server and broadcast on the same network. All worked as expected and tke VM's started up each time.
April 16, 201610 yr Author So I have stopped using the openelec builds and Wol started working again... seems this had nothing to do with your plugin after all. My tvheadend now works inside a vm, so no need for those custom builds anymore What's your setup? I have a Mythbuntu VM with 2 cable card network tuners. And run NUC's with Openelec at all the TV's.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.