How to Install NSD on Fedora Server

NSD is an open source, authoritative-only DNS server developed by NLnet Labs. It is scalable, secure and simple to configure. In this tutorial, we will show you how to install NSD on a Fedora server.

Prerequisites

Before you start, ensure that you have the following:

Step 1: Update the System

First and foremost, update the system packages to the latest version available by running the following command:

$ sudo dnf update -y

Step 2: Install NSD

Next, we will install NSD by running the following command:

$ sudo dnf install nsd -y

Step 3: Configure NSD

After installation, the NSD configuration files will be located in the /etc/nsd/ directory.

3.1 Modify NSD Configuration File

Open the nsd.conf file using your preferred text editor:

$ sudo nano /etc/nsd/nsd.conf

You should now see the contents of the configuration file. Uncomment the following directives:

server:
    hide-version: yes
    username: nsd
    zonesdir: "/etc/nsd"

3.2 Create a Zone File

Create a new zone file in the /etc/nsd directory. Replace example.com with your domain name.

$ sudo touch /etc/nsd/example.com.zone

Add the following content to the file:

; Example Zone File
$ORIGIN example.com.
$TTL 86400
@ IN SOA ns1.example.com. admin.example.com. (
           2020082001 ; serial number
           3600       ; refresh
           1800       ; retry
           604800     ; expire
           86400      ; minimum TTL
)
           IN      NS      ns1.example.com.
           IN      NS      ns2.example.com.
ns1        IN      A       192.168.0.1
ns2        IN      A       192.168.0.2

3.3 Verify the NSD Configuration

To verify that the NSD configuration is correct, run the following command:

$ sudo nsd-checkconf /etc/nsd/nsd.conf

The output should be similar to the following:

ok

3.4 Start the NSD Service

Once the configuration is verified, start the NSD service by running the following command:

$ sudo systemctl start nsd

You should see no output if the service starts successfully.

3.5 Configure the NSD Service to Start at Boot

Configure the NSD service to start automatically at boot time by running the following command:

$ sudo systemctl enable nsd

Step 4: Test NSD

To test if NSD is installed and functioning correctly, run the following command:

$ dig NS example.com +short @localhost

This should return output similar to the following:

ns1.example.com.
ns2.example.com.

Congratulations! You have successfully installed and configured NSD on your Fedora server.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!