Olá Amigos.... Será que tem como fazer com que o scrip para atualizar o ip para dyndns rode automáticamente após o Mikrotik ser reinciado.... O meu script esta funcioando normalmente mas quando reinicio o mikrotik tenho que entrar lá e mandar iniciar o script noavamente....
Para adicionar comentários, você deve ser membro de MK-AUTH.
Respostas
cara tu criou o script certto agora vai em shedule e poem
add comment="Dns para acesso externo" disabled=no interval=2m name=DDNS \
on-event=AQUI VOCE POEM O NOME DO SEU SCRIPT policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
start-date=jan/01/1970 start-time=00:00:00
Vlw... Agora percebi um problema no meu escript.... tem momento que ele não atualiza o ip... segue abiaxo o meu escript.:
Onde estar o erro será?
# Define User Variables
:global ddnsuser "MEU USUARIO DYNDNS"
:global ddnspass "MINHA SENHA"
:global ddnshost "MEU HOST DYNDNS.ORG"
:global ddnsinterface "ADSL" (acho que o erro esta aqui)
# 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
}
}
Cara vou te passar meu script completo
/system script
add name=ddns policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
:log info \"DDNS: Begin\"\r\
\n\r\
\n:global ddns-user SEU NOME DE USUSARIO\r\
\n:global ddns-pass SUA SENHA\r\
\n:global ddns-host http://SEU DOMINIO MANTENDO ESSE HTTP\r\
\n:global ddns-interface SUA INTERFACE DE ENTRADA SE FOR ADSL POR PPPOE USE O NOME DO PPPOE SE FOR ROTEADO O NOME DA INTERFACE DE REDE\r\
\n\r\
\n:global ddns-ip [ /ip address get [/ip address find interface=\$ddns-int\
erface] address ]\r\
\n\r\
\n:if ([ :typeof \$ddns-lastip ] = nil ) do={ :global ddns-lastip 0.0.0.0/\
0 }\r\
\n\r\
\n:if ([ :typeof \$ddns-ip ] = nil ) do={\r\
\n\r\
\n :log info (\"DDNS: No ip address present on \" . \$ddns-interface . \"\
, please check.\")\r\
\n\r\
\n} else={\r\
\n\r\
\n :if (\$ddns-ip != \$ddns-lastip) do={\r\
\n\r\
\n :log info \"DDNS: Sending UPDATE!\"\r\
\n :log info [ /tool dns-update name=\$ddns-host address=[:pick \$ddns-\
ip 0 [:find \$ddns-ip \"/\"] ] key-name=\$ddns-user key=\$ddns-pass ]\r\
\n :global ddns-lastip \$ddns-ip\r\
\n\r\
\n } else={ \r\
\n\r\
\n :log info \"DDNS: No change\" \r\
\n\r\
\n }\r\
\n\r\
\n}\r\
\n\r\
\n:log info \"DDNS: End\""
/system scheduler
add comment="Dns para acesso externo" disabled=no interval=2m name=DDNS \
on-event=ddns policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
start-date=jan/01/1970 start-time=00:00:00
so coloque o nome de usuario senha seu dominio nome da interface de entrada do link se for adsl o nome do pppoe ou se for roteado o seu modem o nome do da interface de link pronto cole no new terminal que funcionara
Não estar funcionado
não atualiza no dyndns
marco aurelio da silva braga disse:
Acabei de tentar com change ip mas também não deu certo
Resolvido!!!!!
O scrip que funcionou foi o seguinte
# 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 "YourChangeIPUserID"
:global ddnspass "PASSWORD"
:global ddnshost "MyRouterHostname.example.org"
:global ddnsinterface "ether1"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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 "DDNS: Sending UPDATE!"
: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 "DDNS: No changes necessary."
}
}
# END OF SCRIPT
add comment="Dns para acesso externo" disabled=no interval=2m name=DDNS \
on-event=AQUI VOCE POEM O NOME DO SEU SCRIPT policy=\
ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive \
start-date=jan/01/1970 start-time=00:00:00