I Have been playing around with getting WOL to work from the WAN side of my RT-N66U router (ASUSWRT firmware V3.0.0.4.376.2524). At first sight it appears to be straight forward:
1) Get WOL to work on your PC
2) Assign static IP address to the PC using its MAC address
3) Setup port 9 forward to the IP address
No sweat. It worked first time.... But only if the PC is woken within about 3 minutes of being turned off. After some research I found other reports of the same problem.
The cause is that the router has a timeout on its ARP table. After this timeout the router forgets which MAC address belong to the IP address. And since the PC is turned off, it cannot respond with its MAC address when queried. Annoying! The router doesn't really have to forget the MAC address. Because of the IP reservation it knows the MAC address.
I would expect that the problem could be solved by making port forwarding such the magic packet is broadcastet on the LAN. I.e. setting the local IP address to 192.168.1.255 (for a subnetmask of 255.255.255.0). However, this doesn't appear to be working.
Is it even possible to make a port forward in this way so incoming packets on a specific port are broadcastet?
After some more research I started Telnet'ing the router, and figured out that I could make a static ARP entry with:
arp -s <local IP> <MAC address>
... and presto! It worked. I was a happy man
Unfortunately the ARP entry is only semi-static, as it vanishes after a router reboot.
More research, and I found this:
http://forums.smallnetbuilder.com/showthread.php?t=7969
It describes a procedure for running a script from an USB stick. This could solve my problem, since I could make a script that would add the ARP entry on power-up.
Unix scripting is a bit out of my league. So, I'm wondering if anyone has some experience with this and can help with a quick guide?
Thank you!
1) Get WOL to work on your PC
2) Assign static IP address to the PC using its MAC address
3) Setup port 9 forward to the IP address
No sweat. It worked first time.... But only if the PC is woken within about 3 minutes of being turned off. After some research I found other reports of the same problem.
The cause is that the router has a timeout on its ARP table. After this timeout the router forgets which MAC address belong to the IP address. And since the PC is turned off, it cannot respond with its MAC address when queried. Annoying! The router doesn't really have to forget the MAC address. Because of the IP reservation it knows the MAC address.
I would expect that the problem could be solved by making port forwarding such the magic packet is broadcastet on the LAN. I.e. setting the local IP address to 192.168.1.255 (for a subnetmask of 255.255.255.0). However, this doesn't appear to be working.
Is it even possible to make a port forward in this way so incoming packets on a specific port are broadcastet?
After some more research I started Telnet'ing the router, and figured out that I could make a static ARP entry with:
arp -s <local IP> <MAC address>
... and presto! It worked. I was a happy man

Unfortunately the ARP entry is only semi-static, as it vanishes after a router reboot.
More research, and I found this:
http://forums.smallnetbuilder.com/showthread.php?t=7969
It describes a procedure for running a script from an USB stick. This could solve my problem, since I could make a script that would add the ARP entry on power-up.
Unix scripting is a bit out of my league. So, I'm wondering if anyone has some experience with this and can help with a quick guide?
Thank you!