WOL call on network activity (autoWOL)

Hey,

I have Wake on LAN working on my server reliably but now I want to take it a step further and and have OpenWRT router trigger a WOL (etherwake) request when the NAS is called.

There is actually a guide on how to do it:

And even an improvement on it https://gist.github.com/felixhummel/6334e04e00e565b6bae8#file-readme-md

However it does not seam to work because any time I run the script it only updates when the script was launched but when I run logread | grep "WOL_LOG.*DST=$target" it does not return anything.

Could it be because of migration from iptables to nftables? Also, routing all traffic over iptables looks... excessive... Is there a better way? Putting it in a separate vlan?

Log file seems to be in
LOGFILE="/www/wol/index.html"
as per the script. Probably intended to be queried through the webinterface...

You say "when the Nas is called". Do you mean when the Nas is turned on?

Yup log file is there I can access it and the script writes to it the last time it was launched.
No script is not intoned to be queried by web interface. As described in he script wiki:

script for wake up a host by request

You make a request to a host host it gets waken by a router sending an eatherwake

Nope when the NAS is called if you look at the script it has a target aka the NAS it monitors for calls addressed to THAT host and follows them up with a ping and if the ping does not come back sends a wake request.

I see now

Looks like nft has logging too

https://wiki.nftables.org/wiki-nftables/index.php/Logging_traffic

Perhaps a rule like

nft add rule filter forward ip daddr 192.168.0.1 limit rate 1/minute log level debug prefix \"WOL_LOG:   \" group 0 accept

i think this approach used to work with iptables and now with nftables it seems to me it is no longer works. at least i could not find a working solution.

the sysctl control has no affect. but can create a bridge family rule to capture traffic to certain destination ip. but the idea here, to log such traffic and capture these events via syslog, seems to be broken as in bridge family the log facility does not work out of box. am not sure if this would require kernel config or what extra kmod, as installing all kmod-nf*log does not help. not sure what i'm missing?

$ nft add table bridge filter
$ nft add chain bridge filter forward '{ type filter hook forward priority 0; policy accept; }'
$ nft add rule bridge filter forward 'ip daddr 10.0.0.100 counter'
$ nft add rule bridge filter forward 'ip daddr 10.0.0.101 counter log prefix "WOL"'
Error: Could not process rule: No such file or directory
add rule bridge filter forward ip daddr 10.0.0.101 counter log prefix "WOL"

$ nft list table bridge filter
table bridge filter {
        chain forward {
                type filter hook forward priority 0; policy accept;
                ip daddr 10.0.0.100 counter packets 0 bytes 0
        }
}

I have the same issue (running on a very recent master). Adding a rule with a log statement does not work:

nft create table bridge filter
nft 'add chain bridge filter forward { type filter hook forward priority filter; policy accept; }'
nft add rule bridge filter forward log

Error: Could not process rule: No such file or directory
add rule bridge filter forward log

I did not see any difference in regards to loaded nft modules when compared to my workstations Linux, where adding this rule works. Does anybody know how to make this work?

1 Like