How would I go about to implement this script, and where to put it?
I suppose it would need to run with some frequency (times/minute etc)?
I'm new to mikrotik, so please bare with me.
ref: viewtopic.php?t=170487#p833670
Code: Select all
:local piholeDNS "192.168.18.2"
:local testDomain "www.google.com"
:if ([/ip firewall nat [find comment="piholeNAT1"] enabled]) do={
:do {
:resolve $testDomain server $piholeDNS
} on-error={
/ip firewall nat disable [find comment="piholeNAT1"]
/ip firewall nat disable [find comment="piholeNAT2"]
/ip firewall nat disable [find comment="piholeNAT3"]
/ip firewall nat disable [find comment="piholeNAT4"]
}
} else={
:do {
:resolve $testDomain server $piholeDNS
/ip firewall nat enable [find comment="piholeNAT1"]
/ip firewall nat enable [find comment="piholeNAT2"]
/ip firewall nat enable [find comment="piholeNAT3"]
/ip firewall nat enable [find comment="piholeNAT4"]
} on-error={}
}