Jump to content
  • 0

Скрипт за DDNS работещ на версия 3.30 на версия 5.6 не ще...


plamenVd

Question

Привет на всички!

Някой може ли да каже защо този скрипт не работи на версия 5.6(и да помогне с модифицирането му) при условие че го ползвам на 3.30 и работи безупречно.

Благодаря на всички отзовали се.


# Define User Variables

:global ddnsuser "user"

:global ddnspass "pass"

:global ddnshost "host"

# 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 ("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

Учи се от грешките на другите. Няма да живееш толкова дълго, че да ги направиш сам всичките.

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
  • Administrator

http://wiki.mikrotik.com/wiki/DDNS

малко четене

после пусни разширено логване

или четеш внимателно тук

http://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_dynDNS

Харесай поста ^^^
acer.gif htc.gifsigpic4024_2.gif

Форумът е за взаимопомощ а не за свършване на чужда работа


ɹɐǝɥ uɐɔ noʎ ǝɹoɯ ǝɥʇ 'ǝɯoɔǝq noʎ ɹǝʇǝınb ǝɥʇ

Link to comment
Share on other sites

  • 0

Благодаря....Много ми помогна.

Вторият линк съм го чел и доста го мъчих, но dyndns.com така и не успях да го подкарам дори и на 3.30 версия.С рутер дето е с 3.30версия съм си качил въпросният скрипт който е безупречен с changeIP.com, но 5.6 версия(рб750)не кракната не иска.Не разбрах какво имаш в предвид с разширено логване.

Edited by plamenVd

Учи се от грешките на другите. Няма да живееш толкова дълго, че да ги направиш сам всичките.

Link to comment
Share on other sites

  • 0
  • Administrator

втория линк най-долу има за 5,х

или директно тук

http://www.changeip.com/mikrotik/




/system logging
add action=memory disabled=no prefix="" topics=script,debug[/CODE]

Харесай поста ^^^
acer.gif htc.gifsigpic4024_2.gif

Форумът е за взаимопомощ а не за свършване на чужда работа


ɹɐǝɥ uɐɔ noʎ ǝɹoɯ ǝɥʇ 'ǝɯoɔǝq noʎ ɹǝʇǝınb ǝɥʇ

Link to comment
Share on other sites

  • 0

Привет на всички!

Как си реших проблема-оказа се че има значение и какъв е изходящият ти интерфейс-дали е рррое или работи през NAT.Това е работещ скрипт за mk 5.6 за dyndnds.com през NAT с него тръгна борда.


# Set needed variables

:local username "user"

:local password "pass"

:local hostname "host"

: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

   :log info "$currentIP or $previousIP"

   /tool fetch user=$username password=$password mode=http address="members.dyndns.org" \

	  src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no" \

	  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")

}

Учи се от грешките на другите. Няма да живееш толкова дълго, че да ги направиш сам всичките.

Link to comment
Share on other sites

  • 0
  • Administrator

нормално е ако си давал частен адрес да не работи

Харесай поста ^^^
acer.gif htc.gifsigpic4024_2.gif

Форумът е за взаимопомощ а не за свършване на чужда работа


ɹɐǝɥ uɐɔ noʎ ǝɹoɯ ǝɥʇ 'ǝɯoɔǝq noʎ ɹǝʇǝınb ǝɥʇ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.