Gernot Walzl


The domain name system (DNS) resolves hostnames (e.g. to IP addresses.
BIND is the most used DNS server on the internet.

This tutorial shows how to configure a subdomain in BIND 9 on Debian 10 (buster).



The official Debian repository includes BIND 9:
apt-get install bind9


To run a name server for a subdomain,
the following records are relevant in the zone of the domain

sub      IN  NS  ; name server for subdomain
ns1.sub  IN  A             ; IPv4 address of
ns1.sub  IN  AAAA  2001:db8:10::1        ; IPv6 address of


The DNS server needs to accept incoming packages
on the following ports:


The zone file for needs to be specified in the configuration file

zone "" {
    type master;
    file "/var/lib/bind/";


The zone file defines records for a (sub)domain. The example for
the subdomain includes the following configuration:

The content of the zone file /var/lib/bind/ looks like this:

$TTL  86400
@         IN  SOA (
                    2020042301    ; Serial  (YYYYMMDDxx)
                          3600    ; Refresh  (1 hour)
                           600    ; Retry  (10 mins)
                        604800    ; Expire  (7 days)
                          1800 )  ; Negative Cache TTL  (30 mins)

@         IN  NS
ns1       IN  A
ns1       IN  AAAA  2001:db8:10::1

; other hostnames
somehost  IN  A
another   IN  A


The following command reloads the configuration:
rndc reload


Install the dnsutils package:
apt-get install dnsutils

Verify that the DNS lookup returns the correct IP address:

Dynamic Updates

Updating the DNS records is useful when IP addresses are dynamically assigned.
For instance, DHCP servers automatically assign IP addresses to hosts.


The following command generates a random rndc key and
prints a configuration example to the terminal:

The configuration file /etc/bind/named.conf.local allows a client
to update DNS records of with an rndc key:

include "/etc/bind/rndc.key";

zone "" {
    type master;
    file "/var/lib/bind/";
    allow-update { key "rndc-key"; };


For updating DNS records, the following command line tool is used:

These commands update the IPv4 address of
key rndc-key C3...DQ==
update delete A
update add 86400 A

CONTENT.html 2020-06-03 5.4 KB