❗️Toto je původní verze internetového fóra ISPforum.cz do února 2020 bez možnosti registrace nových uživatelů. Aktivní verzi fóra naleznete na adrese https://telekomunikace.cz

Jak na MK dydns

Návody a problémy s konfigurací.
Uživatelský avatar
lukasdj
Příspěvky: 135
Registrován: 17 years ago
antispam: Ano
Kontaktovat uživatele:

Jak na MK dydns

Příspěvekod lukasdj » 14 years ago

Caves, hledal sem tu na foru a nasel sem par scriptu na kterych by melo slapat DYDNS ale nic nejede. Mate prosim nejaky FUNKCNI script se kterym by mohl MK fungovat??? Dikes Lukas
0 x

jany
Příspěvky: 319
Registrován: 18 years ago
Kontaktovat uživatele:

Příspěvekod jany » 14 years ago

Neviem ci to bude slapat konkretne s dyndns.com
Ale urcite to slape ak si domenu zaregistrujes na http://www.changeip.com/

Kód: Vybrat vše

# Define User Variables
:global ddnsuser "uzivatelske_meno"
:global ddnspass "heslo"
:global ddnshost "nazov_tvojej_domeny.com"

# 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]
#  }
#}

:global ddnsinterface "pppoe-out1"


# 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 ("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 update required."
  }

}

# End of script
0 x

wasill
Příspěvky: 46
Registrován: 17 years ago

Příspěvekod wasill » 14 years ago

důležité je, jakou tam máš verzi RouterOS. Na 2.9.5.1(51) mi to nikdy nefungovalo, na novějším (3.1 a dál) v pohodě a to snad všechny, co jsem na fórech našel :D . Co tam máš?
0 x

Uživatelský avatar
lukasdj
Příspěvky: 135
Registrován: 17 years ago
antispam: Ano
Kontaktovat uživatele:

Příspěvekod lukasdj » 14 years ago

wasill píše:důležité je, jakou tam máš verzi RouterOS. Na 2.9.5.1(51) mi to nikdy nefungovalo, na novějším (3.1 a dál) v pohodě a to snad všechny, co jsem na fórech našel :D . Co tam máš?



Mam tam nejnovejsi tj. 5.6
0 x

wasill
Příspěvky: 46
Registrován: 17 years ago

Příspěvekod wasill » 14 years ago

spusť si log. když dáš run script hne se log? pokud ne, něco je špatně :)
Mě bezvadně funguje (5.0RC5) tenhle, do udaju si doplnis jmeno, heslo a domenu, kterou sis na dyndns vybral.. a je to

Kód: Vybrat vše

# Set needed variables
:local username "jmeno"
:local password "heslo"
:local hostname "jmeno.dyndns.info"
:global systemname [/system identity get name]

:if ($systemname  = "Site1" ) do= {
:set hostname "yourdomain1.dyndns.org"
}
:if ($systemname  = "Site2" ) do= {
:set hostname "yourdomain2.dyndns.org"
}
:if ($systemname  = "Site3" ) do= {
:set hostname "yourdomain3.dyndns.org"
}

:global dyndnsForce
:global previousIP

# print some debug info
:log info ("UpdateDynDNS: username = $username")
:log info ("UpdateDynDNS: password = $password")
:log info ("UpdateDynDNS: hostname = $hostname")
:log info ("UpdateDynDNS: previousIP = $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]
:local currentIP [:pick $result $startLoc $endLoc]
:log info "UpdateDynDNS: 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 DynDNS!

#:set dyndnsForce true

# Determine if dyndns update is needed
# more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
    :set dyndnsForce false
    :set previousIP $currentIP
    /tool fetch user=$username password=$password mode=http address="members.dyndns.org" \
       src-path="/nic/update?hostname=$hostname&myip=$currentIP" dst-path="/dyndns.txt"
    :local result [/file get dyndns.txt contents]
    :log info ("UpdateDynDNS: Dyndns update needed")
    :log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
    :put ("Dyndns Update Result: ".$result)
} else={
    :log info ("UpdateDynDNS: No dyndns update needed")
}
Naposledy upravil(a) wasill dne 09 Sep 2011 09:34, celkem upraveno 1 x.
0 x

wasill
Příspěvky: 46
Registrován: 17 years ago

Příspěvekod wasill » 14 years ago

na dyndns jsem si nastavil schválně jinou IP a po spuštění ti v logu vyloguje něco takového

Kód: Vybrat vše

09:23:25 system,info new script added by admin
09:23:32 system,info,account user admin logged in from 192.168.1.4 via telnet
09:25:27 system,info changed script settings by admin
09:25:28 script,info UpdateDynDNS: username = jmeno
09:25:28 script,info UpdateDynDNS: password = heslo
09:25:28 script,info UpdateDynDNS: hostname = jmeno.dyndns.info
09:25:28 script,info UpdateDynDNS: previousIP = 
09:25:29 info fetch: file "dyndns.checkip.html" created
09:25:30 script,info UpdateDynDNS: currentIP = 109.xxx.xx.xxx
09:25:30 info fetch: file "dyndns.txt" created
09:25:31 script,info UpdateDynDNS: Dyndns update needed
09:25:31 script,info UpdateDynDNS: Dyndns Update Result: good 109.xxx.xx.xx

a teď, když spustím znovu a IP je stejná, tak script nic nemění a vypíše

Kód: Vybrat vše

09:29:06 script,info UpdateDynDNS: username = jmeno
09:29:06 script,info UpdateDynDNS: password = heslo
09:29:06 script,info UpdateDynDNS: hostname = jmeno.dyndns.info
09:29:06 script,info UpdateDynDNS: previousIP = 109.xxx.xx.xx
09:29:06 info fetch: file "dyndns.checkip.html" created
09:29:07 script,info UpdateDynDNS: currentIP = 109.xxx.xx.xx
09:29:07 script,info UpdateDynDNS: No dyndns update needed

0 x

Uživatelský avatar
lukasdj
Příspěvky: 135
Registrován: 17 years ago
antispam: Ano
Kontaktovat uživatele:

Příspěvekod lukasdj » 14 years ago

wasill píše:na dyndns jsem si nastavil schválně jinou IP a po spuštění ti v logu vyloguje něco takového

Kód: Vybrat vše

09:23:25 system,info new script added by admin
09:23:32 system,info,account user admin logged in from 192.168.1.4 via telnet
09:25:27 system,info changed script settings by admin
09:25:28 script,info UpdateDynDNS: username = jmeno
09:25:28 script,info UpdateDynDNS: password = heslo
09:25:28 script,info UpdateDynDNS: hostname = jmeno.dyndns.info
09:25:28 script,info UpdateDynDNS: previousIP = 
09:25:29 info fetch: file "dyndns.checkip.html" created
09:25:30 script,info UpdateDynDNS: currentIP = 109.xxx.xx.xxx
09:25:30 info fetch: file "dyndns.txt" created
09:25:31 script,info UpdateDynDNS: Dyndns update needed
09:25:31 script,info UpdateDynDNS: Dyndns Update Result: good 109.xxx.xx.xx

a teď, když spustím znovu a IP je stejná, tak script nic nemění a vypíše

Kód: Vybrat vše

09:29:06 script,info UpdateDynDNS: username = jmeno
09:29:06 script,info UpdateDynDNS: password = heslo
09:29:06 script,info UpdateDynDNS: hostname = jmeno.dyndns.info
09:29:06 script,info UpdateDynDNS: previousIP = 109.xxx.xx.xx
09:29:06 info fetch: file "dyndns.checkip.html" created
09:29:07 script,info UpdateDynDNS: currentIP = 109.xxx.xx.xx
09:29:07 script,info UpdateDynDNS: No dyndns update needed



diky za rady. Uz to vesele bezi! Diky

0 x