Community discussions

MikroTik App
 
User avatar
dwright
Member Candidate
Member Candidate
Topic Author
Posts: 158
Joined: Fri May 28, 2004 1:10 pm
Location: Mchenry, Il

flushing firewall rules

Wed Aug 17, 2005 8:41 pm

Is there a way to flush the firewall rules using a script?

I noticed that if I make big changes to the firewall script from the export option and then re-import it, All the rules get added, so now each chain has double the rules.

If there was to add a command to the top of the script to remove all the rules, so when importing they wouldn't double up that would be great.

Anyone know how I might go about doing this. This is on 2.9

Thanks,

D~
 
User avatar
dwright
Member Candidate
Member Candidate
Topic Author
Posts: 158
Joined: Fri May 28, 2004 1:10 pm
Location: Mchenry, Il

Wed Aug 17, 2005 8:50 pm

A work around I see would be to add into the script
/ip firewall filter

print input

remove $rule numbers go here.
That seems crude, is there a way to say remove all in input chain with out having to print, and then designate each rule?

D~
 
cmit
Forum Guru
Forum Guru
Posts: 1547
Joined: Fri May 28, 2004 12:49 pm
Location: Germany

Wed Aug 17, 2005 9:53 pm

Something along the lines of
/ip firewall filter remove [/ip firewall filter find chain=input]
Just quickly typed from memory - please test first before blaming me for the loss of all your rules in other chains ;)
 
User avatar
dwright
Member Candidate
Member Candidate
Topic Author
Posts: 158
Joined: Fri May 28, 2004 1:10 pm
Location: Mchenry, Il

Wed Aug 17, 2005 10:30 pm

Cmit,

That did the trick. I don't understand why this wouldn't work.
/ip firewall filter remove chain=input
Anyway, this works just as well. Thanks for the help.

D~
 
cmit
Forum Guru
Forum Guru
Posts: 1547
Joined: Fri May 28, 2004 12:49 pm
Location: Germany

Wed Aug 17, 2005 10:37 pm

If you find some spare minutes, read the scripting section from the manual thoroughly.
The scripting features in RouterOS can save you tons of work often... ;)
 
User avatar
dwright
Member Candidate
Member Candidate
Topic Author
Posts: 158
Joined: Fri May 28, 2004 1:10 pm
Location: Mchenry, Il

Wed Aug 17, 2005 11:13 pm

Ya I haven't had the chance yet, but this is definately the next thing I am diving into. I am starting to realize the power of scripts!!!!!!!
 
thenoob
just joined
Posts: 22
Joined: Wed Mar 27, 2013 2:23 am

Re: flushing firewall rules

Thu Apr 11, 2013 1:48 am

this should aready be implemented in the os : it already exists in iptables ie : routeros sucks. /rant

Who is online

Users browsing this forum: No registered users and 4 guests