Community discussions

MikroTik App
 
anh7codon
just joined
Topic Author
Posts: 13
Joined: Thu Jun 29, 2023 7:12 am

7.12.1 NAT Rule script bug

Mon Dec 18, 2023 4:12 am

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
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3307
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: 7.12.1 NAT Rule script bug

Sat Jan 06, 2024 8:07 pm

You are missing quotes.

Try this:
/ip/firewall/nat/remove [/ip/firewall/nat find to-ports="1001"]
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12032
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: 7.12.1 NAT Rule script bug

Sun Jan 07, 2024 10:52 am

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

Who is online

Users browsing this forum: No registered users and 13 guests