Back to the roots, with a basic ADSL and dynamic IP… makes a 6to4 setup with HE.net a bit less straightforward.
Hopefully, the RouterOS on my Mikrotik RB750G shows some good scripting abilities.
Oh, quick and dirty, this is mainly a self-note to myself
please don’t kick me if it doesn’t work for you! Read more to get the script…# Ipv4 DDNS update on Hurricane DNS service with Tunnel endpoint changer!
# by JaXX.org
# Inspired by http://wiki.mikrotik.com/wiki/Dynamic_DNS_Update_Script_for_Hurricane_Electric_DNS
# the hostname concerned by the DDNS change
:local ddnshost4 "homeless.jaxx.org"
# you can create or generate a key from dns.he.net on the concerned entry in your zone
:local key4 "xyz123abc456xyz123"
:local updatehost "dyn.dns.he.net"
# the WAN interface you want the DDNS to point to
:local WAN4interface "pppoe-isp"
# IPv6 Tunnel info
:local ipv6apihost "ipv4.tunnelbroker.net"
# your tunnel id
:local ipv6tunnelID "123456"
# took me a minute to find that one on tunnelbroker.net :-)
:local ipv6apikey "def234abc567def1234421"
# echo -n Y0urP4ss | md5sum
:local ipv6md5pass "abc123def456abc123def"
# your ipv6 tunnel iface name, usually "sit1"
:local ipv6iface "sit1"
# never got that log to work actually, and i am lazy late at night
:local outputfile ("HE_ddnsV6.log")
:global previpv4;
:local ipv4addr
# Get WAN IP address
:set ipv4addr [/ip address get [/ip address find interface=$WAN4interface] address]
:set ipv4addr [:pick [:tostr $ipv4addr] 0 [:find [:tostr $ipv4addr] "/"]]
:if ([:len $ipv4addr] = 0) do={
:log error ("Could not get IPv4 for interface " . $WAN4interface)
:error ("Could not get IPv4 for interface " . $WAN4interface)
:set previpv4 ""
} else={
if ($previpv4 != $ipv4addr) do={
# IP has changed, wOOt ! do some stuff!
:log info ("Updating DDNS IPv4 address" . " Client IPv4 address to new IP " . $ipv4addr . "...")
/tool fetch url="http://$ddnshost4:$key4@$updatehost/nic/update?hostname=$ddnshost4&myip=$ipv4addr" dst-path=$outputfile
:log info ("Updating IPv6 tunnel endpoint with IPv4 address ...")
/tool fetch url="http://$ipv6apihost/ipv4_end.php?ip=$ipv4addr&pass=$ipv6md5pass&apikey=$ipv6apikey&tid=$ipv6tunnelID" dst-path=$outputfile
:log info ([/file get ($outputfile) contents])
/file remove ($outputfile)
:set previpv4 $ipv4addr
# My incoming NAT rules use dst-address-list
/ip firewall address-list remove [/ip firewall address-list find list=wanip]
/ip firewall address-list add list=wanip address=$ipv4addr
# finally, change the local-address of the HE 6to4 tunnnel interface
/interface 6to4 set ($ipv6iface) local-address=$ipv4addr
} else={
:log info ("IPv4 address hasn't changed: " . $ipv4addr . "...")
}
}