Skip to content

Instantly share code, notes, and snippets.

@slipeer
Last active March 29, 2021 07:45
Show Gist options
  • Save slipeer/263460ce38ee0c8e895d50d2527a50a6 to your computer and use it in GitHub Desktop.
Save slipeer/263460ce38ee0c8e895d50d2527a50a6 to your computer and use it in GitHub Desktop.
##############Script Settings##################
:local henetkey "XXXXXXXXXXXXXXXXXXXX"
:local henethost "XXXXXXXX.XX"
:local henameserver "ns1.he.net"
:local WANInter "wan"
###############################################
:local IpCurrent [/ip address get [find interface=$WANInter] address];
:for i from=( [:len $IpCurrent] - 1) to=0 do={
:if ( [:pick $IpCurrent $i] = "/") do={
:local NewIP [:pick $IpCurrent 0 $i];
:if ([:resolve $henethost server=$henameserver] != $NewIP) do={
/tool fetch mode=https url="https://dyn.dns.he.net/nic/update\3Fhostname=$henethost&password=$henetkey&myip=$NewIP"
:log info "HE DNS Update: $henethost - $NewIP
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment