Community discussions

MikroTik App
 
sanjeev
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 87
Joined: Mon Oct 06, 2008 7:45 am

Disable Filter rules at one shot from Terminal

Sun Oct 12, 2008 9:27 am

hi all
i have firewall filter rules from 1 to 100 and i want to disable the rules and enable the rules during testing phase
this method doesn't works
[admin@MikroTik] ip firewall filter> disable 0-120
invalid item number
[admin@MikroTik] ip firewall filter> disable (0-120)
item number too large
this method works but disables 0 and 120 rules only not from 1 to 120
[admin@MikroTik] ip firewall filter> disable 0,120
[admin@MikroTik] ip firewall filter>
however this works but its tedious you have to specify 0 to 100 using commas
[admin@MikroTik] ip firewall filter> disable 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,
15,16,17,18,19,21,22,23,24,25,26.....99,100
so my question here is what's the syntax to disable rule from 1 to 100 at one shot
Thankyou
 
User avatar
omega-00
Forum Guru
Forum Guru
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

Re: Disable Filter rules at one shot from Terminal

Sun Oct 12, 2008 3:38 pm

:for x from 1 to 100 do={/ip firewall filter set $x disabled=yes}
That should help you ;-)
 
sanjeev
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 87
Joined: Mon Oct 06, 2008 7:45 am

Re: Disable Filter rules at one shot from Terminal

Tue Oct 14, 2008 11:42 am

Thanks..
that really helped me..
but i think that was a programming syantax
not a command
thanks any way
 
User avatar
omega-00
Forum Guru
Forum Guru
Posts: 1167
Joined: Sat Jun 06, 2009 4:54 am
Location: Australia
Contact:

Re: Disable Filter rules at one shot from Terminal

Tue Oct 14, 2008 12:15 pm

that is a command you can paste directly into a terminal window (tested on 3.14)
 
d2285
just joined
Posts: 1
Joined: Mon Dec 12, 2016 2:47 pm

Re: Disable Filter rules at one shot from Terminal

Mon Dec 12, 2016 2:49 pm

How to remove with it?
 
JB172
Member
Member
Posts: 304
Joined: Fri Jul 24, 2015 3:12 pm
Location: AWMN

Re: Disable Filter rules at one shot from Terminal

Mon Dec 12, 2016 5:38 pm

How to remove with it?
:for x from 1 to 100 do={/ip firewall filter remove $x}
 
total13
newbie
Posts: 34
Joined: Fri Jul 08, 2016 2:29 pm

Re: Disable Filter rules at one shot from Terminal

Tue Dec 20, 2016 6:38 pm

Hello!
I am having issues with this command:
:for x from 1 to 100 do={/ip firewall filter remove $x}
I sometimes get response:
no such item (4)

And sometimes it just deletes rules as it should. Any ideas why is this happening?
 
Rhobro
just joined
Posts: 5
Joined: Thu Dec 22, 2016 10:18 am

Re: Disable Filter rules at one shot from Terminal

Thu Dec 22, 2016 10:21 am

The loop goes from Item 1 to Item 100.

If you deleted some of those items in between or you simply dont have 100, it throws a warning
 
total13
newbie
Posts: 34
Joined: Fri Jul 08, 2016 2:29 pm

Re: Disable Filter rules at one shot from Terminal

Tue Jan 24, 2017 6:28 pm

Hmm, sometimes it worked fine and sometimes not, although I admit it was bit "crude" tool, so I found better:
/ip firewall filter remove [/ip firewall filter find]

Who is online

Users browsing this forum: AndreKR, mkx, PLJ020, qatar2022, Tony93 and 114 guests