Community discussions

MikroTik App

Search found 10 matches

by soheiliz
Sun Aug 23, 2020 11:39 am
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

apologies, left out the reference to the variable ($i) in the "do" statement, try below: { :foreach i in=[/ip firewall nat find where action="masquerade" && chain="srcnat" && !src-address-list && !dst-address-list] \ do={/ip firewall nat set $i ...
by soheiliz
Mon Aug 17, 2020 8:51 am
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

This should set src/dst address lists where both are none { :foreach i in=[ip firewall nat find where action="masquerade" && chain="srcnat" && !src-address-list && !dst-address-list] do={/ip firewall nat set src-address-list=AllowedSrc dst-address-list=Al...
by soheiliz
Sun Aug 16, 2020 10:32 am
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

I believe that's what you're looking for:
find !src-address-list !dst-address-list
Dear Chupaka

unfortunately, it doesn't work.

Bests Regards
by soheiliz
Mon Aug 10, 2020 3:47 pm
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

You know I have more than 500 Mikrotik routers that most of them haven't any comment in the NAT and some of them have just one NAT line and most of them have 3 or 4 NAT lines I have to run a script which does an action on the exact NAT line that I want. Is it possible to run any script which checks ...
by soheiliz
Mon Aug 10, 2020 3:37 pm
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

I mean that I want to edit just one NAT line and set AllowedSrc & AllowedDst but according to the script it doesn't do any action: { /ip firewall nat set [find action=masquerade chain=srcnat dst-address-list="" src-address-list=""] src-address-list="AllowedSrc" dst-...
by soheiliz
Mon Aug 10, 2020 3:24 pm
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

{ /ip firewall nat set [find action=masquerade chain=srcnat src-address-list!="" dst-address-list=""] src-address-list="AllowedSrc" set [find action=masquerade chain=dstnat dst-address-list!="" src-address-list=""] dst-address-list="AllowedDst&...
by soheiliz
Mon Aug 10, 2020 2:28 pm
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

{ /ip firewall nat [set [find masquerade chain=srcnat] src-address-list="AllowedSrc" dst-address-list="AllowedDst"] } My guess. Dear msatter, BINGO!!! That is a good solution and answered. Thanks a million for your idea. It helps me a lot. :) But the point is that it set src-add...
by soheiliz
Mon Aug 10, 2020 1:15 pm
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

Re: If else commands scripting.

Dear CZFan Many thanks for your response, Unfortunately, it didn't solve the issue. If I use below script I have to add number but I cant because I have many Mikrotik routers with several NAT I have to add src and dst address list by one script. :if [/ip firewall nat find action=masquerade chain=src...
by soheiliz
Mon Aug 10, 2020 10:19 am
Forum: Scripting
Topic: If else commands scripting.
Replies: 50
Views: 55018

If else commands scripting.

Dears, I am trying to use this script to check two-parameter but it just executes without any action. :foreach i in=[ip firewall nat find action=masquerade chain=srcnat src-address-list=no dst-address-list=no ] do={/ip firewall nat set src-address-list=AllowedSrc dst-address-list=AllowedDst} I'd lik...
by soheiliz
Sun May 31, 2020 10:41 am
Forum: Scripting
Topic: Howto disable/delete a route by parameters, not by number?
Replies: 9
Views: 21525

Remove useless route

Hi Dears I have a problem and I was thankful if someone helps me. I have several numbers of 951 routers as my clients and I want to remove some useless routes in them without any disconnection or remove other routes. The point is that some of these useless route's gateways were PPTP and L2TP which t...