I use he tunnel broker, and I try to run the script from link provied above.
I found something may wrong.
If I name 6to4 interface prefix with numbering, then error will show when I try to run command in terminal.
I rename interface to another name none prefix with number, It can run with no error.
I cannot set 6to4 Interface local-address with above link script.
I made a script that can do this. I know it works because I use it myself with current RouterOS version. It was a slightly modified version of one I found somewhere else, don’t remember where. I made the change so that if the IP hasn’t changed it doesn’t try to fetch the update again unnecessarily.
# Update Hurricane Electric IPv6 Tunnel Client IPv4 address
:local HEtunnelinterface "sit1"
# HE tunnel ID number, not name!
:local HEtunnelid "000000"
# tunnel userid number, not name!
:local HEuserid "1235735237501743215"
# tunnel md5-encrypted password!
:local HEmd5pass "1295ef19251ab92323fbd96"
:local HEupdatehost "ipv4.tunnelbroker.net"
:local HEupdatepath "/ipv4_end.php"
:local WANinterface "ether1"
:local outputfile ("HE-" . $HEtunnelid . ".txt")
# Internal processing below...
# ----------------------------------
:local HEipv4addr
# Get WAN interface IP address
:set HEipv4addr [/ip address get [/ip address find interface=$WANinterface] address]
:set HEipv4addr [:pick [:tostr $HEipv4addr] 0 [:find [:tostr $HEipv4addr] "/"]]
:if ([:len $HEipv4addr] = 0) do={
:log error ("Could not get IP for interface " . $WANinterface)
:error ("Could not get IP for interface " . $WANinterface)
}
# Update the HEtunnelinterface with WAN IP
/interface 6to4 {
:if ([get ($HEtunnelinterface) local-address] != $HEipv4addr) do={
:log info ("Updating " . $HEtunnelinterface . " local-address with new IP " . $HEipv4addr . "...")
set ($HEtunnelinterface) local-address=$HEipv4addr
:log info ("Updating IPv6 Tunnel " . $HEtunnelid . " Client IPv4 address to new IP " . $HEipv4addr . "...")
/tool fetch mode=http \
host=($HEupdatehost) \
url=("http://" . $HEupdatehost . $HEupdatepath . \
"?ip=" . $HEipv4addr . \
"&pass=" . $HEmd5pass . \
"&user_id=" . $HEuserid . \
"&tid=" . $HEtunnelid) \
dst-path=($outputfile)
:log info ([/file get ($outputfile) contents])
/file remove ($outputfile)
}
}