I have used No-Ip (Maybe 10 years now). It is a Dynamic DNS service like DyDNS etc. It is good but it is limited how many clients you can have much like all others. So I have toyed with setting up something myself as I have a public Linux DNS server to receive the updated IP info. After trying a few methods that had varying success, I concluded that the following was the best method. DOMAIN would equal a domain name you have set aside for this purose.
FILE="DOMAIN-ip" curl ifconfig.me/ip -o "$FILE" &>/dev/null scp -q "$FILE" dward.name: exit 0
allow-update { localhost;};
Restart bind9
PHY="$(cat DOMAIN-ip)"
TEMP="$(/bin/mktemp)"
CMDS="$(/bin/mktemp)"
CUR="$(host -t A DOMAIN localhost |grep DOMAIN|cut -d' ' -f4)"
if [ ! "$CUR" == "$PHY" ]
then
TIME="$(date +%s)"
cat > $CMDS <<EOF
update delete DOMAIN A
update add DOMAIN 1800 A $PHY
send
EOF
/usr/bin/nsupdate $CMDS
rm -f $CMDS
rm -f $TEMP
fi
Edit anything there to your needs of course.
References: https://www.debian-administration.org/users/JulienV/weblog/4
http://www.shakabuku.org/writing/dyndns.html