baxim69 Posted August 3, 2013 Posted August 3, 2013 Не обновляется ip адрес в новой прошивке MikrotikOS v6.2 Скрипт: # ????????? ??????????? ? NO-IP.com :local ddnsuser "****" :local ddnspass "****" :local ddnshostname "****" :local ddnsinterface "*****" # ???????? ?????????? ?????????? :global ddnslastip :local str :local ddnsip :local ip :if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" } :local ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ] :if ([ :typeof $ddnsip ] = nil ) do={ :log info ("ServiceDNS: No ip address on $ddnsinterface .") } else={ # ?? ??????????? ?? ?????????? IP ?????? ????????? ????? :for i from=( [:len $ddnsip] - 1) to=0 do={ :if ( [:pick $ddnsip $i] = "/") do={ :set ddnsip [:pick $ddnsip 0 $i]; } } :if ($ddnsip != $ddnslastip) do={ :log info ("ServiceDNS: $ddnshostname -> $ddnsip") # ?????????? ????? IP ????? ?? ?????? No-IP ? ??????? HTTP ??????? :local str "/nic/update?hostname=$ddnshostname&myip=$ddnsip" /tool fetch url="http://dynupdate.no-ip.com/$str" mode=http user=$ddnsuser password=$ddnspass \ dst-path=("/ServiceDNS.".$ddnshostname) :delay 1 # ????????? ?????????? ? ??? ?????? :local str [/file find name="ServiceDNS.$ddnshostname"]; :log info [/file get $str contents]; /file remove $str :global ddnslastip $ddnsip } } При вводе в терминале system script environment print, выдает такое сообщение: # NAME VALUE 0 NL \r\n 1 addConfLine (code) 2 addDescLine (code) 3 secKey 3B0202**** 4 strConf :global action;\r\n:local dhcpEnabled 0;\r\n:local wirelessEnabled 0;\r\n\r\n#... 5 strConfLine } 6 strDesc #| \r\n#| WAN (gateway) Configuration:\r\n#| \tgateway:\tether1 (renamed with... 7 strDescLine #| \tDHCP Server:\tenabled; Кто сталкивался? Вставить ник Quote
RDEM Posted August 3, 2013 Posted August 3, 2013 этот не поможет? http://forum.mikrotik.com/viewtopic.php?f=9&t=34575&start=100#p363015 Вставить ник Quote
baxim69 Posted August 3, 2013 Author Posted August 3, 2013 этот не поможет? http://forum.mikrotik.com/viewtopic.php?f=9&t=34575&start=100#p363015 нет, не помогает :( Вставить ник Quote
SSD Posted August 3, 2013 Posted August 3, 2013 Не обновляется ip адрес в новой прошивке MikrotikOS v6.2 Скрипт: # ????????? ??????????? ? NO-IP.com :local ddnsuser "****" :local ddnspass "****" :local ddnshostname "****" :local ddnsinterface "*****" # ???????? ?????????? ?????????? :global ddnslastip :local str :local ddnsip :local ip :if ([ :typeof $ddnslastip ] = nil ) do={ :global ddnslastip "0" } :local ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ] :if ([ :typeof $ddnsip ] = nil ) do={ :log info ("ServiceDNS: No ip address on $ddnsinterface .") } else={ # ?? ??????????? ?? ?????????? IP ?????? ????????? ????? :for i from=( [:len $ddnsip] - 1) to=0 do={ :if ( [:pick $ddnsip $i] = "/") do={ :set ddnsip [:pick $ddnsip 0 $i]; } } :if ($ddnsip != $ddnslastip) do={ :log info ("ServiceDNS: $ddnshostname -> $ddnsip") # ?????????? ????? IP ????? ?? ?????? No-IP ? ??????? HTTP ??????? :local str "/nic/update?hostname=$ddnshostname&myip=$ddnsip" /tool fetch url="http://dynupdate.no-ip.com/$str" mode=http user=$ddnsuser password=$ddnspass \ dst-path=("/ServiceDNS.".$ddnshostname) :delay 1 # ????????? ?????????? ? ??? ?????? :local str [/file find name="ServiceDNS.$ddnshostname"]; :log info [/file get $str contents]; /file remove $str :global ddnslastip $ddnsip } } При вводе в терминале system script environment print, выдает такое сообщение: # NAME VALUE 0 NL \r\n 1 addConfLine (code) 2 addDescLine (code) 3 secKey 3B0202**** 4 strConf :global action;\r\n:local dhcpEnabled 0;\r\n:local wirelessEnabled 0;\r\n\r\n#... 5 strConfLine } 6 strDesc #| \r\n#| WAN (gateway) Configuration:\r\n#| \tgateway:\tether1 (renamed with... 7 strDescLine #| \tDHCP Server:\tenabled; Кто сталкивался? Видимо МТ в очередной раз напорол косяков. Нужны скрипты, откатывайтесь на старые версии. Вставить ник Quote
a3lex Posted August 3, 2013 Posted August 3, 2013 у меня на 6.1 с no-ip вот такой работает. Только локал интерфейс свой выставь, может отличаться. # No-IP automatic Dynamic DNS update #--------------- Change Values in this section to match your setup ------------------ # No-IP User account info :local noipuser "xxxxx" :local noippass "xxxxx" # 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 "xxxx.no-ip.org" # Change to the name of interface that gets the dynamic IP address :local inetinterface "ether1-gateway" #------------------------------------------------------------------------------------ # 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." } Вставить ник Quote
Faust_nv Posted August 4, 2013 Posted August 4, 2013 Пробовал кто-нибудь на 6.2 этот скрипт? Вставить ник Quote
Sashaa Posted August 16, 2013 Posted August 16, 2013 на 6.2 работает :local ddnsuser ".........." :local ddnspass ".........." :local ddnshostname ".........." :local ddnsinterface "..........." :local str :local ddnsip :local ddnsip [ /ip address get [/ip address find interface=$ddnsinterface ] address ] :for i from=( [:len $ddnsip] - 1) to=0 do={ :if ( [:pick $ddnsip $i] = "/") do={ :set ddnsip [:pick $ddnsip 0 $i]; } } :log info ("ServiceDNS: $ddnshostname -> $ddnsip") :set str "/nic/update?hostname=$ddnshostname&myip=$ddnsip" /tool fetch user=$ddnsuser password=$ddnspass url="http://dynupdate.no-ip.com/$str" \ dst-path=("/ServiceDNS.".$ddnshostname) :delay 1 :log info ("response on get url from ip: $ddnsip") :local str [/file find name=ServiceDNS.$ddnshostname]; :log info [/file get $str contents]; /file remove $str Вставить ник Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.