I’m trying to find a way to do the following:
For example, I have dnat rule
[admin@MikroTik] > ip firewall nat print
Flags: X - disabled, I - invalid, D - dynamic
0 chain=dstnat action=dst-nat to-addresses=172.17.2.1 to-ports=2404 protocol=tcp src-address=10.0.0.5 dst-address=10.0.0.1 dst-port=2404
I need a way to modify this rule and remove src-address and/or dst-address from it. Not replace it with something else, just remove.
When I use API call /ip/firewall/nat/set not specifying the addresses it just edits parts that I did specify, leaving src-address and dat-address intact.
What is the right way to do what I want?
What’s printed out, and what you modify seem to be the same things, so the fact they’re not modified seems like the right thing to have happened. When you use “set”, properties that are not modified stay the same, and in your case, all other properties are the same anyways.
As for that last error message… src-address and dst-address must be an IP range (e.g. 10.0.0.1/32). They can’t be an empty value.
If you want to unset them, you need to use the “unset” command, e.g.
That’s exactly what I needed, thanks! Somehow I missed the unset command
One more thing. In your example you used “=numbers=*8” parameter. I use “=.id=*8”
Is it the same, or there are some differences?