Community discussions

MikroTik App
 
ah3000
newbie
Topic Author
Posts: 43
Joined: Fri Mar 07, 2014 12:02 am

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

Mon Feb 16, 2015 10:09 pm

: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"
}
 
dahonora
just joined
Posts: 16
Joined: Tue Apr 29, 2014 4:42 pm

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

Fri Mar 20, 2015 9:22 am

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!
 
016hnoor
just joined
Posts: 4
Joined: Tue Mar 17, 2015 9:43 am

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

Sat Mar 21, 2015 7:20 am

} else={
:log error "DNS-O-Matic IP: no need to update"
}
 
ah3000
newbie
Topic Author
Posts: 43
Joined: Fri Mar 07, 2014 12:02 am

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

Sat Mar 21, 2015 1:06 pm

How many wan lines do you have ?
Do you use the wan integration lines ?
 
dahonora
just joined
Posts: 16
Joined: Tue Apr 29, 2014 4:42 pm

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

Sat Mar 21, 2015 9:38 pm

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.
 
ah3000
newbie
Topic Author
Posts: 43
Joined: Fri Mar 07, 2014 12:02 am

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

Sat Mar 21, 2015 11:22 pm

which one of these lines connects microtik server to the Internet
 
dahonora
just joined
Posts: 16
Joined: Tue Apr 29, 2014 4:42 pm

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

Sun Mar 22, 2015 10:35 am

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.
 
ah3000
newbie
Topic Author
Posts: 43
Joined: Fri Mar 07, 2014 12:02 am

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

Sun Mar 22, 2015 11:45 am

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
 
thiagomedeiros
just joined
Posts: 24
Joined: Tue Apr 03, 2012 10:38 pm

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

Sun Jul 31, 2016 9:48 pm

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];