UnoTelly IP Address Update Script

I'm using UnoTelly SmartDNS to enable Netflix and other country-specific services while abroad. My DSL service offers a dynamic IP, so I must continually update UnoTelly with my new IP address. To automate this I found this script written by Alistair Phillips:

Set needed variables

:local waninterface "{insert your WAN Interface name here (such as pppoe-out1)}"
:local userhash "{insert your hash here}"
:global previousIP

get the current IP address from

:local currentNET [/ip address get [/ip address find interface=$waninterface] address]
:local currentIP [ :pick $currentNET 0 [ :find $currentNET "/" ] ]

Did we get an IP address to compare?

:if ([ :typeof $currentIP ] = nil ) do={
:log info ("UpdateUnoTelly: No IP address present on " . $waninterface . ", please check.")
} else={
:if (([ :typeof $previousIP ] = nil) || ($currentIP != $previousIP)) do={
:log info ("UpdateUnoTelly: UnoTelly update needed")
:log info ("UpdateUnoTelly: previousIP = $previousIP --> currentIP = $currentIP")
/tool fetch mode=http address="api.unotelly.com" host="api.unotelly.com" src-path="/api/v1/network/update_by_hash_api?user_hash=$userhash" dst-path="/unotelly.txt"
:set previousIP $currentIP
:local result [/file get unotelly.txt contents]
:log info ("UpdateUnoTelly: UnoTelly update result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
:log info ("UpdateUnoTelly: No UnoTelly update needed")
}
}

I cannot put the DSL modem into bridged mode, so my MT router is NATted behind the DSL router. This script is returning my NATted (private) IP address obtained from behind the DSL router, not my actual public IP address. Any suggestions how this script could be modified to obtain my public IP? Thanks in advance.

Scott

Really you not pass any IP at UnoTelly with that script, unotelly detect automtically your IP…


Based on this:
http://forum.mikrotik.com/t/ddns-script-for-no-ip-dyndns-ipchange/79060/1

OBVIOUSLY RUN ONLY ON SCHEDULER, IF RUN ON CLI DO ERROR ON “?”

:local DDNSuser value="unotelly-user-hash";
:local DDNSpass value="";
:local DDNShost value="my.site.ext";

# possible value are DynDNS, No-IP, ChangeIP, UnoTelly;
:local DDNStype value="UnoTelly";

/tool fetch mode=http keep-result=yes url="http://myip.dnsomatic.com/index.html" dst-path="CURRip";
/delay delay-time=2s;
:local CURRip value=[:toip [/file get "CURRip" value-name=contents]];
/delay delay-time=2s;
/file remove "CURRip";

:if ([:resolve $DDNShost] != $CURRip) do={
 :if ($DDNStype = "DynDNS") do={ /tool fetch mode=http keep-result=no url="http://members.dyndns.org/nic/update?hostname=$DDNShost&myip=$CURRip" user=$DDNSuser password=$DDNSpass; };
 :if ($DDNStype = "No-IP") do={ /tool fetch mode=http keep-result=no url="http://dynupdate.no-ip.com/nic/update?hostname=$DDNShost&myip=$CURRip" user=$DDNSuser password=$DDNSpass; };
 :if ($DDNStype = "ChangeIP") do={ /tool dns-update name=$DDNShost address=$CURRip key-name=$DDNSuser key=$DDNSpass; };
 :if ($DDNStype = "UnoTelly") do={ /tool fetch mode=http keep-result=no url="http://api.unotelly.com/api/v1/network/update_by_hash_api?user_hash=$DDNSuser"; };
};

Very cool, thank you! :smiley: