ComTech: IT Support Stirling

How to set up a Linux DNS server

ComTech: IT Support Stirling

Today we will have a look at setting up a DNS server on Linux.  This tutorial was configured using Linux Mint 9 but the steps are the same for any Linux distribution.

First thing to do is to install the software we need. Open up a terminal and type:

sudo apt-get install bind9

Once installed it is time for some configuring.  The first file we need to configure is named.conf.local.  So in the terminal type:

sudo nano /etc/bind/named.conf.local

I have used nano to open up the file but use whichever text editor you are happy with.  Insert the following code into the file:

# This is the zone definition. replace with your domain name
zone “” {
type master;
file “/etc/bind/zones/”;

# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation – e.g my network address is 192.168.0
zone “” {
type master;
file “/etc/bind/zones/”;

Replace with the name of your DNS domain (this is not the same as an active directory domain but rather a name for your DNS zone).

Next up is the options file.  In the terminal type:

sudo nano /etc/bind/named.conf.options

Within this file we need to modify the forwarder with the address of your ISP’s DNS servers.  So modify the file adding the following:

forwarders {;;

Replace the addresses above with the addresses of your ISP’s DNS servers.

Now we need to add the zones file:

sudo mkdir /etc/bind/zones

And then configure it:

sudo nano /etc/bind/zones/ (replace with your DNS domain).

Add the following code to the file:

// replace with your domain name. do not forget the . after the domain name!
// Also, replace ns1 with the name of your DNS server      IN      SOA 
// Do not modify the following lines!

// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// = domain name      IN      NS          IN      MX     10

// Replace the IP address with the right IP addresses.
www              IN      A
mta              IN      A
chris-server              IN      A

In the above code replace the following: with your DNS domain name, with your static DNS server address, with your computers hostname.dns-domain,

mta is your mail server (if you have one).  If you do modify the IP address to show this.

Next we have to create the reverse DNS zone file:

sudo nano /etc/bind/zones/

Add the following code:

//replace with yoour domain name, ns1 with your DNS server name.
// The number before IN PTR is the machine address of the DNS server
@ IN SOA (

IN    NS
1                    IN    PTR

All that is left to do is restart bind:

sudo service bind9 restart (using upstart) or sudo /etc/init.d/bind9 restart (init scripts)

Don’t forget to test the new configuration:


About the Author

Hi I am Chris the owner of ComTech. I provide IT Support, Laptop repairs and Computer repairs to both personal and business clients in and around Stirling. For a list of what I can offer you why not visit my website where you will find my blog, testimonials, services and much more.  Start supporting a local business today so I can start supporting you.

If you found this blog useful then why not sign up to my RSS Feed for news, tutorials, views and general techie stuff!!






2 thoughts on “How to set up a Linux DNS server

Leave a comment

Your email address will not be published.


Get every new post delivered to your Inbox

Join other followers

WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera
WP Like Button Plugin by Free WordPress Templates