Community discussions

MikroTik App

Search found 11 matches

by VictorS
Mon Jan 27, 2025 5:47 am
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

/ip/route/remove [find where (comment~"api\\.") and !(comment~"2025/01/24 14:30")] OK, the final script (quick and dirty but functional) would be # extract addresses in the list :local AddressList [/ip firewall address-list find comment~"api\\."]; :local ipAddress; :lo...
by VictorS
Mon Jan 27, 2025 4:43 am
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

You can check it easily: make a list based on any noncrucial DNS name and then set local static DNS name with different IP and set the low test TTL for that. Then watch how and when the address list reacts to changes to static entry or disabling it. I have created a DNS name with 3 A RRs and TTL=30...
by VictorS
Sat Jan 25, 2025 4:42 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

Seems that the TTL of the dynamic DNS based names is used to feed the list and when it expires the list is refreshed to the actual apiN.example.com
viewtopic.php?t=177324
This is good.
by VictorS
Sat Jan 25, 2025 4:07 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

The main question is where the "api*" list come from? It comes from /ip firewall address-list where DNS names like api.mycluster.example , api.mycluster2.example create several dynamic address lists with the api.mycluster.example or api.mycluster2.example in their comment. It happens auto...
by VictorS
Sat Jan 25, 2025 1:53 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

Tip no. 2: The list that you prepare should be timebased so when you add an entry to it then you should set timer for the entry for eg. 6 hours if you refresh that list every 6 hours. When you readd the entry during that period you just refresh/reset that timer, if not the entry just vanishes. No n...
by VictorS
Sat Jan 25, 2025 12:16 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

Tip no. 1: Use route marking. Make a mangle rule ... Oh no. In fact, I tried to solve my problem first with address-lists + PBR (policy based routing). There are many examples of PBR for Mikrotik in the internet, using the firewall and multiple routing tables. It worked but (!) TCP worked SO slowly...
by VictorS
Sat Jan 25, 2025 12:06 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

Basically, yes, but for be more "nice" on the point 2: on foreach cycle at the same time you UPDATE the comment if the rule already exist AND add new rules with :timestamp. This do not delete what already exist (and must be keeped) and do not (temporarly) duplicate rules. I agree that you...
by VictorS
Fri Jan 24, 2025 4:48 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

Why would I care to take into account what already exists when I can create a bunch of new routes with the current timestamp (even if they are duplicates of the older routes, it does not seem to cause any harm) and then delete everything with non-current timestamps? This looks much simpler, unless i...
by VictorS
Fri Jan 24, 2025 4:18 pm
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Re: Garbage collect old routes and duplicate routes

Basically, this boils down to 1. At the start of the script, generate some unique string (e.g. :timestamp ) 2. Add this string to the comments of all the routes generated within this iteration of the script 3. At the end of the script, delete all the routes which do not contain this unique string Do...
by VictorS
Fri Jan 24, 2025 9:57 am
Forum: Scripting
Topic: Garbage collect old routes and duplicate routes
Replies: 21
Views: 1381

Garbage collect old routes and duplicate routes

Dear Colleagues, I have written a script to add host routes to the IPv4 routing table, please see the complete script below. The problem however is that on each invocation, the script creates duplicate entries in the routing table, and of course it does not delete old entries (which it created when ...
by VictorS
Sun Apr 14, 2024 4:46 pm
Forum: General
Topic: OVPN in UDP with linux OVPN server
Replies: 7
Views: 5007

Re: OVPN in UDP with linux OVPN server

I have this problem too, OpenVPN 2.6.3/Debian 12, RouterOS 7.13.4
Are there any ideas anyone?