quinta-feira, 14 de dezembro de 2017

Mikrotik - Change firewall rule order by script or cli

Managing Mikrotik firewall through CLI/SSH interface

Change firewall rule order

One of the bad things in Mikrotik firewall is that when you add new rule, it’s automatically applied at the end of the chain, which in most of the times has NO EFFECT. So you need to fine-tune your rule position in order to make it work as supposedd
First print the current rules
/ip firewall filter print without-paging
Now change the order, for example make rule number 18 to be number 1:
/ip firewall filter move 18 1


- comments by forum
After some VERY frustrating experiences with this task i stumbled upon this:
https://gryzli.info/2015/01/18/mikrotik ... ll-by-cli/

You MUST do /ip firewall filter print before actually moving the rule. Useless to say it's annoying when running batches with dsh or putty.
So you rsc would be:
/ip firewall filter print
/ip firewall filter move [find where comment ="blabla"] destination=32

Or in a single line: '/ip firewall filter print; /ip firewall filter move [find where comment ="blabla"] destination=32'


   


0 comentários: