Page 1 of 1

problem " detect local ip"

Posted: Fri Mar 02, 2012 6:24 am
by vetusa2
suddenly my dnsomatic stopped working 2 days ago,as i investigated the issue i found that the script depending on dnsomatic to update opendns failed for some reasons one of them is because of the line requests shows local ip instead of the public ip

i need an advise regarding this issue

Re: problem " detect local ip"

Posted: Mon Mar 05, 2012 10:56 pm
by Zebble
That possibly means your MikroTik is behind another NAT device.

Re: problem " detect local ip"

Posted: Mon Mar 12, 2012 10:01 am
by CyberT
you want to post the script so that we can have a look?

Re: problem " detect local ip"

Posted: Thu Mar 15, 2012 6:31 pm
by vetusa2
the script is correct which is

# DNSoMatic automatic DNS updates
# User account info of DNSoMatic
:global maticuser "user"
:global maticpass "password"
:global matichost "Yourhost"
# No more changes need

:global previousIP

# Print values for debug
:log info "DNSoMatic: Updating dynamic IP on DNS for host $matichost"
:log info "DNSoMatic: User $maticuser y Pass $maticpass"
:log info "DNSoMatic: Last IP $previousIP"

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="" src-path="/" dst-path="/dyndns.checkip.html"
:local result [/file get dyndns.checkip.html contents]

# parse the current IP result
:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result "</body>" -1]
:global currentIP [:pick $result $startLoc $endLoc]
:log info "DNSoMatic: IP actual $currentIP"

# Touching the string passed to fetch command on "src-path" option
:local str "/nic/update?hostname=$matichost&myip=$currentIP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"

:if ($currentIP != $previousIP) do={
:log info "DNSoMatic: Update need"
:set previousIP $currentIP
:log info "DNSoMatic: Sending update $currentIP"
:log info [ :put [/tool fetch host=MT user=$maticuser password=$maticpass mode=http address="" src-path=$str dst-path=$matichost]]
:log info "DNSoMatic: Host $matichost updated on DNSoMatic with IP $currentIP"
} else={
:log info "DNSoMatic: Previous IP $previousIP and current $currentIP equal, no update need"

when i open my mikrotik log i get a strange message

it say that my previous and current ip are equal but when i log into dnsomatic website my current or previous ip doesn't show up and only a message "waiting for update"!!!

Re: problem " detect local ip"

Posted: Sat Mar 17, 2012 5:34 pm
by vetusa2
what could be the problem guys?!