7.12.1 NAT Rule script bug

Hi,
My Mikrotik version is 7.12
I want to delete all NAT rule that target to port n
for example I have 2 NAT rule like:
Code: Select all

/ip/firewall/nat/add action=dst-nat chain=dstnat dst-port=2005 protocol=tcp in-interface=pppoe-mgr1 to-ports=1001
/ip/firewall/nat/add action=dst-nat chain=dstnat dst-port=2006 protocol=tcp in-interface=pppoe-mgr1 to-ports=1001

I want to delete all rule that target to port 1001 like this but it’s not work:

/ip/firewall/nat/remove [/ip/firewall/nat find to-ports=1001]

work:

/ip/firewall/nat/remove [/ip/firewall/nat find action=dst-nat]

work:

/ip/firewall/nat/remove [/ip/firewall/nat find comment=1001]

Seem like “to-ports” parameter in find function is useless

You are missing quotes.

Try this:

/ip/firewall/nat/remove [/ip/firewall/nat find to-ports="1001"]
/ip firewall nat remove [find where to-ports="1001"]