WOL + VLAN + Brodcast the magic packet

Hello I'm using OpenWrt 22.03.5, and I try to remotely turn on my home server. I am not an experienced user of OpenWrt.
I'm using VLAN in my network: My Android phone is in br-lan.1 (192.168.1.0) and my server is in br-lan.2 (192.168.2.0).

My server is configured for listening for Magic Packet, I have also installed luci-app-wol, and now I CAN wake my server from LuCI (and probably from ssh using etherwake - I didn't try it, because both are not a solution for me).

My question is: how to wake my server using very convenient applications for Android (standard broadcast UDP Magic Packet)?

I don't why, but now it's not work for me, I don't know why, but I read that this is a problem to broadcast the Magic Packet to other interface (I'm not sure about this because I can see that when I try to wake, the LED in my router is blinking, so probably something is happening).

Any advice? What to check?

Because they are on different VLANs, they are in different ethernet broadcast domains. WOL is based on broadcast low level ethernet packets (below even IP traffic). As such it won't traverse a router, only basic layer 2 bridges and switches. VLANs prevent this.

This is how ethernet broadcasts work, it is fundamental to the network protocols. The only fix (other than using WOL from another device on that VLAN, like the router) is to move the devices to the same vlan.

2 Likes

Thank you for your answer.

There is no solution to routing/forwarding that traffic to other/all VLANs?

Not really. If you search the web, you can find concepts like "IP directed broadcast", "WoL Proxy", "WoL gateway", but they are mostly used by specific vendors.

However, if your idea is to wake up the server with a single tap on your phone's display, there is a possible workaround using a shell script and the luci-app-commands package.

I wake up my office computer from home (over a wireguard tunnel) this way.

If you are interested (and your security policy is not too tight), I could share my approach.

Yes, exactly, this is the solution I am looking for.

I will be really very grateful for your help. Thank you.

root@MikroTik:~# cat /root/wol.scr
#!/bin/sh

IP=192.168.92.85
MAC=B0:5A:DA:3D:79:61
ifname=br-lan.10
timeout=3

while true; do
 if ping -c 3 -W 1 $IP >/dev/null; then
  break
 else
  etherwake -i $ifname $MAC
 fi
sleep $timeout
done
exit 0

Set the correct interface and IP address. This script sends magic packets until the device responds to ping. Modify it if it doesn't suit you.

After installing luci-app-commands, create a new custom command, specifying the absolute path to the script and allowing the public access.

Get the execution link from the Dashboard and enter it into your phone's Chrome browser.

Create a shortcut using the Add to Home screen option. If everithing is OK, you should see a Command executed successfully message.

If your phone is connected to a guest network, you need to create a traffic rule allowing the phone to access the router's web interface. If this is the case, MAC randomization should be disabled and you should set a static lease (unless the rule is set by MAC).

1 Like

Oh my God, Pavel, you are genius!
This tool offers so many possibilities...

Thank you so much!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.