Page 1 of 1

MikrotTik

Posted: Tue 31. Dec 2019, 10:00
by EvilMoe
Moin zusammen!

Gibts auch ein funktionierendes Script für Mikrotik?
Das im Download Bereich ist leider nur für ipv4.

LG und guten Rutsch!

Re: MikrotTik

Posted: Fri 3. Jan 2020, 11:20
by AndreRose
bitte in der Zeile:
:local IpCurrent [/ip address get [find interface=$WANInter] address];

aus /ip ein /ipv6 machen dann funktioniert es

:local IpCurrent [/ipv6 address get [find interface=$WANInter] address];

Re: MikrotTik

Posted: Fri 3. Jan 2020, 19:28
by EvilMoe
Leider nein. Auf die Idee kam ich auch:

[Sven@router] > :pick [/ipv6 address get [find interface=$WANInter] address];
no such item

find scheint nicht mit IPV6 zu funktionieren. Ich umgehe das Problem aktuell, indem ich die ID direkt angebe. Trotzdem ist es nicht schön.

Re: MikrotTik

Posted: Sat 11. Jan 2020, 11:21
by Ch-MG
Hallo,

ich habe folgendes Script bei mir laufen.

Code: Select all

# Set needed variables
:local username "123456"
:local password "abcdefg"
:local hostname "hostname.feste-ip.net"
:local ipv6pool "DHCPv6-Pool"

# temp variables
:global dyndnsForce
:global previousIP

# print some debug info 
:log debug ("Update Feste-IP.net: username = $username")
:log debug ("Update Feste-IP.net: hostname = $hostname")
:log debug ("Update Feste-IP.net: previousIP = $previousIP")

# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http url=("http://v6.checkip.feste-ip.net/") 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 debug ("Update Feste-IP.net: currentIP = $currentIP")

# Determine if dyndns update is needed
:if (($currentIP != $previousIP) || ($dyndnsForce = true)) do={
    :set dyndnsForce false
    :set previousIP $currentIP
    :local subnet [/ipv6 pool used get [ find pool=$ipv6pool ] prefix]
    /tool fetch user=$username password=$password mode=http url=("http://members.feste-ip.net/nic/update?system=dyndns&hostname=".$hostname."&myip=".$currentIP."&subhostprefix=".$subnet) dst-path="/dyndns.txt"
    :local result [/file get dyndns.txt contents]
    :log info ("Update Feste-IP.net: Dyndns update needed")
    :log info ("Update Feste-IP.net: Dyndns Update Result: ".$result)
    :put ("Dyndns Update Result: ".$result)
} else={
    :log debug ("Update Feste-IP.net: No dyndns update needed")
}
Das Script ist noch nicht ganz fertig.
Ich plane noch die IPv4 IP bei DualStack Anschlüssen zu updaten.