Setting up a DNS zone in Bind9

In this article, I will give an example of adding a DNS zone to Bind9.

We use the db.local file as a template, copy it:

sudo cp /etc/bind/db.local /etc/bind/

Open the created copy in a text editor:

sudo nano /etc/bind/

For example, by default, you might see the following content:

$TTL    604800
@       IN      SOA     localhost. root.localhost. (
                              2         ; Serial
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
@       IN      NS      localhost.
@       IN      A
@       IN      AAAA    ::1

Let’s change the data to suit our needs, for example:

$TTL    86400
@       IN      SOA (
                              3         ; Serial
                          86400         ; Refresh
                           3600         ; Retry
                             1w         ; Expire
                           3600         ; Negative Cache TTL
; NS records
@     IN      NS
@     IN      A
www   IN      A
mail   IN      A
ns1   IN      A
ns2   IN      A

Open the main configuration file in a text editor:

sudo nano /etc/bind/named.conf

And add a link to the file with the settings of the new zone:

zone "" {
        type master;
        file "/etc/bind/";

After editing, check the configuration for errors:

sudo named-checkconf

Restart bind9 to apply the changes:

sudo service bind9 restart

Let’s check the zone:

sudo named-checkzone

See also my articles:
Configure the PTR record
My other articles about DNS

Leave a comment

Leave a Reply