Script para DDNS

Ola bos noite, alguem tem um script para ddns, pode ser no-ip ou change-ip, utilizo modem roteado em um balance. Fico no aguardo de um retorno.

Para adicionar comentários, você deve ser membro de MK-AUTH.

Join MK-AUTH

Votos 0
Enviar-me um email quando as pessoas responderem –

Respostas

  • Pedro o modem e da marca TELSEC, e tem a função dynddns, mais ele esta roteado, da certo?

  • qual o modelo do modem ?? a maioria deles já tem uma opção para DDNS...

  • fiz aki mais continua nao dando certo, vc tem skype, o meu skype e ogoid89@hotmail.com

  • me perdoa mas não entendi!

  • faz com que ping o ip da conexão

  • amigo por gentileza, o que este script faz?

    GOMES disse:

    obs:
    quando vc fizer o script e o scheduler vc colocar o mesmo nome: xDSL



    system>script list
    só deixa password desmarcado

    # Dynamic DNS Update / Simple Edition
    # Written by Sam Norris, ChangeIP.com
    # Copyright ChangeIP.com 2009-2010
    # For support send mail to Support@ChangeIP.com
    #
    # 2009-06-22 RouterOS 3.25 Tested
    # 2009-10-05 RouterOS 4.01rc1 Tested
    #
    # OVERVIEW:         %
    #  This script will update a ChangeIP.com dynamic dns hostname
    #  with an ip address located directly on an interface.
    #                   %
    # NOTES:            %
    #  IF THIS SCRIPT DOES NOT PRODUCE ANY OUTPUT PLEASE COPY AND PASTE IT
    #  AGAIN.  THERE PROBABLY IS A LINE BREAK IN THE WRONG PLACE! Once you
    #  have created this script and tested that it works by running it
    #  manually you can schedule it to run every few minutes.
    #                   %
    # CONFIGURATION FIELD DEFINITIONS:
    #  ddnsuser:  Enter your ChangeIP.com user id.
    #  ddnspass:  Enter your ChangeIP.com password.
    #  ddnshost:  Enter the hostname (www.example.com) to update.
    #  ddnsinterface:  Enter an interface name - case sensative.
    #                   %
    #                   %
    #                   %
    #                   %
    #               %   %   %
    #                %  %  %
    #                 % % %
    #                   %
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # EDIT YOUR DETAILS / CONFIGURATION HERE
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    :global ddnsuser "user name"
    :global ddnspass "password"
    :global ddnshost "ddns"
    :global ddnsinterface "interface onde entra o link"
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # END OF USER DEFINED CONFIGURATION
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
    :global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
    :global ddnslastip

    :if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }

    :if ([ :typeof $ddnslastip ] = "nothing" ) do={ :global ddnslastip 0.0.0.0/0 }

    :if ([ :typeof $ddnsip ] = "nothing" ) do={

    :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")

    } else={

      :if ($ddnsip != $ddnslastip) do={

        :log info "Change IP: Sincronizando..."
        :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
        :global ddnslastip $ddnsip

      } else={

        :log info "Change IP:Sincronizado"

      }

    }

    # END OF SCRIPT




    ----------------------------------------------------------------------------------

    depois vc vai em system>schedule

    Nome: xDSL
    start date: nov/26/2013
    start time: startup
    interval: 00:01:00
    on event:
    /system script run xDSL

    aqui vc pode marcar todos


    na duvida pode me ligar 38 9848-9032

  • obs:
    quando vc fizer o script e o scheduler vc colocar o mesmo nome: xDSL



    system>script list
    só deixa password desmarcado

    # Dynamic DNS Update / Simple Edition
    # Written by Sam Norris, ChangeIP.com
    # Copyright ChangeIP.com 2009-2010
    # For support send mail to Support@ChangeIP.com
    #
    # 2009-06-22 RouterOS 3.25 Tested
    # 2009-10-05 RouterOS 4.01rc1 Tested
    #
    # OVERVIEW:         %
    #  This script will update a ChangeIP.com dynamic dns hostname
    #  with an ip address located directly on an interface.
    #                   %
    # NOTES:            %
    #  IF THIS SCRIPT DOES NOT PRODUCE ANY OUTPUT PLEASE COPY AND PASTE IT
    #  AGAIN.  THERE PROBABLY IS A LINE BREAK IN THE WRONG PLACE! Once you
    #  have created this script and tested that it works by running it
    #  manually you can schedule it to run every few minutes.
    #                   %
    # CONFIGURATION FIELD DEFINITIONS:
    #  ddnsuser:  Enter your ChangeIP.com user id.
    #  ddnspass:  Enter your ChangeIP.com password.
    #  ddnshost:  Enter the hostname (www.example.com) to update.
    #  ddnsinterface:  Enter an interface name - case sensative.
    #                   %
    #                   %
    #                   %
    #                   %
    #               %   %   %
    #                %  %  %
    #                 % % %
    #                   %
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # EDIT YOUR DETAILS / CONFIGURATION HERE
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    :global ddnsuser "user name"
    :global ddnspass "password"
    :global ddnshost "ddns"
    :global ddnsinterface "interface onde entra o link"
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # END OF USER DEFINED CONFIGURATION
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
    :global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
    :global ddnslastip

    :if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }

    :if ([ :typeof $ddnslastip ] = "nothing" ) do={ :global ddnslastip 0.0.0.0/0 }

    :if ([ :typeof $ddnsip ] = "nothing" ) do={

    :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")

    } else={

      :if ($ddnsip != $ddnslastip) do={

        :log info "Change IP: Sincronizando..."
        :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
        :global ddnslastip $ddnsip

      } else={

        :log info "Change IP:Sincronizado"

      }

    }

    # END OF SCRIPT




    ----------------------------------------------------------------------------------

    depois vc vai em system>schedule

    Nome: xDSL
    start date: nov/26/2013
    start time: startup
    interval: 00:01:00
    on event:
    /system script run xDSL

    aqui vc pode marcar todos


    na duvida pode me ligar 38 9848-9032

  • amigo por gentileza, o que este script faz?

    GOMES disse:

    # No-IP automatic Dynamic DNS update

    #--------------- Change Values in this section to match your setup ------------------

    # No-IP User account info
    :local noipuser "email"
    :local noippass "login"

    # Set the hostname or label of network to be updated.
    # Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
    # To specify multiple hosts, separate them with commas.
    :local noiphost "ddns"

    # Change to the name of interface that gets the dynamic IP address
    :local inetinterface "interface"

    #------------------------------------------------------------------------------------
    # No more changes need

    :global previousIP

    :if ([/interface get $inetinterface value-name=running]) do={
    # Get the current IP on the interface
       :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

    # Strip the net mask off the IP address
       :for i from=( [:len $currentIP] - 1) to=0 do={
           :if ( [:pick $currentIP $i] = "/") do={
               :set currentIP [:pick $currentIP 0 $i]
           }
       }

       :if ($currentIP != $previousIP) do={
           :log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
           :set previousIP $currentIP

    # The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
           :local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
           :local noiphostarray
           :set noiphostarray [:toarray $noiphost]
           :foreach host in=$noiphostarray do={
               :log info "No-IP: Sending update for $host"
               /tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt")
               :log info "No-IP: Host $host updated on No-IP with IP $currentIP"
           }
       }  else={
           :log info "No-IP: Previous IP $previousIP is equal to current IP, no update needed"
       }
    } else={
       :log info "No-IP: $inetinterface is not currently running, so therefore will not update."
    }

    -------------------------------------------------------------

    # Dynamic DNS Update / Simple Edition
    # Written by Sam Norris, ChangeIP.com
    # Copyright ChangeIP.com 2009-2010
    # For support send mail to Support@ChangeIP.com
    #
    # 2009-06-22 RouterOS 3.25 Tested
    # 2009-10-05 RouterOS 4.01rc1 Tested
    #
    # OVERVIEW:         %
    #  This script will update a ChangeIP.com dynamic dns hostname
    #  with an ip address located directly on an interface.
    #                   %
    # NOTES:            %
    #  IF THIS SCRIPT DOES NOT PRODUCE ANY OUTPUT PLEASE COPY AND PASTE IT
    #  AGAIN.  THERE PROBABLY IS A LINE BREAK IN THE WRONG PLACE! Once you
    #  have created this script and tested that it works by running it
    #  manually you can schedule it to run every few minutes.
    #                   %
    # CONFIGURATION FIELD DEFINITIONS:
    #  ddnsuser:  Enter your ChangeIP.com user id.
    #  ddnspass:  Enter your ChangeIP.com password.
    #  ddnshost:  Enter the hostname (www.example.com) to update.
    #  ddnsinterface:  Enter an interface name - case sensative.
    #                   %
    #                   %
    #                   %
    #                   %
    #               %   %   %
    #                %  %  %
    #                 % % %
    #                   %
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # EDIT YOUR DETAILS / CONFIGURATION HERE
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    :global ddnsuser "user name"
    :global ddnspass "login"
    :global ddnshost "ddns"
    :global ddnsinterface "pppoe-out1"
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # END OF USER DEFINED CONFIGURATION
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
    :global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
    :global ddnslastip

    :if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }

    :if ([ :typeof $ddnslastip ] = "nothing" ) do={ :global ddnslastip 0.0.0.0/0 }

    :if ([ :typeof $ddnsip ] = "nothing" ) do={

    :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")

    } else={

      :if ($ddnsip != $ddnslastip) do={

        :log info "Change IP: Sincronizando..."
        :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
        :global ddnslastip $ddnsip

      } else={

        :log info "Change IP:Sincronizado"

      }

    }

    # END OF SCRIPT

    --------------------------------------------------------------

    system>scheduler

    /system script run xDSL

  • Gomes, tentei aki mais não esta rodando, verifiquei nos logs do mikrotik que nao esta rodando, todas as policy ficam marcadas? aki estão todas marcadas. Pode ser alguma regra neste balance que nao esta deixando rodar o script?

  • # No-IP automatic Dynamic DNS update

    #--------------- Change Values in this section to match your setup ------------------

    # No-IP User account info
    :local noipuser "email"
    :local noippass "login"

    # Set the hostname or label of network to be updated.
    # Hostnames with spaces are unsupported. Replace the value in the quotations below with your host names.
    # To specify multiple hosts, separate them with commas.
    :local noiphost "ddns"

    # Change to the name of interface that gets the dynamic IP address
    :local inetinterface "interface"

    #------------------------------------------------------------------------------------
    # No more changes need

    :global previousIP

    :if ([/interface get $inetinterface value-name=running]) do={
    # Get the current IP on the interface
       :local currentIP [/ip address get [find interface="$inetinterface" disabled=no] address]

    # Strip the net mask off the IP address
       :for i from=( [:len $currentIP] - 1) to=0 do={
           :if ( [:pick $currentIP $i] = "/") do={
               :set currentIP [:pick $currentIP 0 $i]
           }
       }

       :if ($currentIP != $previousIP) do={
           :log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
           :set previousIP $currentIP

    # The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
           :local url "http://dynupdate.no-ip.com/nic/update\3Fmyip=$currentIP"
           :local noiphostarray
           :set noiphostarray [:toarray $noiphost]
           :foreach host in=$noiphostarray do={
               :log info "No-IP: Sending update for $host"
               /tool fetch url=($url . "&hostname=$host") user=$noipuser password=$noippass mode=http dst-path=("no-ip_ddns_update-" . $host . ".txt")
               :log info "No-IP: Host $host updated on No-IP with IP $currentIP"
           }
       }  else={
           :log info "No-IP: Previous IP $previousIP is equal to current IP, no update needed"
       }
    } else={
       :log info "No-IP: $inetinterface is not currently running, so therefore will not update."
    }

    -------------------------------------------------------------

    # Dynamic DNS Update / Simple Edition
    # Written by Sam Norris, ChangeIP.com
    # Copyright ChangeIP.com 2009-2010
    # For support send mail to Support@ChangeIP.com
    #
    # 2009-06-22 RouterOS 3.25 Tested
    # 2009-10-05 RouterOS 4.01rc1 Tested
    #
    # OVERVIEW:         %
    #  This script will update a ChangeIP.com dynamic dns hostname
    #  with an ip address located directly on an interface.
    #                   %
    # NOTES:            %
    #  IF THIS SCRIPT DOES NOT PRODUCE ANY OUTPUT PLEASE COPY AND PASTE IT
    #  AGAIN.  THERE PROBABLY IS A LINE BREAK IN THE WRONG PLACE! Once you
    #  have created this script and tested that it works by running it
    #  manually you can schedule it to run every few minutes.
    #                   %
    # CONFIGURATION FIELD DEFINITIONS:
    #  ddnsuser:  Enter your ChangeIP.com user id.
    #  ddnspass:  Enter your ChangeIP.com password.
    #  ddnshost:  Enter the hostname (www.example.com) to update.
    #  ddnsinterface:  Enter an interface name - case sensative.
    #                   %
    #                   %
    #                   %
    #                   %
    #               %   %   %
    #                %  %  %
    #                 % % %
    #                   %
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # EDIT YOUR DETAILS / CONFIGURATION HERE
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    :global ddnsuser "user name"
    :global ddnspass "login"
    :global ddnshost "ddns"
    :global ddnsinterface "pppoe-out1"
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    # END OF USER DEFINED CONFIGURATION
    # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :global ddnssystem ("mt-" . [/system package get [/system package find name=system] version] )
    :global ddnsip [ /ip address get [/ip address find interface=$ddnsinterface] address ]
    :global ddnslastip

    :if ([:len [/interface find name=$ddnsinterface]] = 0 ) do={ :log info "DDNS: No interface named $ddnsinterface, please check configuration." }

    :if ([ :typeof $ddnslastip ] = "nothing" ) do={ :global ddnslastip 0.0.0.0/0 }

    :if ([ :typeof $ddnsip ] = "nothing" ) do={

    :log info ("DDNS: No ip address present on " . $ddnsinterface . ", please check.")

    } else={

      :if ($ddnsip != $ddnslastip) do={

        :log info "Change IP: Sincronizando..."
        :log info [ :put [/tool dns-update name=$ddnshost address=[:pick $ddnsip 0 [:find $ddnsip "/"] ] key-name=$ddnsuser key=$ddnspass ] ]
        :global ddnslastip $ddnsip

      } else={

        :log info "Change IP:Sincronizado"

      }

    }

    # END OF SCRIPT

    --------------------------------------------------------------

    system>scheduler

    /system script run xDSL

This reply was deleted.