Community discussions

MikroTik App
 
soydekra
just joined
Topic Author
Posts: 13
Joined: Fri Jan 06, 2017 9:03 pm

Script for ipip tunnel in v.7.1

Wed Dec 15, 2021 12:34 pm

Hi! I use this script for a ipip tunnel in a 6.49.2 version for update the DDNS, because i have in both sites dynamic public IP . Someone knows if it will work with the new version 7.1? Thank you!

local LocalAddr "XXXXXXXXXXXXX.sn.mynetname.net"
:local RemoteAddr "ZZZZZZZZZZZZZ.sn.mynetname.net"
:local CommentIDF "tunnel1"

##########################################

:local NewLocalAddr [:resolve $LocalAddr]
:local NewRemoteAddr [:resolve $RemoteAddr]

:local OldLocalAddr [/interface ipip get [find comment=$CommentIDF ] local-address]
:local OldRemoteAddr [/interface ipip get [find comment=$CommentIDF ] remote-address]

if ($NewLocalAddr != $OldLocalAddr) do={
/interface ipip set [find comment=$CommentIDF] local-address=$NewLocalAddr
/log info "Local tunnel IP for $CommentIDF has changed from $OldLocalAddr to $NewLocalAddr"
}

if ($NewRemoteAddr != $OldRemoteAddr) do={
/interface ipip set [find comment=$CommentIDF] remote-address=$NewRemoteAddr
/log info "Remote tunnel IP for $CommentIDF has changed from $OldRemoteAddr to $NewRemoteAddr"
}

Who is online

Users browsing this forum: derolf, GoogleOther [Bot], K0NCTANT1N, nizce, tdw, uamma and 59 guests