Hello. Pls help me with my problem
Did the simple script
:local commentName “Net”
:local i [/ip firewall mangle get value-name=disable number=[find comment=$commentName]];
:if (i=true) do={
/ip firewall mangle enable [/ip firewall mangle find comment=$commentName];
}
But it works only to enable
If i want to disable this rule change disable to enable and in last string enable to disable - but doesnt work
in what is the mistake?
mrz
August 3, 2015, 1:02pm
2
There is not command to disable rule in your script, that is the main reason
This script for disable rule - but doesnt work
:local commentName “Net”
:local i [/ip firewall mangle get value-name=enable number=[find comment=$commentName]];
:if (i=true) do={
/ip firewall mangle disable [/ip firewall mangle find comment=$commentName];
}
mrz
August 3, 2015, 1:22pm
4
Parameter “enable” does not exist.
List of valid parameters can be found here
http://wiki.mikrotik.com/wiki/Manual:IP/Firewall/Mangle#Properties
The property you’re looking for is “disabled”. Notice the “d” in the end.
You don’t need to do an “if” BTW, just use an appropriate “find” in the disable/enable command, i.e. to disable:
:local commentName "Net"
/ip firewall mangle disable [/ip firewall mangle find disabled=no && comment=$commentName];
or to enable
:local commentName "Net"
/ip firewall mangle enable [/ip firewall mangle find disabled=yes && comment=$commentName];