How to install bind9 DNS server on debian

→ Are you a new visitor? Please visit the page guidance for new visitors ←

How to install bind9 DNS server on debian

I’ve been wanting to write a tutorial about this for a long time now, this is also something I’ve learned the very first time I started playing with servers. In this article I’m going to show you how to install bind9 DNS server on debian (or ubuntu since these are similar) and set your own domain name to resolve directly on your own VPS server.

Required packages

You mostly need to install your DNS server, bind9, on your server. That’s it.

From here you can start directly and setup your DNS server settings.

Setting up Bind9 on Debian / Ubuntu

Start by editing the file /etc/bind/named.conf.local:

In this file add the following content:

Let’s now create the zones folder since it doesn’t exist:

Create your own DNS zone for your domain name, I’ll paste here a template that you can use. Of course it needs updated with your own domain and server IPs and proper serial number!

And the contents are:

Next you have the bind9 settings that you need to add. Lets first backup our current file and add the below content:

Here are my current settings which you can use. Don’t forget to update with your own IP:

What you are left is to test if everything is ok, you can use named-checkzone to check your DNS zone is correct:

Restart bind and you are done.

DNS query output

Here is a DNS query output I tested, it should show something similar for you also:

Keep in mind that if you made any mistakes, you need to check the following log file for the errors:

For example, I removed the zone file on purpose and restarted bind9, here are the errors:

That’s it for now, I hope it helped and we will see you again in our next tutorial.

Request an article ←