Wake on Lan over subnet

Hi !

After putting phones on a specific wifi ap, they are on a different ip range (and DNS, DHCP...)
As I use my phone to control Kodi, and I don't want it on all the time, I use the WOL feature on Kodi Remote (Google Play).
Thinking it wasn't going to work as they are on different subnet, I was surprised that it did, but for a short time.

It work actually for about 30s, until the ARP Flags for my Kodi laptop switch to 0x0:

  • Working:    0x1         0x2         xx:xx:xx:b9:7c:37     *        br-main
  • Not working:    0x1         0x0         xx:xx:xx:b9:7c:37     *        br-main

First of all, how can it works ? As it's a broadcast packet, it's not supposed to work, right ?

After investigating, I noticed that on Wireshark:

So it sends a packet to a specific destination, not on broadcast, but I still can't figure out why it works.

I still can WOL with a PC located on the same subnet, but not from my phone.

Not knowing how to keep the flag at 0x2 , I started reading the forum for similar issued, and I found a post where they suggest to install udp-broadcast-relay, but I haven't been able to find it in the repos...
They also suggest to add a rule like that:

ip neigh change lladdr ff:ff:ff:ff:ff:ff nud permanent dev br-lan

but it doesn't work either.

I found finally a website where they suggest to add something like this (I modified the interface/destination/gateway to match my case):

iptables -t mangle -A INPUT -i wlan1-1 -d -j TEE --gateway

and it works.
But I don't know what are the caveats with a rule like that (DHCP?). Is there another way ? Maybe with the /etc/ethers file ? Or a tips to have the flag always at 0x2 ?

Thank you !

maybe a more specific rule:

iptables -t mangle -A INPUT -i wlan1-1 -s -d -p udp --dport 9 -j TEE --gateway

After investigation, I found another way to achieve what I want by adding a static lease like this:

ip neighbor add lladdr xxx dev br-main nud permanent

That way, the arp cache looks like this:    0x1         0x6         xxxx     *        br-main

and I then can send a WOL coming from my phone. It's maybe more "elegant"...
Anyway, I think it was undoubtedly due to the state of the flags, going from 0x2 (complete) to 0x0 (incomplete), but I don't know if it's related to OpenWRT/Linux. Perhaps a bug...?

And I'm still looking for answers about how it works on different subnets :slight_smile:

1 Like