Community discussions

MUM Europe 2020
 
icebrew
just joined
Topic Author
Posts: 3
Joined: Fri Jun 08, 2012 12:03 pm

Wake on Lan

Sun Jun 10, 2012 2:49 pm

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?
 
Devil
Member Candidate
Member Candidate
Posts: 170
Joined: Thu Jul 21, 2011 9:13 am

Re: Wake on Lan

Tue Jun 12, 2012 12:04 pm

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.
Best Regards
 
icebrew
just joined
Topic Author
Posts: 3
Joined: Fri Jun 08, 2012 12:03 pm

Re: Wake on Lan

Wed Jun 13, 2012 4:53 am

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.
 
Devil
Member Candidate
Member Candidate
Posts: 170
Joined: Thu Jul 21, 2011 9:13 am

Re: Wake on Lan

Wed Jun 13, 2012 9:42 am

: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.
Best Regards
 
icebrew
just joined
Topic Author
Posts: 3
Joined: Fri Jun 08, 2012 12:03 pm

Re: Wake on Lan

Thu Jun 14, 2012 4:48 am

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.
 
rviteri
Frequent Visitor
Frequent Visitor
Posts: 84
Joined: Fri Nov 18, 2011 5:53 pm

Re: Wake on Lan

Thu Jun 14, 2012 4:58 am

: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.
Make a sticky out of this and considering adding it to the wiki

Who is online

Users browsing this forum: neury and 37 guests