This one allows for multiple interfaces, dynamic interfaces, and even more than one DNS entry per interface. I've been using it for a few years now.
:local ifs {"ppp1";"wan1";"wan1"};
:local hostnames {"a.homeip.net";"b.homeip.net";"c.homeip.net"};
:local user "your-account-name";
:local password "your-password";
:foreach k,v in=$ifs do={
:local if [/ip address find interface="$v"];
:if ($if="") do={
:log info "DynDNS: Interface '$v' not available";
} else={
:local newip [ /ip address get $if address];
:if ([:typeof $newip]=nil) do={
:log info "DynDNS: No IP address on interface '$v'";
} else={
:set newip [:pick $newip 0 [:find $newip "/"]];
:local oldip [:resolve ($hostnames->$k)];
:local hostname ($hostnames->$k);
:if ($newip!=$oldip) do={
:log info "DynDNS: IP address changed for '$hostname/$v': $oldip -> $newip";
/tool fetch user=$user password=$password keep-result=no \
url="http://members.dyndns.org/nic/update\?hostname=$hostname&myip=$newip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG";
} else={
:log info "DynDNS: IP address unchanged for '$hostname/$v': $oldip";
}
}
}
}
Hi Arnaldo, that looks interesting.
Lets say I have an URL of knowchit.homeip.net
username of cl0wn and password : notmyrealone
I have two ISPs, primary is na me=VLANfiber using vlanxx from the provider and is running on the ether interface on ethport5
secondary (failover) is name=cableISP running of the ether interface on ethport1
How do you mod your script for two interfaces where one is a primary and the other af failover etc......