Page 1 of 1

DNS-O-Matic auto update this work with microtik 5.26

Posted: Mon Feb 16, 2015 10:09 pm
by ah3000
:global previousIP

:log error "DNS-O-Matic IP: last IP $previousIP"

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" 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]



:if ($currentIP != $previousIP) do={

:log warning "DNS-O-Matic IP: new IP $currentIP"

:log warning "Open Dns IP : update now"

:set previousIP $currentIP

:local maticuser "username"
:local maticpass "password"
:local host "http://updates.dnsomatic.com/nic/update"

/tool fetch url=$host user=$maticuser password=$maticpass mode=http


} else={
:log error "DNS-O-Matic IP: no need to update"
}

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Fri Mar 20, 2015 9:22 am
by dahonora
I'm trying to run your script.

But when I run it I get the next error
status: failed

failure: closing connection: <connection failed> 216.146.38.70:80 (4)


May be you can help me? Any idea why I getting this error?
Thanks!

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sat Mar 21, 2015 7:20 am
by 016hnoor
} else={
:log error "DNS-O-Matic IP: no need to update"
}

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sat Mar 21, 2015 1:06 pm
by ah3000
How many wan lines do you have ?
Do you use the wan integration lines ?

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sat Mar 21, 2015 9:38 pm
by dahonora
I don't have much experience with networks...
This is the answer of /interface print
0 R ether1 ether 1500 1600 9500 D4:CA:6D:E8:58:81
1 ether2 ether 1500 1600 9500 D4:CA:6D:E8:58:82
2 R ether3 ether 1496 1500 9116 D4:CA:6D:E8:58:83
3 R Data vlan 1500 1496 D4:CA:6D:E8:58:83
4 R Guests vlan 1500 1496 D4:CA:6D:E8:58:83
5 R Service vlan 1500 1496 D4:CA:6D:E8:58:83
6 R VoIP vlan 1500 1496 D4:CA:6D:E8:58:83
7 R pptp-RN pptp-out 1300

I didn't make the network. I'm just trying to administrate it.

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sat Mar 21, 2015 11:22 pm
by ah3000
which one of these lines connects microtik server to the Internet

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sun Mar 22, 2015 10:35 am
by dahonora
First of all, thanks for your help!
The line is ether1

I think you have already guess, but I think that the problem is with the tool fetch command. I have tried with different very simples (from the mikrotik fetch wiki) examples and I receive the same error.
Something wrong with my configuration, but don't know where to start.

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sun Mar 22, 2015 11:45 am
by ah3000
I'm sorry i cant help you Because Lack of my experience
and you will find some one Professional More than me to give help to you
im sorry about my english

Re: DNS-O-Matic auto update this work with microtik 5.26

Posted: Sun Jul 31, 2016 9:48 pm
by thiagomedeiros
Replace this:
# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" 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]
To this:
:global currentIP [:resolve myip.opendns.com server=208.67.222.222];