29 lines
961 B
Plaintext
29 lines
961 B
Plaintext
:local ipsecDns1 10.0.0.4
|
|
:local ipsecDns2 10.0.0.5
|
|
:local publicDns1 8.8.8.8
|
|
:local publicDns2 8.8.4.4
|
|
|
|
:local pingSrc [/ip address get [find interface=vlan10] address]
|
|
:local pingSrc [:pick $pingSrc 0 [:find $pingSrc "/"]]
|
|
:local currentDns [/ip dns get servers]
|
|
|
|
:if ([/ping $ipsecDns1 src-address=$pingSrc count=10] = 0) do={
|
|
:log info "Ping IPsec DNS: Failed: $pingSrc -> $ipsecDns1"
|
|
|
|
:if ($currentDns != "$publicDns1;$publicDns2") do={
|
|
:log info "Switching to public DNS servers."
|
|
/ip dns set servers="$publicDns1,$publicDns2"
|
|
} else {
|
|
:log info "Public DNS servers already set up, no changes."
|
|
}
|
|
} else={
|
|
:log info "Ping IPsec DNS: Online: $pingSrc -> $ipsecDns1"
|
|
|
|
:if ($currentDns != "$ipsecDns1;$ipsecDns2") do={
|
|
:log info "Switching to IPsec DNS servers."
|
|
/ip dns set servers="$ipsecDns1,$ipsecDns2"
|
|
} else {
|
|
:log info "IPsec DNS servers already set up, no changes."
|
|
}
|
|
}
|