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