Скрипт для DynDNS.com
Работает на версиях (в теории)
2.xx
3.xx
4.xx
5.xx
 
Тестировался на версиях
3.30

 

Выкладываю скрипт для использования DDNS сервиса на DynDNS.com

Описание переменных:

hostname - DNS имя которое будет меняться на сервере.
username - Логин в системе ChangeIP.
password - Пароль в системе ChangeIP.

 

 

# Set needed variables
:local username "name"
:local password "pass"
:local hostname "user.homeftp.net" #or other in dyndns.com

:global dyndnsForce
:global previousIP

# print some debug info
#:log info ("dyndns-update: username = $username")
#:log info ("dyndns-update: password = $password")
#:log info ("dyndns-update: hostname = $hostname")
#:log info ("dyndns-update: 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 "dyndns-update: currentIP = $currentIP"

# Determine if dyndns update is needed
# more dyndns updater request details available at 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 ("dyndns-update: Dyndns update needed")
# :log info ("dyndns-update: Dyndns Update Result: ".$result)
:put ("Dyndns Update Result: ".$result)
} else={
# :log info ("dyndns-update: No dyndns update needed")
}

 

 

Скрипт прислан посетителем нашего сайта, по имени Валерий, за что ему огромное спасибо!

 

 

 

 

 

 

 

 





Рейтинг@Mail.ru
Яндекс цитирования

Григорьев Дмитрий Владимирович (Inlarion) 2010-2016 (C) Все права защищены. При копировании материалов с сайта, ссылка на автора и источник обязательны!!!