How to Install NSD on Debian Latest

NSD, or "Name Server Daemon", is an open-source DNS server developed by NLnet Labs. It is designed to be lightweight and fast, making it a popular choice for simple DNS setups.

Here's how you can install NSD on Debian latest:

Prerequisites

Before starting the installation process, make sure that you have root access to your Debian system and that it is up-to-date. You can update the system by running the following commands:

sudo apt-get update
sudo apt-get upgrade

Step 1: Install NSD

NSD is available in the official Debian repositories. To install it, simply run:

sudo apt-get install nsd

This will install NSD along with its dependencies.

Step 2: Configure NSD

After installation, you need to configure NSD to work with your domain name. The configuration file for NSD is located at /etc/nsd/nsd.conf. You can edit this file using your favorite text editor.

Here's an example configuration file for NSD:

server:
    ip-address: 127.0.0.1
    port: 53
    verbosity: 1

zone:
    name: example.com
    zonefile: /etc/nsd/zones/example.com.zone

This configuration file sets up NSD to listen on the localhost IP address (127.0.0.1) and port 53. It also specifies a zone file for the domain "example.com".

Step 3: Create Zone File

Now that you have specified the path to your zone file in the NSD configuration file, you need to create the actual zone file.

Create a new file at /etc/nsd/zones/example.com.zone with the following contents:

$ORIGIN example.com.
$TTL 86400
@        IN    SOA    ns1.example.com. admin.example.com. (
                 2021050601 ; Serial
                 3600       ; Refresh
                 1800       ; Retry
                 604800     ; Expire
                 86400      ; Minimum TTL
)
;
@        IN    NS     ns1.example.com.
ns1      IN    A      127.0.0.1

This zone file sets up a DNS server for the domain example.com. The SOA record specifies the primary name server and contact email address. The NS record specifies the name server for the domain. Finally, an A record is added to specify the IP address for the name server.

Step 4: Start NSD

Now that you have NSD installed and configured, you can start the server by running:

sudo systemctl start nsd

You can check the status of the NSD service by running:

sudo systemctl status nsd

This should output information about the NSD service, including whether it is currently running and any errors that may have occurred.

Conclusion

NSD is now installed and running on your Debian system. You can test the configuration by querying the DNS server using a command like dig or using a web-based DNS lookup tool. With a little more configuration, you can also set up secondary DNS servers for redundancy and additional features.

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!