Block a PORT for 1 Minute per 10 Minute !

Hey Friends :wink:
i Wanna Block a Port for 1 Minute for each 10 Minute …
Mean : users can Use That Port 9 Minute if 10 Minute … Blocking 1min of 10 Min.

for Adding That Should Add a Thousands of Filter rule time with Specified of time :open_mouth:
Rule 1 , Block Port time=00:01-00:02
Rule 2 , Block Port time=00:11-00:12
Rule 3 , Block Port time=00:21-00:22
Rule 4 , Block Port time=00:31-00:32
Rule N …

How Can i work it with an a Easy Way , Like a Script Run a 1 Rule for 1 min of 10 min .

Thanks :wink:

Write a script that will enable a filter rule that will enable a firewall rule that will drop connection for that port, put in a delay of 60 and disable the rule with the next line. Run the script every 10 minutes.

i don’t Know about scripting on MikroTik :confused:
Can You Write a Example ?
Thanks :wink:

http://wiki.mikrotik.com/wiki/Scripting
http://wiki.mikrotik.com/wiki/Manual:System/Scheduler

This is my Filter Rule :

chain=forward action=drop protocol=tcp src-address=192.168.85.0/24 dst-port=21 comment=block

what Scheduler i must be add , for 1 minute of every 10 minute ? can write This example with above filter rule ?

Thanks :wink:

Now in scheduler use combination of INTERVAL and DELAY :slight_smile:

/ip firewall filter enable [find comment="block"]
:delay 60
/ip firewall filter disable [find comment="block"]

Set up a scheduler to run this every 10 minutes. It will look in the firewall filter for any rules with the comment of “block” and enable them. It will then wait 60 seconds and run the final command of disabling anything with the comment of “block”

Here is My Scheduler :

[admin@MyRouter] /system scheduler> print
Flags: X - disabled 
 #   NAME           START-DATE  START-TIME         INTERVAL             ON-EVENT         RUN-COUNT 
 0   run10min       jan/01/1970 21:48:34           33s                  test22           7

& This The Script :

[admin@My Router] /system scheduler> /system scri print
Flags: I - invalid 
 0   name="test22" owner="admin" 
     policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive 
     last-started=feb/25/2011 21:54:02 run-count=5 
     source=
       /ip firewall filter enable [find comment="block"]
       :delay 10
       /ip firewall filter disable [find comment="block"]

but The Scheduler don’t Run The Script , Scheduler Run in That Interval Times , but Don’t Run The Script
~Thats Run Count on The Script Section is Manual Run by me .

What i Do Now ? :confused:

anyone know , what i do for Working it ?
where is The Problem ?

Here is My Scheduler :

[admin@MyRouter] /system scheduler> print
Flags: X - disabled 
 #   NAME           START-DATE  START-TIME         INTERVAL             ON-EVENT         RUN-COUNT 
 0   run10min       jan/01/1970 21:48:34           33s                  test22           7

& This The Script :

[admin@My Router] /system scheduler> /system scri print
Flags: I - invalid 
 0   name="test22" owner="admin" 
     policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive 
     last-started=feb/25/2011 21:54:02 run-count=5 
     source=
       /ip firewall filter enable [find comment="block"]
       :delay 10
       /ip firewall filter disable [find comment="block"]

but The Scheduler don’t Run The Script , Scheduler Run in That Interval Times , but Don’t Run The Script
~Thats Run Count on The Script Section is Manual Run by me .

What i Do Now ? :confused:
Where is Problem ??

You do have your filter rule with comment “block”, don’t you?

What permissions do you have assigned to the scheduler? Without the proper permissions it cannot run the script.

Yes i Have an Filter Rule with That Comment ,

For Premission , i not Checked Any CheckBox of Premission on Scheduler !
i must be Check ?

EDIT :

Thanks :wink:
The Problem is for i Not Checked :smiley: