Hi, I am trying to make a monitoring script and it's out of my scripting knowledge. The goal is to turn something on or off when the RouterBOARD sees an ECHO request packet from any IP on my network (I know that MK has netwatch but that won't help me because I need something different).
I will give you an example: I will ping from my PC 10.1.1.1. The script will detect that I pinged that IP from my computer and will do something. I have already done something that works but it's not ideal.
I am using this firewall raw rule: action=add-src-to-address-list address-list=Test address-list-timeout=1s chain=prerouting comment=Ether5-ON dst-address=10.1.1.1 icmp-options=8:0-255 protocol=icmp. Basically, it's adding that IP (10.1.1.1) to the IP list. Then after that, I wrote a script that monitors that specific IP list and if it sees IP in it it will do something.
Script:
:do {
:local ip [[len [ip firewall address-list find list="Ether5-OFF"]]];
if ($ip>0) do={
:log info message="Ether5-OFF";
/ip firewall filter enable 2;
/beep;}
delay 4s
} while=(true)
Yeah, it works but it's not ideal because if someone sends more than one packet it will clog the router and the log is full of the same messages. The router is RB2011 with 6.48.6 (I had some problems with V7 on that). Because of that, I would like to bin that FW rule with an IP list and implement everything into one script.
And now the part that I need help with. I have no idea how to watch for that ping from the script. I had the idea to use a torch but don't know how to implement it into the script.