Create your own Nameserver using TinyDns on Pfsense

If you ever thought of hosting your own Public DNS for your own domain then this article is going to be of help for you as I will go through the process of hosting my own Public DNS for my freely acquired domain www.moh10ly.cf

These free domain providers have poor Public DNS capabilities and usually lack of many DNS records e.g. (SRV, TXT, PTR) and that what made me personally want to go on and host my own public DNS for this domain.

I'm going to use Pfsense 2.1.5 for this demonstration but I guess 2.2 also works as well but haven't tried TinyDns on it yet.

Ok so to configure your own nameserver, first you must have a public domain (domain.com) ..
 In this example I will register a free domain from this registrar: www.freenom.com

The process for registration is pretty simple, you will have to follow the wizard and validate your email then sign in to 
your portal to edit or configure your free domain.

I have already added a new domain for myself which is called ( moh10ly.cf )

 To configure name servers, You must fulfill the following prerequisites:

  1. Public static IP.
  2. DNS Package on Pfsense
  3. Firewall that supports static NAT.
  
Next step: I will click on Manage domain to change the DNS configuration to point it to my own name server
 
 When you get the following window, click on Management tools and choose "Register glue records"
 Very important note:
Next add your Name servers (They don't need to exist as we will create them later) but you will have to create 2 at least 
and you can point them to the same Public IP address.

Scroll down and you will find an option to add the second dns, you can call it dns2 and point it to the same IP address.
Next save changes, then click on Management tools --> Name Servers and there if you couldn't find the new name servers 
you have configured then enter them here.


Save changes again

Now let's go on Pfsense and setup our Public DNS (Name Server), You will have to go to "System>Packages>Available 
Packages" and there download "dns-server" or "TinyDns"
 

When you have finished installing TinyDns you will find it under "Services" menu. Click on it

Once you are there, click on "Settings tab" and on the binding IP address place your Public IP which you'll use for the name
servers. And make sure you use the WAN NIC to listen on.

  
Save and click on the "New domain wizard" to setup your domain
 Click Next

On the next window configure your domain as in the following, make sure that it matches your configuration on registrar's
domain.
  
Click Next and Finish

Once finished, go to the Add/ Edit record tab and there you will find 4 created records
 
Next create the root DNS record which is . And point it to the same public IP and any other records that you might have an
installed role for like Exchange, IIS ..etc
 
Now it's time to configure the firewall to allow inbound queries on port 53. here's the rule that I have created under 
(Firewall\Rules) because I have only one Public IP address on WAN I won't use a static NAT rule.

I will go back to TinyDns on Pfsense to see the incoming requests for name resolving from public clients.
Under the logs tab I could see the requests I was making from my PC using google as my DNS..  So everything works fine.

Comments

Popular posts from this blog

Working with Columns on the Joomla Frontpage

Block Facebook on Pfsense using WPAD Autodiscover feature