dynamic dns script mikrot...
dynamic dns script mikrotik
- Casa
- Pannello di controllo
- Forum della Comunità
- Services
- Dynamic DNS Service
- dynamic dns script mikrotik
- Forum della Comunità
- dynamic dns script mikrotik
Argomento: dynamic dns script mikrotik
dynamic dns script mikrotikhttp://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_dynDNSIs there a possibility to include the Account on my device like that mikrotik----------# Define User Variables:global ddnsuser "DYNDNSUSER":global ddnspass "DYNDNSPASS":global ddnshost "DYNDNSHOST"# Define Global Variables:global ddnsip:global ddnslastip:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }:global ddnsinterface:global ddnssystem ("mt-" . [/system package get system version] )# Define Local Variables:local int# Loop thru interfaces and look for ones containing# default gateways without routing-marks:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={ :if ([:typeof [/ip route get $int routing-mark ]] != str ) do={ :global ddnsinterface [/ip route get $int interface] }}# Grab the current IP address on that interface.:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]# Did we get an IP address to compare?:if ([ :typeof $ddnsip ] = nil ) do={ :log info ("DynDNS: No ip address present on " . $ddnsinterface . ", please check.")} else={ :if ($ddnsip != $ddnslastip) do={ :log info "DynDNS: Sending UPDATE!" :local str "/nic/update?hostname=$ddnshost&myip=$ddnsip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" /tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/DynDNS.".$ddnshost) :delay 1 :local str [/file find name="DynDNS.$ddnshost"]; /file remove $str :global ddnslastip $ddnsip }}
Rispondi con citazione | Segnalare
Our dynamic DNS service can be used on Mikrotik devices. Please try the following script:----------# Define User Variables:global ddnsuser "YourDynuUsername":global ddnspass "YourDynuPassword":global ddnshost "YourDynuHostname"# Define Global Variables:global ddnsip:global ddnslastip:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }:global ddnsinterface:global ddnssystem ("mt-" . [/system package get system version] )# Define Local Variables:local int# Loop thru interfaces and look for ones containing# default gateways without routing-marks:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={ :if ([:typeof [/ip route get $int routing-mark ]] != str ) do={ :global ddnsinterface [/ip route get $int interface] }}# Grab the current IP address on that interface.:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]# Did we get an IP address to compare?:if ([ :typeof $ddnsip ] = nil ) do={ :log info ("Dynu: No ip address present on " . $ddnsinterface . ", please check.")} else={ :if ($ddnsip != $ddnslastip) do={ :log info "Dynu: Sending UPDATE!" :local str"/nic/update?hostname=$ddnshost&myip=$ddnsip" /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser \ password=$ddnspass dst-path=("/Dynu.".$ddnshost) :delay 1 :local str [/file find name="Dynu.$ddnshost"]; /file remove $str :global ddnslastip $ddnsip }}Please change the values in bold with your Dynu account details. Please note that your username can be found in 'Contact Details' section in Dynu control panel.For more information, you may refer to our IP update protocol at https://www.dynu.com/Resources/API
Rispondi con citazione | Segnalare
:global ddnsuser "userdynu":global ddnspass "passdynu":global theinterface "lan name":global ddnshost "hostname":global ipddns [:resolve $ddnshost];:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]:if ([ :typeof $ipfresh ] = nil ) do={:log info ("dynu: No ip address on $theinterface .")} else={:for i from=( [:len $ipfresh] - 1) to=0 do={:if ( [:pick $ipfresh $i] = "/") do={:set ipfresh [:pick $ipfresh 0 $i];}}:if ($ipddns != $ipfresh) do={:log info ("dynu: IP-dynu = $ipddns"):log info ("dynu: IP-Fresh = $ipfresh"):log info "dynu: Update IP needed, Sending UPDATE...!":global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost):delay 1:global str [/file find name="Dynu.$ddnshost"];/file remove $str:global ipddns $ipfresh:log info "dynu: IP updated to $ipfresh!"} else={:log info "dynu: dont need changes";}}--------------This is the right Scripting after amendment, experience and confirmation
Rispondi con citazione | Segnalare
/tool fetch mode=http url="http://api.ipify.org" src-path="" dst-path=/dyn.html:local currentIP [/file get dyn.html contents]:log warning "Public IP Detected $currentIP"###################################################### :global ddnsuser "username":global ddnspass "password":global ddnshost "host.mywire.org":global ipddns [:resolve $ddnshost];:log warning "Current DNS $ipddns"/file/remove dyn.html:if ($ipddns != $currentIP) do={:log warning ("Updating IP = $currentIP"):global str "/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP"/tool fetch address=api.dynu.com src-path=$str mode=https dst-path=("/Dynu.".$ddnshost):delay 1:global str [/file find name="Dynu.$ddnshost"];/file remove $str:global ipddns $currentIP:log info "DynuDDNS: IP updated to $currentIP!"} else={:log info "No Need to change, IP Already Updated";} }
Rispondi con citazione | Segnalare
Improved version
:local ddnsuser "username":local ddnspass "password":local ddnshost "host.mywire.org":local currentIP ([/tool fetch url="http://api.ipify.org" as-value output=user]->"data"):local dnsIP [:resolve $ddnshost]:if ($currentIP != $dnsIP) do={ :local update "https://api.dynu.com/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP" /tool fetch url=$update keep-result=no :log info "DYNU $ddnshost updated to:$currentIP old IP was $dnsIP"}
Rispondi con citazione | Segnalare
shopspk wrote:Improved version:local ddnsuser "username":local ddnspass "password":local ddnshost "host.mywire.org":local currentIP ([/tool fetch url="http://api.ipify.org" as-value output=user]->"data"):local dnsIP [:resolve $ddnshost]:if ($currentIP != $dnsIP) do={ :local update "https://api.dynu.com/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP" /tool fetch url=$update keep-result=no :log info "DYNU $ddnshost updated to:$currentIP old IP was $dnsIP"}
Rispondi con citazione | Segnalare
Autore | Argomento: dynamic dns script mikrotik |
---|---|
shady shata Iscritto: 17/08/2015 |
dynamic dns script mikrotik lunedì 17 agosto 2015 11:35
dynamic dns script mikrotikhttp://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_dynDNSIs there a possibility to include the Account on my device like that mikrotik----------# Define User Variables:global ddnsuser "DYNDNSUSER":global ddnspass "DYNDNSPASS":global ddnshost "DYNDNSHOST"# Define Global Variables:global ddnsip:global ddnslastip:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }:global ddnsinterface:global ddnssystem ("mt-" . [/system package get system version] )# Define Local Variables:local int# Loop thru interfaces and look for ones containing# default gateways without routing-marks:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={ :if ([:typeof [/ip route get $int routing-mark ]] != str ) do={ :global ddnsinterface [/ip route get $int interface] }}# Grab the current IP address on that interface.:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]# Did we get an IP address to compare?:if ([ :typeof $ddnsip ] = nil ) do={ :log info ("DynDNS: No ip address present on " . $ddnsinterface . ", please check.")} else={ :if ($ddnsip != $ddnslastip) do={ :log info "DynDNS: Sending UPDATE!" :local str "/nic/update?hostname=$ddnshost&myip=$ddnsip&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" /tool fetch address=members.dyndns.org src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/DynDNS.".$ddnshost) :delay 1 :local str [/file find name="DynDNS.$ddnshost"]; /file remove $str :global ddnslastip $ddnsip }}
|
timothytw Iscritto: 02/05/2002 |
dynamic dns script mikrotik martedì 18 agosto 2015 12:34
Our dynamic DNS service can be used on Mikrotik devices. Please try the following script:----------# Define User Variables:global ddnsuser "YourDynuUsername":global ddnspass "YourDynuPassword":global ddnshost "YourDynuHostname"# Define Global Variables:global ddnsip:global ddnslastip:if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" }:global ddnsinterface:global ddnssystem ("mt-" . [/system package get system version] )# Define Local Variables:local int# Loop thru interfaces and look for ones containing# default gateways without routing-marks:foreach int in=[/ip route find dst-address=0.0.0.0/0 active=yes ] do={ :if ([:typeof [/ip route get $int routing-mark ]] != str ) do={ :global ddnsinterface [/ip route get $int interface] }}# Grab the current IP address on that interface.:global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ]# Did we get an IP address to compare?:if ([ :typeof $ddnsip ] = nil ) do={ :log info ("Dynu: No ip address present on " . $ddnsinterface . ", please check.")} else={ :if ($ddnsip != $ddnslastip) do={ :log info "Dynu: Sending UPDATE!" :local str"/nic/update?hostname=$ddnshost&myip=$ddnsip" /tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser \ password=$ddnspass dst-path=("/Dynu.".$ddnshost) :delay 1 :local str [/file find name="Dynu.$ddnshost"]; /file remove $str :global ddnslastip $ddnsip }}Please change the values in bold with your Dynu account details. Please note that your username can be found in 'Contact Details' section in Dynu control panel.For more information, you may refer to our IP update protocol at https://www.dynu.com/Resources/API
|
shadysoft Iscritto: 17/08/2015 |
dynamic dns script mikrotik martedì 18 agosto 2015 19:43
:global ddnsuser "userdynu":global ddnspass "passdynu":global theinterface "lan name":global ddnshost "hostname":global ipddns [:resolve $ddnshost];:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]:if ([ :typeof $ipfresh ] = nil ) do={:log info ("dynu: No ip address on $theinterface .")} else={:for i from=( [:len $ipfresh] - 1) to=0 do={:if ( [:pick $ipfresh $i] = "/") do={:set ipfresh [:pick $ipfresh 0 $i];}}:if ($ipddns != $ipfresh) do={:log info ("dynu: IP-dynu = $ipddns"):log info ("dynu: IP-Fresh = $ipfresh"):log info "dynu: Update IP needed, Sending UPDATE...!":global str "/nic/update?hostname=$ddnshost&myip=$ipfresh"/tool fetch address=api.dynu.com src-path=$str mode=http user=$ddnsuser password=$ddnspass dst-path=("/Dynu.".$ddnshost):delay 1:global str [/file find name="Dynu.$ddnshost"];/file remove $str:global ipddns $ipfresh:log info "dynu: IP updated to $ipfresh!"} else={:log info "dynu: dont need changes";}}--------------This is the right Scripting after amendment, experience and confirmation
|
bitmdn Iscritto: 08/09/2016 |
dynamic dns script mikrotik domenica 30 ottobre 2016 19:55
already solved by myself
|
Mateito Iscritto: 06/10/2016 |
dynamic dns script mikrotik venerdì 30 dicembre 2016 15:53
How did you solve itplease
|
aghsistemas Iscritto: 07/08/2017 |
dynamic dns script mikrotik lunedì 7 agosto 2017 02:04
|
myshahid Iscritto: 30/05/2022 |
dynamic dns script mikrotik sabato 8 ottobre 2022 15:01 /tool fetch mode=http url="http://api.ipify.org" src-path="" dst-path=/dyn.html:local currentIP [/file get dyn.html contents]:log warning "Public IP Detected $currentIP"###################################################### :global ddnsuser "username":global ddnspass "password":global ddnshost "host.mywire.org":global ipddns [:resolve $ddnshost];:log warning "Current DNS $ipddns"/file/remove dyn.html:if ($ipddns != $currentIP) do={:log warning ("Updating IP = $currentIP"):global str "/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP"/tool fetch address=api.dynu.com src-path=$str mode=https dst-path=("/Dynu.".$ddnshost):delay 1:global str [/file find name="Dynu.$ddnshost"];/file remove $str:global ipddns $currentIP:log info "DynuDDNS: IP updated to $currentIP!"} else={:log info "No Need to change, IP Already Updated";} } |
shopspk Iscritto: 25/11/2022 |
dynamic dns script mikrotik domenica 1 gennaio 2023 13:03
Improved version
:local ddnsuser "username":local ddnspass "password":local ddnshost "host.mywire.org":local currentIP ([/tool fetch url="http://api.ipify.org" as-value output=user]->"data"):local dnsIP [:resolve $ddnshost]:if ($currentIP != $dnsIP) do={ :local update "https://api.dynu.com/nic/update?username=$ddnsuser&password=$ddnspass&hostname=$ddnshost&myip=$currentIP" /tool fetch url=$update keep-result=no :log info "DYNU $ddnshost updated to:$currentIP old IP was $dnsIP"} |
unixtechti Iscritto: 09/08/2023 |
dynamic dns script mikrotik martedì 27 febbraio 2024 07:00
|
Al momento è mercoledì 18 dicembre 2024 07:26 US Mountain Standard Time
mercoledì 18 dicembre 2024 07:26