I'm trying to route an UDP packet, from WAN port 9, to be broadcast over the whole LAN (same port).
In other terms, trying to wake-up my Linux workstation from Internet, using the famous UDP "magic packet" that embeds the MAC address of the PC to be woken-up.
Remote Server ➜ Internet ➜ LEDE ➜ LAN ➜ target PC
Remote server does wakeonlan -i LEDE-WAN-IP PC-MAC-ADDRESS
This command statically sets the ARP address for an IP. (Replace 00:de:ad:be:ef:00 with your hosts's ethernet MAC address.)
ip neigh add 192.168.1.69 lladdr 00:de:ad:be:ef:00 nud permanent dev br-lan
I added the above 'ip neigh add' command line to my router's /etc/rc.local file.
If the 'ip' command is not installed, you should be able to install it with 'opkg update; opkg install ip'.
BTW I think the IP address can be a dummy IP not used in your DHCP range (or by any host using a static IP). The MAC just have to be known by the router.
OK...I think you misunderstand the Magic Packet...
This will never work, as the Magic Packet is a Broadcast Packet, not a Unicast Packet.
This definitely won't work, as the packet would have a destination MAC of FF:FF:FF:FF:FF:FF (BROADCAST).
Lastly, since it's Broadcast, it's a crafted Layer 2 frame, not a real Layer 3 datagram...meaning, it cannot be forwarded over the Internet without advanced configurations (like an WOL Internet proxy).
If you are in fact using the Magic Packet technology, simply making a firewall rule will not work
Confirm what Wake-On-LAN technology you're actually using
This said "magic packet" is just an UDP packet that needs to reach its destination: the NIC of the powered-off PC.
To send an UDP packet to a LAN IP address (ie not broadcast to all NICs), LEDE needs to know the MAC address linked to that IP.
So it does an ARP query "Who has 10.1.1.10" and gets its MAC.
However the PC is down, so no answer will be provided. And this is the problem.
But, if LEDE knows that information (MAC linked to IP) even though the PC is down, it doesn't have to do the ARP query... LEDE just throws the UDP packet on the LAN directed to that MAC (indeed layer 2) and that's it, the PC is woken up...
And that removes the need to broadcast the packet on the LAN, which is the purpose of that thread!
(which @hammer understood, but I must admit after re-reading the top post that based on the original title, that's not obvious -- couldn't broadcast so tried this solution ; of course if broadcast is possible, I'll take that as well)
How does it work? FYI:
Having this exact configuration from first post (redirect)
Shutting down the target PC after doing some exchanges with LEDE (ensure ARP cache is fresh)
Within one minute (ARP cache expiration) do the wakeonlanfrom Internet (send magic packet) while the PC is down
and the PC 10.1.1.10 on the LAN wakes up! (just tried with LEDE)
So, to summarize
LEDE will wake up the PC if it knows to which MAC it has to send the packet
if /etc/ethers or @hammer's trick works, and teaches the MAC linked to that 10.1.1.10 IP to LEDE, it will work!
I worked out a little program which can trigger a Wake-on-LAN packet based on firewall rules. I created an OpenWrt package feed for it. It might be of interest to people passing by here: