I’m new to Mikrotik (not new to PHP) and I have a problem. I am trying to use https://github.com/pear2/Net_RouterOS (Utils)
to connect to Mikrotik and do CRUD on firewall rules. I’m stuck on edting a rule. I have the rule “.id” and I can retreive it from the device but I have
no idea how to edit the rule using that “.id”. Thank you!
.id are some temporary stuff in RouterOS and can not be used directly.
Eks I see with /ip firewall filter print that rule I need to edit is marked 4. This I can not use.
If I do use find like this (since I know the comment is drop): :put [/ip firewall filter find where comment~“drop”]
Same rule in number *12
So to disable that rule:
/ip firewall filter disable [/ip firewall filter find where comment~"drop"]
No number are used.
Can be shorten some:
/ip firewall filter disable [find where comment~"drop"]
So you need to find some unique for that rule, it can be IP, comment ++++
Id is just and internal value at the moment you search for some.
You need to find the filter rule by using where and then some field that make it unique.
Best way is to add an custom id to the comment field and then search for it.
Example add a comment to the rule with some like this “AZ43”, then the search would be:
/ip firewall filter disable [/ip firewall filter find where comment~"AZ43"]