flushing firewall rules

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~

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~

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 :wink:

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~

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… :wink:

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!!!

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