Wake on Lan

Is it possible to wake on lan for a certain port forward access. i.e. I would like to wake my mac up when I VNC to it. How do I trigger a magic packet on port forward?

well, i think scripting is your only solution. you could create a script and schedule it to run every minute or so to check whether the counter of your dstnat rule went up or not and then send the wol command.

That’s what I thought as I can’t seem to find any settings to do so in Winbox.

Could you or someone be able to assist is such an example. Not too sure how to go about it.

Thank you.

:delay 30;
:local oldcount 0;
:local newcount;
:while (true) do={
  :set newcount [/ip firewall nat get [find comment="MY_VNC"] packets];
  :if ($oldcount != $newcount) do={
    /tool wol interface=ether2-local mac=00000000000;
    :set oldcount $newcount;
  }
  :delay 60;
}

create a schedule task for it and set it to run at startup. the script will stay in memory and will check for new packet counts every minute. also, set the comment for the dstnat rule you want it to apply to, to: MY_VNC . the script is not designed to handle more than one rule and will break if it finds two rules sharing that comment. adjust the wol command as required.

Thank mate works like a charm. If I have more than 1 port to wake up the computer, i guess i could create multiple scripts and run them as per your example and get the scheduler to run them otherwise i believe the code might get a bit more trickier.

Make a sticky out of this and considering adding it to the wiki