Dynamic DNS Update Script for ChangeIP.com
The following script should be created when you wish to update your ChangeIP.com Dynamic DNS account. Once created you should schedule this to run once in a while. The :global variables should be edited to include your unique username and password, interface name, etc.
:log info "DDNS: Begin" :global ddns-user "YOURUSERID" :global ddns-pass "YOURPASSWORD" :global ddns-host "*1" :global ddns-interface "EXACTINTERFACENAME" :global ddns-ip [ /ip address get [/ip address find interface=$ddns-interface] address ] :if ([ :typeof $ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/0 } :if ([ :typeof $ddns-ip ] = nil ) do={ :log info ("DDNS: No ip address present on " . $ddns-interface . ", please check.") } else={ :if ($ddns-ip != $ddns-lastip) do={ :log info "DDNS: Sending UPDATE!" :log info [ /tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ] :global ddns-lastip $ddns-ip } else={ :log info "DDNS: No change" } } :log info "DDNS: End"
An updated script here (10/18/07) should allow auto-detection of the default gateways interface name. This script below can be used if you have more than 1 WAN connection, but only 1 is active at a time.
:global ddnsuser "YOURUSERID" :global ddnspass "YOURPASSWORD" :global ddnshost "YOUR.HOST.NAME.HERE" #:global ddnsinterface "1-coxBiz" :global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] ) :foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={ :if ([:typeof [/ip route get $int routing-mark ]] = nothing ) do={ :global ddnsinterface [/ip route get $int interface] } } :global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ] :if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip 0.0.0.0/0 } :if ([ :typeof $ddnsip ] = nil ) do={ :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.") } else={ :if ($ddnsip != $ddnslastip) do={ :log info "DDNS: Sending UPDATE!" :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ] :global ddnslastip $ddnsip } else={ } }