Provide Authoritative DNS Services with NSD on Fedora 14

Updated by Linode Written by Brett Kaplan

Contribute on GitHub

Report an Issue | View File | Edit File

This guide has been deprecated and is no longer being maintained.

NSD is a lightweight yet full-featured open source name server daemon created to provide an alternative to BIND.

Before beginning, you should be familiar with basic DNS terminology and records. You will also need to ensure that your current Linode plan has enough memory to run the NSD daemon. Use the developer’s memory usage calculator to determine the memory requirement for your NSD deployment.

Set the Hostname

Before you begin installing and configuring the components described in this guide, please make sure you’ve followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:

hostname -f

Install Required Software

Ensure that your package repositories are up to date and that you’ve installed all available software upgrades by issuing the following commands:

yum update

Install NSD and configure the daemon to start on boot with the following commands:

yum install nsd
chkconfig nsd on

Proceed to configure the daemon.

Configure NSD

Configure NSD Service

Edit the nsd.conf file to configure the behavior of the NSD service and the hosted DNS zones. The NSD package provides an example configuration file located at /etc/nsd/nsd.conf that you may reference. Your file should resemble the following:

:   logfile: "/var/log/nsd.log" username: nsd

Host Zones with NSD

You must specify at least one zone in the /etc/nsd/nsd.conf file before NSD will begin serving DNS records. Refer to the following example configuration for proper syntax.

:   name: zonefile: /etc/nsd/

:   name: zonefile: /etc/nsd/

Once zones are added to the nsd.conf file, proceed to create a zone file for each DNS zone.

Creating Zone Files

Each domain has zone file specified in the nsd.conf file. The syntax of an NSD zone file is similar BIND zone files. Refer to the example zone files that follow for syntax, and modify domain names and IP addresses to reflect the needs of your deployment.

 1 2 3 4 5 6 7 8 91011
$ORIGIN $TTL 86400

@ IN SOA (
:   2010011801 ; serial number 28800 ; Refresh 7200 ; Retry 864000 ; Expire 86400 ; Min TTL )

:   NS

    MX 10

ns1 IN A ns2 IN A www IN A tomato IN A mail IN A \* IN A
 1 2 3 4 5 6 7 8 910111213
$ORIGIN $TTL 86400

@ IN SOA (
:   2009011803 ; serial number 28800 ; Refresh 7200 ; Retry 864000 ; Expire 86400 ; Min TTL )

:   NS

    MX 10

ns1 IN A ns2 IN A www IN A paisano IN A mail IN A

pizzapie IN CNAME paisano

Rebuild the NSD database and restart the daemon with following command sequence:

nsdc rebuild
/etc/init.d/nsd restart

Test the configuration and functionality of the DNS serve using dig, which provides a command line DNS client. Issue the following command to test the DNS server:

dig @localhost

The output should resemble the following:

; <<>> DiG 9.6.1-P2 <<>> @localhost
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25199
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, ORGNAMEITY: 2, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;  IN  A

;; ANSWER SECTION: 86400 IN  CNAME 86400  IN  A

;; ORGNAMEITY SECTION:    86400   IN  NS    86400   IN  NS

;; Query time: 18 msec

Congratulations, you have successfully installed NSD!

Adjusting NSD for Low-Memory Situations

If you are running NSD in a low-memory environment, amending the values of the following directives in your /etc/nsd/nsd.conf file will lower your memory and system resource usage.

ip4-only: yes tcp-count: 10 server-count: 1

More Information

You may wish to consult the following resources for additional information on this topic. While these are provided in the hope that they will be useful, please note that we cannot vouch for the accuracy or timeliness of externally hosted materials.

See Also

comments powered by Disqus

This guide is published under a CC BY-ND 4.0 license.