:local resultLen [:len $result]
:local startLoc [:find $result "dns1" -1]
:set startLoc ($startLoc + 6)
:local endLoc [:find $result "," -1]
:local currentIP [:pick $result $startLoc $endLoc]
:log info "Current Tunlr primary DNS: currentIP = $currentIP"So my main problem that dst-nat does not accept and adress list in to-adresses. So I could not just put new IP to that list. So I need to recreate NAT rule (from step 3). But how could I delete current rule?
/ip firewall nat
:foreach a in=[find where comment="tunlr-dns-dst"] do={
set $a to-addresses=($currentIP)
:log info "Successfully set new tunlr DNS IP: $currentIP"
}Edits from previous version - bit of cleaning for log message, removal of quotes from parsed IP address and finally added updating of nat rule!
I'll add check to if IP was actually changed and then update first post.