Tech, Gadgets, Photography, Social Media and Poor Spelling

How can i create my own DNS Server?

For many out there, DNS is handled by your Broadband router, and not something you need to worry about. However as your home network grows, having your own DNS server might be something of use to you, especially if you’re not building your life around Windows. 

I’ve just had to follow these instructions to get a DNS server working as part of network segregation where I work this weekend, so our developers can live on their own self contained network segment in the most part. 

Some things worth noting about setting up your own DNS, while you can add domain names and IP’s for anything you want, and if the forwarder address can cope with it, ping times will be good, however for local servers on the same domain, you will 10% want to make sure that the reverse DNS is setup or ping’s will seem REALLY slow..!!! (10 seconds for a ping..

Something else worth knowing, if you decide to use Webmin to do this, from the interface side, it has an uncanny knack of ocassionally corrupting your conf files

If you need underscores _ in your domain name, create a cname to the domain name as underscores don’t appear to be supported.


Step 1: Install Ubuntu dapper, or use your WORKING installation.

Step2: Install bind 9:

sudo apt-get install bind9

Step 3: Configure the main Bind files. Usually, if you install Bind from the source code, you will have to edit the file named.conf. However, Ubuntu provides you with a pre-configured Bind, so we will edit another file:

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

This is where we will insert our zones. By the way, a zone is a domain name that is referenced in the DNS server
Insert this in the named.conf.local 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/";

Ok, now, let’s edit the options file:

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

We need to modify the forwarder. This is the DNS server to which your own DNS will forward the requests he cannot process.

forwarders {
      # Replace the address below with the address of your provider's DNS server;

Now, let’s add the zone definition files (replace with your domain name:

sudo mkdir /etc/bind/zones
sudo vi /etc/bind/zones/

The zone definition file is where we will put all the addresses / machine names that our DNS server will know. You can take the following example:

// 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
ns1              IN      A

Now, let’s create the reverse DNS zone file:

sudo vi /etc/bind/zones/

Copy and paste the following text, modify as needed:

//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 my case, it's 1, as my IP address is
@ IN SOA (

                     IN    NS
1                    IN    PTR

Ok, now you just need to restart bind:

sudo /etc/init.d/bind9 restart

We can now test the new DNS server…
Step 4: Modify the file resolv.conf with the following settings:

sudo vi /etc/resolv.conf

enter the following:

// replace with your domain name, and with the address of your new DNS server.

Now, test your DNS:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


This entry was posted on September 4, 2011 by in regular and tagged , , , , , , .
%d bloggers like this: