Keresés

Új hozzászólás Aktív témák

  • vargalex

    félisten

    válasz Zwodkassy #7213 üzenetére

    Szia!

    Végül nem checkip-s IP cím lekérdezéssel oldottam meg, de az sem lenne gond. Így a script a mikrotik saját ddns megoldásából veszi az IP címet (az úgyis jár a routerhez és az IP->Cloud alatt egyszerűen engedélyezhető). Gondolkodom még rajta, hogy berakom a script-be, hogy bizonyos időközönként force-olja az update-ot, de jelenleg ezt nem teszi. Ehhez még a global változóknak utána kellene néznem, mert azt még nem tudom, hogy azt hol lehetne inicializálni és a script-ben csak használni (ugye a script-ben nem inicializálhatom valamilyen értékkel, hiszen akkor ezt minden futtatáskor megtenné).
    Szóval, a jelenlegi script:

    ### ipdns.hu ddns update script for RouterOS ###
    ### Static parameters ###
    :local updateURL "http://update.ipdns.hu/update\?hostname="
    ##################
    ### Dynamic parameters ###
    :local registeredHostname "your ipdns host name"
    :local userName "ipdns username for hostname"
    :local password "ipdns password for hostname"
    ##################
    :local cloudStatus [/ip cloud get status]
    :if ( $cloudStatus = "updated" ) do={
        :local extIP [/ip cloud get public-address]
        :local registeredIP [:resolve $registeredHostname]
        :if ( $extIP != $registeredIP ) do={
            :log info "External IP ($extIP) address does not match the registered IP ($registeredIP)"
            :local updateAnswer [/tool fetch mode=http user=$userName password=$password url="$updateURL$registeredHostname" as-value output=user]
            :log info $updateAnswer
        } else={
            :log info "External IP address matches the registered IP"
        }
    } else={
        :log info "Cloud not updated"
    }

Új hozzászólás Aktív témák