Order of static DNS entries with subdomains

Hi all,

I have a static DNS record (A) for a domain that points to an IP address and applies to all subdomains.
However, I would like to exclude individual subdomains from this or create a different A record for them.
Although the rule for this is above the other, it does not seem to take effect.
Does “Match subdomains” always have priority?
Do I have to use a regular expression or an external DNS server, or have I overlooked something?

Example:

[admin@MikroTik] > /ip/dns/static/print proplist=name,type,match-subdomain,address where .id=*A or 
.id=*9 
Columns: NAME, TYPE, MATCH-SUBDOMAIN, ADDRESS
# NAME              TYPE  MATCH-SUBDOMAIN  ADDRESS
4 test.example.net  A                      4.3.2.1
5 example.net       A     yes              1.2.3.4
[admin@MikroTik] > :put [:resolve test.example.net]                                                
1.2.3.4

Kind regards

I have the same question. I have two A entries of subdomains that are higher order in the list of static DNS records. One of them takes precedence over the “match subdomain” wildcard entry and another doesn’t. What am I missing.

I think what you can try is keep the general match subdomains rule, but use regexes for the domains you want to be excluded from it. This approach relies on this documented behavior:

Regular expressions are checked first, then the plain records.

Hi @Kentzo,

Thank you for that hint, although it seems to be a workaround in my eyes and even with a regular expression there is still a strange behaviour in my tests (7.18.2).

Example:

/ip dns static add address=4.3.2.1 regexp="test\\.example\\.net" type=A
/ip dns static add address=1.2.3.4 match-subdomain=yes name=example.net type=A

When I disable the first rule, the result will be correct (

nslookup test.example.net.

shows 1.2.3.4).
But when I re-enable it, the result will be false (still 1.2.3.4). Flushing the cache has no impact.
I have to disable/enable the second rule to make it work again (4.3.2.1).