Ответы пользователя по тегу Сетевое администрирование
  • Как настроить маршрутизацию на microtik'е?

    А в качестве туннеля, по-моему, для вас лучше всего использовать IP-sec.
    Ответ написан
    Комментировать
  • DynDNS.com и mikrotik hex lite rb750r2 (ROS 6.30.2). какой скрипт взять, чтоб динамический IP-адрес прописывался на сервис при изменении?

    @volkrin Автор вопроса
    Решение найдено!!! Просто нужен был "правильный скрипт" в причины и нюансы не стал вдаваться - работает и хорошо! Вот работающий, если кто столкнётся с проблемой :
    # Based on a script found on the Internet.Will add attribution if I find it.
    # Changed 20150719 by Graeme Ruthven (graeme@kula.co.nz)
    # Modified to:
    # - update using authentication in URL as original method appeared to stop working.
    #   This was about the time of the RouterOS 6.30 release, but may be unrelated.
    # - Get the previous IP from the contents of the dyndns.txt file, as the global variable
    #   doesn't appear to persist.
    #
    # Reference: https://help.dyn.com/remote-access-api/perform-update/
    
    :local username "xxxx"
    :local password "xxxx"
    :local hostname "xxxx.dyndns.org"
    :local emailAddress "xxxxx@gmail.com"
    
    :local url "dummy"
    :local previousIP
    
    :global dyndnsForce
    
    :set dyndnsForce false
    
    :log info ("UpdateDynDNS starts.")
    
    # print some debug info
    #:log info ("UpdateDynDNS: username = $username")
    #:log info ("UpdateDynDNS: password = $password")
    #:log info ("UpdateDynDNS: hostname = $hostname")
    #:log info ("UpdateDynDNS: previousIP = $previousIP")
    
    # I have some doubt over the persistence of the global previousIP.
    # This value should be stored in /dyndns.txt after the last update attempt,
    # preceded by the status and a space.
    # For status values see: https://help.dyn.com/remote-access-api/return-codes/
    
    :if ([:len [/file find name=dyndns.txt]] > 0) do={
       :local ipfile [/file get dyndns.txt contents]
       :local ipstart ([find $ipfile " " -1] + 1)
       :local ipend [:len $ipfile]
       :set previousIP [:pick $ipfile $ipstart $ipend]
    } else={
       :set previousIP "0.0.0.0"
    }
    
    # get the current IP address from the internet (in case of double-nat)
    /tool fetch mode=http address="checkip.dyn.com" src-path="/" dst-path="/dyndns.checkip.html"
    :delay 1
    :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]
    
    # 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={
       :log info ("Changing IP from $previousIP to $currentIP.")
       :set dyndnsForce false
       :set url "http://$username:$password@members.dyndns.org/nic/update?hostname=$hostname&myip=$currentIP&wildcard=no"
       /tool fetch url=$url mode=http dst-path="/dyndns.txt"
      
    # Original code:
    #   /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"
    
       :delay 1
    
     #  :set previousIP $currentIP
    
       :local result [/file get dyndns.txt contents]
       :log info ("UpdateDynDNS: Dyndns update needed")
       :log info ("UpdateDynDNS: Dyndns Update Result: ".$result)
    
    # email result:
       :local output "DynDNS Update Result: $result"
    } else={
       :log info ("UpdateDynDNS: No dyndns update needed")
    }

    а вот ссылка: forum.mikrotik.com/viewtopic.php?t=98426
    Ответ написан
    Комментировать