Community discussions

MikroTik App
 
ACJM
just joined
Topic Author
Posts: 7
Joined: Sun Oct 01, 2023 2:46 pm

Dynamic Address List - Help

Thu Oct 19, 2023 10:56 pm

Hi

I have a script setup which looks into dns cache and adds any address which relates to Netflix and puts it into the address list, I then have a routing mark which send the traffic down another route based on the address list and it works, however I do have an issue and need some help.

The script is:

/log info ("Starting Netflix script");
:foreach i in=[/ip dns cache all find where (name~"netflix")] do={
:local tmpAddress [/ip dns cache get $i name];

:if ( [/ip firewall address-list find where address=$tmpAddress] = "") do={
:local cacheName [/ip dns cache get $i name] ;
/log info ("added entry: $cacheName $tmpAddress");
/ip firewall address-list add address=$tmpAddress list=netflix-hosts;
}
}
/log info ("Ending Netflix script");


My issue is, the address list it creates are “dynamic” and it request DNS lookups every 3 seconds causing lots of DNS requests on my router, is there a command I can put into the script which changes the frequency/timeout?

I have this script duplicated for other websites which I need to send down other routes so my “dynamic” list is growing rapidly.

I’m using RouterOS 7.11.2

Thanks
 
optio
Forum Veteran
Forum Veteran
Posts: 948
Joined: Mon Dec 26, 2022 2:57 pm

Re: Dynamic Address List - Help

Fri Oct 20, 2023 12:37 am

ROS is resolving host in address list on interval set by TTL (Time To Live) in DNS record, if is short it will perform DNS requests often, if you have added many hosts even more often, each host is resolved in separated DNS request and each can have different TTL. You can't manually set resolving rate.

Who is online

Users browsing this forum: barku, mrshaba, neopike and 78 guests