nsupdate is a command line too that comes with ISC’s DNS server BIND. It can update RRs and more on your DNS server. Authentication is done with a key file.
First create keys using
dnssec-keygen -r /dev/urandom -a HMAC-MD5 -b 512 -n HOST sub.dyn.example.com.
then the tool nsupdate to remotely update the nameserver:
IPV6="2001:db8::dead:beaf"
#IPV4="192.168.0.2"
IPV4=$(curl -s "http://v4.ipv6-test.com/api/myip.php")
#IPV6="2001:db8::dead:beaf"
IPV6=$(curl -s 'http://v6.ipv6-test.com/api/myip.php')
KEY=/home/philipp/Kmyhost.dyn.example.com.+157+22656.key
NS=ns2.example.com
DOMAIN=myhost.dyn.example.com.
ZONE=dyn.example.com.
nsupdate -k $KEY -v << EOF
server $NS
zone $ZONE
update delete $DOMAIN A
update delete $DOMAIN AAAA
update add $DOMAIN 30 A $IPV4
update add $DOMAIN 30 AAAA $IPV6
show
send
EOF
Python Alternatives for nsupdate
Here is the script I came up with:


