What I want to achieve is: if my.dns.domain resolves though server x.y.z.x then check if network number 0 and 2 do not have x.y.z.x as current dns server then do something
First rule: do not use “print” numbers on script, this is wrong: number=0
{
:local testip 3.4.5.6
/ip dhcp-server network
:if ( ([get [find where address="192.168.0.0/24"] dns-server] ~ [:tostr $testip]) or \
([get [find where address="192.168.1.0/24"] dns-server] ~ [:tostr $testip]) ) do={
:put "$testip is present at least on one network as DNS"
} else={
:put "$testip is not present on the networks"
}
}
that’s brilliant, thank you so much
one last question: I would like to not use the else in the if statement but to do that I suppose it’s more clean to check if $testip is NOT present (so the IF statement is true if it’s not present). How can I achieve that? using
:if ( !([get [find where address="192.168.0.0/24"] dns-server] ~ [:tostr $testip]) or \
!([get [find where address="192.168.1.0/24"] dns-server] ~ [:tostr $testip]) ) do={