:local tunnellastip [ / interface 6to4 get [ / interface 6to4 find where name=$tunnelint ] local-address ];
# Get the current ip address on interface with default route
:local tunnelip [ / ip route get [ / ip route find where gateway=[ / ip route get [ / ip route find where dynamic=yes and dst-address="0.0.0.0/0" dynamic active=yes ] gateway ] dst-address!="0.0.0.0/0" ] pref-src ];
# Did we get an IP address to compare?
:if ([ :typeof $tunnelip ] = nil) do={
:log warning ("No default route? Could not get address, please check.");
} else={
:if ($tunnelip != $tunnellastip) do={
:log info ("Local address changed, sending UPDATE to tunnelbroker! New address: " . $tunnelip);