RB750 DNSQuackie DDNS

I just want to share this script that I used to update my dnsquackie host using RB750

If your RB750 is directly connected to the internet use the script below:

DNSQuackie automatic Dynamic DNS update

#--------------- Change Values in this section to match your setup ------------------

DNSQuackie User account info

Encode your password and copy the base64 as your password

http://www.dnsquackie.com/tools/encode-passwd.php

:local dnsquackieuser "username"
:local dnsquackiepass "password"

Change to the name of interface that gets the dynamic IP address

:global inetinterface "ether1-gateway"

#------------------End of values to change--------------------------------------------


:global previousIP "0.0.0.0"

:if ([/interface get $inetinterface value-name=running]) do={

Get the current IP on the interface

:local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

Strip the net mask off the IP address

:for i from=( [:len $currentIP] - 1) to=0 do={
:if ( [:pick $currentIP $i] = "/") do={
:set currentIP [:pick $currentIP 0 $i]
}
}

:if ($currentIP != $previousIP) do={
:log info "DNSQuackie: Current IP $currentIP is not equal to previous IP, update needed"
:set previousIP $currentIP
:log info "DNSQUACKIE: Sending update.."
:put [/tool fetch url="http://www.dnsquackie.com/authenticate.php\3Fuser=$dnsquackieuser&pass=$dnsquackiepass" mode=http dst-path="dnsquackie.txt"];

:log info "DNSQuackie: Your host is now pointed to $currentIP"
} else={
:log info "DNSQuackie: Previous IP $previousIP is equal to current IP, no update needed"

}
} else={
:log info "DNSQuackie: $inetinterface is not currently running, so therefore will not update."
}


If your RB750 is behind NAT, you need to use the script below:

DNSQuackie automatic Dynamic DNS update

#--------------- Change Values in this section to match your setup ------------------

No-IP User account info

:local dnsquackieuser "username"
:local dnsquackiepass "password"

Set the hostname or label of network to be updated.

Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.

To specify multiple hosts, separate them with commas.

Change to the name of interface that gets the dynamic IP address

:global inetinterface "ether1-gateway"

#------------------------------------------------------------------------------------

No more changes need

:local checkIP [/tool fetch url="http://www.dnsquackie.com/tools/checkip.php\3Fiponly" mode="http" dst-path="dnsquackie-ip.txt"];
:local currentIP [/file get dnsquackie-ip.txt contents];
:global previousIP "0.0.0.0"

:if ([/interface get $inetinterface value-name=running]) do={

:if ($currentIP != $previousIP) do={
:log info "DNSQuackie: Current IP $currentIP is not equal to previous IP, update needed"
:set previousIP $currentIP
:log info "DNSQUACKIE: Sending update.."
:put [/tool fetch url="http://www.dnsquackie.com/authenticate.php\3Fuser=$dnsquackieuser&pass=$dnsquackiepass" mode=http dst-path="dnsquackie.txt"];

:log info "DNSQuackie: Your host is now pointed to $currentIP"
} else={
:log info "DNSQuackie: Previous IP $previousIP is equal to current IP, no update needed"

}
} else={
:log info "DNSQuackie: $inetinterface is not currently running, so therefore will not update."
}



Don't forget to add a scheduler entry if you want run the script on any interval you want. I suggest that you run it every 5 or 10 minutes.

In case you do not have a dnsquackie account yet, you need to get one from http://www.dnsquackie.com/signup.php

I try and is perfect, but one questions , for 2 domains or more, how is the config

/tool fetch url=“http://www.dnsquackie.com/authenticate.php\3Fuser=$dnsquackieuser&pass=$dnsquackiepass” mode=http dst-path=“dnsquackie.txt”];

there is not the hostname var.

Thank you