Setting up nsd DNS server

From Alpine Linux
Revision as of 22:21, 5 October 2011 by Jbilyk (talk | contribs) (create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NSD is an authoritative-only DNS server. The following page shows how to setup a single-zone configuration. In the examples is used as the server's IP. The IP addresses used here (along with the domain) should be replaced with the proper IP addresses of your servers.


Installation is simple (perform this step on both servers):

apk add nsd


First, setup the main configuration file on the master server, /etc/nsd/nsd.conf, replacing the secret with a proper one:

        port: 53
        server-count: 1
        ip4-only: yes
        hide-version: yes
        identity: ""
        zonesdir: "/etc/nsd"
        name: "sec_key"
        algorithm: hmac-md5
        secret: "WhateverSecretYouUse"

Then, create the zone file for the zone in question (/etc/nsd/ in this case):

;## authoritative zone

$TTL 86400

@ IN SOA (
                2011100501      ; serial
                28800           ; refresh
                7200            ; retry
                86400           ; expire
                86400           ; min TTL

                MX      10
lists           MX      10
@               IN      A
mail            IN      A
www             IN      A
www-prd         IN      A
www-qa          IN      A
wiki            IN      A
lists           IN      A
monitor         IN      A
bugs            IN      A
nl              IN      A
dl-2            IN      A
dl-3            IN      A
dl-4            IN      A
rsync           IN      A
distfiles       IN      A
build-edge      IN      A
build64-edge    IN      A
build-2-2       IN      A
build64-2-2     IN      A
build-2-1       IN      A
build-2-0       IN      A
build-1-10      IN      A

Start Server

First step, make sure you didn't have any typos in your configuration:

nsd-checkconf /etc/nsd/nsd.conf

Then each time a change is made to the zone (including when you first start the server), you need to rebuild the NSD zone databases:

nsdc rebuild

Finally, start the server and set it to auto-start:

/etc/init.d/nsd start rc-update add nsd