OPNsense Forum

English Forums => General Discussion => Topic started by: lewoke on June 06, 2019, 08:22:18 pm

Title: Question: Is WOL on demand possible?
Post by: lewoke on June 06, 2019, 08:22:18 pm
Hi,

I'd like to do the following: Opnsense sends a WOL everytime  a client from LAN (own subnet) is requesting access to my home server on OPT1(own subnet).

I know there is the wol plugin but to my knowledge it only allows you to either wake up clients manually or via cron. Any ideas?

Title: Re: Question: Is WOL on demand possible?
Post by: fabian on June 07, 2019, 06:31:19 pm
your server can call the same API the frontend is using to send the packet.
Title: Re: Question: Is WOL on demand possible?
Post by: qinohe on June 07, 2019, 08:40:05 pm
@fabian, I'm curious how to do that are there examples anywhere?

@OP, you could use a script, untested, should work though, at least I think so  :P
Code: [Select]
#!/bin/sh

MAC='00:11:22:33:44:55'
IP='192.168.10.100'
ARP=$(arp "$IP"|awk '{print $4 $5}')

[ "$ARP" = noentry ] && wol -i "$IP" "$MAC" || exit
exit 0

edit: @fabian, NVM I found the examples in the wiki, I now need to figure out how to use them  :D