How to wake a host-PC if a WOL packet is sent to its guest?

Hi everyone, long time lurker first time poster here. :slight_smile:
I am desperately trying to solve the following problem: I have an application that sends WOL packets to a guest of my "Server"-PC via a (KVM) network bridge, so the guest has its own IP and MAC address. I am trying to save power so I want to hybernate the host. Obviously the application that sends the WOL packet has no idea it has to wake the host first and I have no way of changing that.

My current approach is, to make my raspberry pi on the network listen for WOL packets to the guest and automatically send a WOL packet to the host. I have found out, that I can identify the right packets with tshark:
tshark -i eth0 -Y 'wol and Frame contains ma:c0:ad:dr:es:s0'
The question is, how can I send a new WOL packet when tshark finds something?
On the other hand I just might have missed the obvious solution and went down the wrong rabbit hole. :wink:

TL;DR 0: How to run a script when tshark finds something?
TL;DR 1: How to wake a host with WOL packet to guest?

This is an openwrt script you can probably repurpose for your setup to wake the host from your raspberry pi.

https://wiki.openwrt.org/doc/howto/auto_wake_on_lan

1 Like

Thanks :slight_smile: I will test that shortly