Skip to main content
Raspberry Pi

Raspberry Pi DNS Server

By March 15, 2014September 12th, 2022No Comments

Rasberry Pi DNS ServerConfiguring a Raspberry Pi DNS Server

Configuring a Raspberry Pi DNS Server is not difficult and DNS makes up one of the primary network services we all need. We also know that the Raspberry Pi is such a great tool to allow you ease of access to a bare metal Linux system. In this video, we look at how we can use this device to setup a DNS Domain Name Server using bind9.  There are many DNS Servers available in Linux and for the Raspberry Pi, we choose to use BIND the Berkeley Internet Name Domain service as it is the most popular DNS Service you will find. A DNS server provides hostname to IP Address resolution. This means we can use friendly names like to connect to internet devices that require IP Address. In this tutorial, we will firstly install bind9 and use the name server as a caching only server and then we will create our own zone to host name resolution locally.

More detailed DNS course

In this tutorial we hope to gibe the basics that you need to get a DNS server running on the Raspberry Pi. No matter if you are using the Pi or other systems there is a lot more to know about DNS. If you would like too check out my DNS course on Pluralsight you will find it here.

Installing Bind

Firstly we will install bind and use it in the default state of caching-only. This require no configuration and the server will retrieve DNS lookups as required and cache them for local client.

$ sudo apt-get update
$ apt-cache search bind

This will return to many records; so try

$ apt-cache pkgnames bind

As an aside, you may prefer to install aptitude, using aptitude we can initiate more granular searches.

$ apt-get install aptitude
$ aptitude search '~n^bind' #This searches only the name field and we state the the name must start with bind.

Now we know the name of the package to install we can go ahead.

$ sudo apt-get install bind9 bind9-docs dnsutils

Checking the Status of the Server

Installing BIND on any Debian based distribution will also start the DNS server and enable it to be started on system boot. Without any further configuration, it will start in the caching-only mode. We can check the status of the server using the following commands.

$ service bind9 status 
$ rndc status

Configure Clients to Use DNS

In Linux, we use the /etc/resolv.conf file to point to the DNS Servers that we want to use for name resolution. On later systems, we may use the Network Manager to set this. On the DNS server, we can use the address of for the name server, meaning the local host.


On other systems, we need to point to the IP Address of the DNS Server. You may use the command ip addr show to determine your IP Address. Let’s assume it is


Create a DNS Zone File

If you want to host a DNS zone then we will need to add a record in the /etc/named.conf.local file. With that done we can then create a zone file. The video creates a zone database for and is called These are just text files. The following screenshot shows the content of the zone file.


To load the zone into the running DNS Server without a restart we can use the following command.

$ rndc reload

Lets look at the video: