返回列表 發帖
我用這個的。
  1. # Set needed variables
  2. :local username "ddns_username"
  3. :local password "ddns_password"
  4. :local hostname "ddyns.hostname"

  5. :global dyndnsForce
  6. :global previousIP

  7. # print some debug info
  8. :log info ("UpdateDynDNS: username = $username")
  9. :log info ("UpdateDynDNS: password = $password")
  10. :log info ("UpdateDynDNS: hostname = $hostname")
  11. :log info ("UpdateDynDNS: previousIP = $previousIP")

  12. # get the current IP address from the internet (in case of double-nat)
  13. /tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html"
  14. :delay 1
  15. :local result [/file get dyndns.checkip.html contents]

  16. # parse the current IP result
  17. :local resultLen [:len $result]
  18. :local startLoc [:find $result ": " -1]
  19. :set startLoc ($startLoc + 2)
  20. :local endLoc [:find $result "</body>" -1]
  21. :local currentIP [:pick $result $startLoc $endLoc]
  22. :log info "UpdateDynDNS: currentIP = $currentIP"

  23. # Remove the # on next line to force an update every single time - useful for debugging,
  24. # but you could end up getting blacklisted by DynDNS!

  25. #:set dyndnsForce true

  26. # Determine if dyndns update is needed
  27. # more dyndns updater request details http://www.dyndns.com/developers/specs/syntax.html

  28. :if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
  29.    :set dyndnsForce false
  30.    :set previousIP $currentIP
  31.    :log info "$currentIP or $previousIP"
  32.    /tool fetch user=$username password=$password mode=http address="members.dyndns.org" \
  33.       src-path="nic/update?system=dyndns&hostname=$hostname&myip=$currentIP&wildcard=no" \
  34.       dst-path="/dyndns.txt"
  35.    :delay 1
  36.    :local result [/file get dyndns.txt contents]
  37.    :log info ("UpdateDynDNS: Dyndns update needed")
  38.    :log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
  39.    :put ("Dyndns Update Result: ".$result)
  40. } else={
  41.    :log info ("UpdateDynDNS: No dyndns update needed")
  42. }
複製代碼

TOP

不知是否RouterOS 本身的問題,DDNS update 後,雖然見到新IP資料,但我差不多等了15分鐘左右,才能使用解決NAT loopback 問題,即是從local network,在Browser 內直接打 DDNS_Hostname 進入自己網內的NAS 資源。

感覺上RouterOS 的Update 沒有像一般Router一樣能即時反影新的設定。

TOP

但用SSL 方式,https://XXX.XXX.XXX:443 就可以馬上進入NAS 的資源,真不明所以。
而普通用 http://xxx.xxx.xxx:8080 用了一會又很容易斷掉 connection.。

TOP

假如是Dual Wan or Multiple Wan,如何把不同IP update 指向同一位址呢?

TOP

返回列表