Homebrew Dynamic DNS

Warning: Incomplete HowTo at this point

On the client host

  apk add bind-tools
  mkdir /etc/nsupdate
  cd /etc/nsupdate
  tsig-keygen -a hmac-sha512 your-domain-name.tld.key > your-domain-name.tld.key
  chmod go-rwx your-domain-name.tld.key

Copy your-domain-name.tld.key to the name server host. In my config, bind is keeping key and zone data under /var/bind, so I put the key file in /var/bind/keys

If not already done so, configure the host to use dhcpcd to configure its network interface. Then create /etc/dhcpcd.enter-hook with the following contents:

  if [ "$reason" = "BOUND6" ]
then
	cat << EOF | nsupdate -k /etc/nsupdate/your-domain-name.tld.secret /dev/stdin 2>&1 | logger -t "dhcp6-nsupdate"
server ns1.your-domain-name.tld
zone your-domain-name.tld
update delete your-domain-name.tld. 60 AAAA
update add your-domain-name.tld. 60 AAAA ${new_dhcp6_ia_na1_ia_addr1}
show
send
EOF
elif [ "$reason" = "BOUND" ]
then
	cat << EOF | nsupdate -k /etc/nsupdate/your-domain-name.tld.secret /dev/stdin 2>&1 | logger -t "dhcp4-nsupdate"
server ns1.your-domain-name.tld
zone your-domain-name.tld
update delete your-domain-name.tld. 60 A
update add your-domain-name.tld. 60 A ${new_ip_address}
show
send
EOF
fi

On the name server host

Add the following to /etc/bind/named.conf:

  zone "your-domain-name.tld" {
        type primary;
        file "pri/your-domain-name.tld.zone";
        allow-update {
                key "your-domain-name.tld";
        };
        notify yes;
};