Community discussions

MikroTik App
 
barracuda
newbie
Topic Author
Posts: 38
Joined: Thu Jul 09, 2015 12:41 am

DNSexit script?

Sun Jul 26, 2015 4:22 pm

Hi,
Can anyone share script for dnsexit behind nat?I am upgraded my hap lite to v 6.30.2 and now my old script which one I find in this forum no work with this version.Always when I run it the log say dnsexit no need to update but I am shure that IP is changed.

here is the script
# Set needed variables
:local username "xxxx"
:local password "xxxxxxx"
:local hostname "xxxxxxx"

:global dyndnsForce
:global previousIP
#:global currentIP

# print some debug info
#:log info ("UpdateDnsExit: username = $username")
#:log info ("UpdateDnsExit: password = $password")
#:log info ("UpdateDnsExit: hostname = $hostname")
#:log info ("UpdateDnsExit: previousIP = $previousIP")

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="ip.dnsexit.com" src-path="/" dst-path="usb1/dnsexit.tmp" port=80 host=ip.dnsexit.com
:local result [/file get [/file find name=usb1/dnsexit.tmp] contents]

# parse the current IP result
:local resultLen [:len $result]
:local currentIP [:pick $result 0 ($resultLen-1)]
#:log info "UpdateDnsExit: currentIP = $currentIP"

# Remove the # on next line to force an update every single time - useful for debugging,
# but you could end up getting blacklisted by DnsExit!

#:set dyndnsForce true

# Determine if dyndns update is needed
# more dyndns updater request details on DnsExit.com

:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:log info "UpdateDnsExit: Current IP $currentIP"
:log info "UpdateDnsExit: Previous IP $previousIP"
:set previousIP $currentIP
/tool fetch mode=http address="www.dnsexit.com" \
src-path="RemoteUpdate.sv?login=$username&password=$password&host=$hostname&myip=$currentIP" \
dst-path="usb1/dnsexit.txt" port=80 host=www.dnsexit.com
:local result [/file get usb1/dnsexit.txt contents]
#:log info "UpdateDnsExit: previousIP = $previousIP"
:log info ("DnsExit: DnsExit update needed")
:log info ("UpdateDnsExit: DnsExit Update Result: ".$result)
:log info ("DnsExit Update Result: ".$result)
} else={
:log info ("UpdateDnsExit: No DnsExit update needed")
}
I am connected to the internet (to my isp provider modem-bridge mode)with pppoe protokol on ether1.
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: DNSexit script?

Wed Jul 29, 2015 10:31 am

Hi,
it looks you are using my modification of original dynnds script I have published somewhere some time ago.

As the time went this is what I am using now and what works fine for me in 6.30.1:
# Set needed variables
:local username "name"
:local password "pass"
:local hostname "myname.domanin.tld"

:global dyndnsForce
:global previousIP
#:global currentIP

# print some debug info
#:log info ("UpdateDnsExit: username = $username")
#:log info ("UpdateDnsExit: password = $password")
#:log info ("UpdateDnsExit: hostname = $hostname")
#:log info ("UpdateDnsExit: previousIP = $previousIP")

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="api.ipify.org" src-path="/" dst-path="disk1/dnsexit.tmp" port=80 host=api.ipify.org
:delay 2s
:local result [/file get [/file find name=disk1/dnsexit.tmp] contents]

# parse the current IP result
:local resultLen [:len $result]
:global currentIP [:pick $result 0 ($resultLen-0)]
#:log info "UpdateDnsExit: result =$result"
#:log info "UpdateDnsExit: currentIP =$currentIP"

# Remove the # on next line to force an update every single time - useful for debugging,
# but you could end up getting blacklisted by DnsExit!

#:set dyndnsForce true

# Determine if dyndns update is needed
# more dyndns updater request details on DnsExit.com 

:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
:set dyndnsForce false
:log info "UpdateDnsExit: Current IP $currentIP"
:log info "UpdateDnsExit: Previous IP $previousIP"
:set previousIP $currentIP
/tool fetch mode=http address="www.dnsexit.com" \
src-path="RemoteUpdate.sv?login=$username&password=$password&host=$hostname&myip=$currentIP" \
dst-path="disk1/dnsexit.txt" port=80 host=www.dnsexit.com
:local result [/file get disk1/dnsexit.txt contents]
:log info "UpdateDnsExit: previousIP = $previousIP"
:log info ("DnsExit: DnsExit update needed")
:log info ("UpdateDnsExit: DnsExit Update Result: ".$result)
:log info ("DnsExit Update Result: ".$result)
} else={
:log info ("UpdateDnsExit: No DnsExit update needed")
}
 
barracuda
newbie
Topic Author
Posts: 38
Joined: Thu Jul 09, 2015 12:41 am

Re: DNSexit script?

Wed Jul 29, 2015 4:57 pm

Thank you for the reply!This is a script which one I really needed .The script works great and I'm sure that will come in handy for many people.



I really appreciate your help!!
 
barracuda
newbie
Topic Author
Posts: 38
Joined: Thu Jul 09, 2015 12:41 am

Re: DNSexit script?

Mon Oct 05, 2015 10:27 am

This script works almost all the time fine but I noticed one problem when the electricity is interrupted (power cuts) and when power come back the script not update dns.If I reboot the router the script works fine but if the power cuts the router is not updated.

@jarda
Is it any solution to fix this problem?
 
ehabtanta
just joined
Posts: 7
Joined: Sat Mar 07, 2015 4:54 am

Re: DNSexit script?

Sat May 28, 2016 7:54 pm

this is very useful it works nicely
but it needs http://www.dnsexit.com subscription
i need any free way
is it possible that mikrotik sends me the content of dnsexit.tmp

every time it gets changed to my email

i think it is doable but dont know what is the appropriate script would be more than happy if u can help me with the script


thanks in advance
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: DNSexit script?

Mon May 30, 2016 9:56 pm

This script works almost all the time fine but I noticed one problem when the electricity is interrupted (power cuts) and when power come back the script not update dns.If I reboot the router the script works fine but if the power cuts the router is not updated.

@jarda
Is it any solution to fix this problem?
once you have the file, it is easy to send it by e-mail. See: http://wiki.mikrotik.com/wiki/Manual:Tools/email
 
jarda
Forum Guru
Forum Guru
Posts: 7756
Joined: Mon Oct 22, 2012 4:46 pm

Re: DNSexit script?

Mon May 30, 2016 9:57 pm

this is very useful it works nicely
but it needs http://www.dnsexit.com subscription
i need any free way
is it possible that mikrotik sends me the content of dnsexit.tmp

every time it gets changed to my email

i think it is doable but dont know what is the appropriate script would be more than happy if u can help me with the script


thanks in advance
I am using dnsexit for a very long time (many years) and I have never paid a penny for it. And it works. For free..
 
barracuda
newbie
Topic Author
Posts: 38
Joined: Thu Jul 09, 2015 12:41 am

Re: DNSexit script?

Thu Jan 04, 2018 6:22 pm

Hi,
Today I am update my hab lite to 6.41 (Current) version and this script not work anymore.I can see in log message :UpdateDnsExit: No DnsExit update needed but this is
not true.If I ping to my hostname I see some other IP then the current IP is.I try also to update via web browser to put this url :http://update.dnsexit.com/RemoteUpdate. ... .xx.xx.xxx
and it's working.Can anyone help me with working script for dnsexit?

Who is online

Users browsing this forum: No registered users and 11 guests