Community discussions

MikroTik App
 
User avatar
CZFan
Forum Guru
Forum Guru
Topic Author
Posts: 2098
Joined: Sun Oct 09, 2016 8:25 pm
Location: South Africa, Krugersdorp (Home town of Brad Binder)
Contact:

Remove src-address via script...

Mon Aug 26, 2019 11:03 pm

I have client devices that have their LAN address range as src-address, want to run a script that will remove / disable the src-address field and set the out interface as WAN interface list.

I tired the following, but it tells me it needs an address range, which sounds logical, but how do I then remove / disable this field? I am sure I read something about it couple of days ago, but cant find it.
/ip firewall nat set [find where action="masquerade"] src-address="" out-interface-list=WAN
 
User avatar
sebastia
Forum Guru
Forum Guru
Posts: 1782
Joined: Tue Oct 12, 2010 3:23 am
Location: Antwerp, BE

Re: Remove src-address via script...  [SOLVED]

Tue Aug 27, 2019 1:36 am

/ip firewall nat set [find where action="masquerade"] !src-address out-interface-list=WAN
 
User avatar
SiB
Forum Guru
Forum Guru
Posts: 1888
Joined: Sun Jan 06, 2013 11:19 pm
Location: Poland

Re: Remove src-address via script...

Tue Aug 27, 2019 1:52 am

You should write "I have some SNAT for few separated LAN and must change it fast way"...
I must go to MikroTik firewall to check what is your real problem.

This is very easy to resolv itself. Just pressing TAB few times and do negative with !parameter. Remember that differ stuff is parameter!=value then !parameter.
Your code who change ALL masq to disable, without src-address and you should have at least ONE main SNAT rule to your ISP.
/ip firewall nat set [find action=masquerade] !src-address out-interface-list=WAN disabled=yes

Who is online

Users browsing this forum: No registered users and 28 guests