Daniel Washburn

Daniel Washburn

DHCPv6 Dynamic DNS Recipe

Introduction

The ddns-hostname directive below picks, in descending order of preference, one of option dhcp6.fdqn, option fqdn.hostname, option host-name, or a string made up of dyn- concatenated with the contents of dhcp6.ia-na in 16 byte chunks.


A host with a non-temporary address (IA-NA) of 2001:db8:dead:beef:1034:56ff:fe78:9abc, which fails to identify itself otherwise will be assigned a DNS name of:

    dyn-2001-0db8-dead-beef-1034-56ff-fe78-9abc.example.org

Note that leading zeros will not be collapsed.


/etc/dhcpd6.conf

# DHCP server options.
# See dhcpd.conf(5) and dhcpd(8) for more information.
#
authoritative;

ddns-update-style interim;

key dhcpupdate-key {
        algorithm hmac-md5;
        secret KHN0ZGluKT0gMTU2MWQ2NT==;
};

zone f.e.e.b.d.a.e.d.8.b.d.0.1.0.0.2.ip6.arpa. {
        primary ns.example.org;
        key dhcpupdate-key;
}

zone example.org {
        primary ns.example.org;
        key dhcpupdate-key;
}

# Network:              2001:db8:dead:beef::/64
# Domain name:          example.org
# Name servers:         2001:db8:dead:beef::1/128
# Default router:       2001:db8:dead:beef::1/128
subnet6 2001:db8:dead:beef::/64 {

        update-static-leases on;
        ddns-hostname = pick (option dhcp6.fqdn, option fqdn.hostname, option host-name,
                        concat("dyn-", binary-to-ascii (16, 16, "-", substring(option dhcp6.ia-na, 16, 16))));
        option host-name = config-option server.ddns-hostname;
        allow leasequery; # RFC 5007

        ddns-domainname "example.org";
        option  dhcp6.domain-search "example.org";
        option  dhcp6.name-servers 2001:db8:dead:beef::53;

        ignore client-updates;
        use-host-decl-names on;
        update-conflict-detection off;

        range6 2001:db8:dead:beef:deca:fbad::/96;
}