Jesin's Blog

Welcome to the Portal of Technology

  • Facebook
  • GitHub
  • RSS
  • Twitter
  • Home
  • Categories
    • Domains
    • Linux
    • Networking
    • PHP
    • Virtualization
    • Web Design
    • Web Servers
    • Windows
  • WordPress Plugins
    • Custom Error Pages
    • HTTP Digest Authentication
    • Mailgun Email Validator
  • Toolbox
    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool
  • About Me
  • Contact Me
  • Sitemap
Home ›
Windows ›
Setting up an authoritative DNS in Windows Server 2008

Setting up an authoritative DNS in Windows Server 2008

July 11, 2013 Windows Jesin A 3 Comments

windows category thumbnail

Nowadays all major domain registrars offer managed DNS service along with the domain name(s) you register with them. You can use them to create most of the commonly used DNS records like A, MX, CNAME and some even allow you to create AAAA(IPv6), SRV and TXT records. But if you want full control over the DNS of your domain(s) its better to setup your own server for DNS hosting.

Setting up a full fledged authoritative DNS server is not so difficult as it sounds. If your know how DNS works you can easily setup your own DNS hosting server to host an unlimited number of domains. In this article I’ve setup an authoritative DNS server using Windows Server 2008 R2.

Requirements:

  • Static public IP address
  • Static private IP assigned to the server (if your server is behind a NAT device)
  • A very reliable Internet connection with 100% uptime (not required if you’re just testing)
  • Server with a capacity to handle DNS requests running Windows Server 2008
  • A registered domain name, if you’re just doing a test setup register a free dot.tk domain name.

Check for Static IP address

The IP address assigned to your server (either private or public) must be static else you’ll get the following warning message when installing the “DNS server” role.

dns server without static ip
You’ll be presented with this warning when adding the DNS role if your server has a dynamic IP address

The Preferred and Alternate DNS settings can be anything but NOT the loopback IP address (127.0.0.1) because we’re setting up an authoritative only DNS server and not a recursive one. In the following screenshot I’ve set it to the IP address of my gateway device as it functions as a DNS forwarder also. Since my test server is behind a NAT device I’m using private IP addresses.

dns server ip settings
My server is is behind a modem which performs NAT hence I’ve assigned a static IP address

You may wonder how queries for the authoritative domain we’re configuring will be answered, I’ll provide an explanation at the end.

Install the DNS server role

Hit [windows] + R to open the Run dialog box and enter “servermanager.msc”

run servermanager.msc
The server manager can be opened by going to Run and typing servermanager.msc

Click “Add roles“, in the wizard that appears click next and choose “DNS Server“.

add server roles dns

Click “Install” in the confirmation page.

add server roles dns confirmation

After installation choose to restart your computer.

add server roles dns installation complete

Once complete you can open the DNS manager in one of the following ways, open the “Run” dialog box and enter “dnsmgmt.msc”

start menu dns management

or Open Start menu > Administrative tools > DNS

run dnsmgmt.msc

Disabling recursion and root hints

As I mentioned earlier we’re configuring an authoritative server so leaving recursion to its default (which is enabled) will create a vulnerability for DNS DoS attacks. Open the DNS Manager, right-click the name of your server and click properties.

dns server properties

Go to the Advanced tab and check “Disable recursion (also disables forwarders)” and click OK.

disable dns recursion

But it isn’t done yet, the server still has root DNS servers in its configuration so it returns the root DNS server details each time it is queried for a non existent domain name. To prevent this we need to create a forward lookup zone with the name “.” you read that right it is just a single dot. Right-click “Forward Lookup Zones” and select “New Zone“.

create new forward lookup dns zone

Proceed with the wizard and choose “Primary Zone” type.

create dns primary zone

Enter the zone name as “.” (without quotes) and click next.

dns zone name root
Place a dot for the zone name when creating a root zone for disabling root hints

In the “Dynamic updates” page leave it to the defaults and press Next.

dns zone no dynamic updates

Finally click “Finish”

dns root zone records

Now a root zone has been created so this server will return a NXDOMAIN (non existing domain) answer whenever a recursive query is made.

Creating an authoritative zone

This is similar to the steps followed previously, right-click the “Forward lookup zone“, click “New Zone”

create new forward lookup dns zone

Choose “primary zone”

create dns primary zone

Now enter your registered domain name, for the purpose of this article I’ll be using a free dot.tk domain name.

dns zone name domain
Enter your registered domain name

Leave “dynamic updates” to its defaults and finish the wizard.

dns zone no dynamic updates

In the next few steps we’ll be creating records for this zone, this is where steps for users with NAT and public IP differ.

Creating DNS records

While creating records for the domain always remember to use only public IP addresses. First we’ll be editing the NS and SOA records that were automatically created with this zone. Open the properties of the NS record and edit the name server entry in it.

dns ns record
Modify the NS record of the newly created zone, enter the public IP address of your server and change the FQDN

If your server has a directly assigned public IP then editing the FQDN alone if enough, set it to something like dns1.yourdomain.com. For servers behind a NAT device edit the FQDN as well as the IP address. Remove the private IP address in the list and enter your public internet facing IP address. When you save this setting you’ll be asked whether you want to remove the private IP address, press “Yes”

At this point DNS manager will automatically create an A record pointing “dns1.yourdomain.com” to <Public IP address>. Next modify the SOA record, change the Primary server to the NS record just edited and enter your email address under “Responsible Person” replacing @ with a dot (user@example.com is entered as user.example.com).

dns zone soa record
Modify the default SOA record, change the Primary Server and email address

Create an A record for the parent domain name.

dns a record
Create an A record pointing to the server which will handle requests for this domain (e.g a webserver)

I’ve entered the IP address of the web server hosting this blog. Create a CNAME record for the www part of the domain name.

dns zone cname record
Create a CNAME record to point the www portion of the domain to the parent domain

After everything is done make sure your firewall allows inbound port 53 both TCP and UDP, test this be going to the Open port checker

port 53 open
Check if port 53 is open using the open port check tool

Login to your domain registrar’s control panel and configure name servers. You may also create additional records like MX and TXT if required.

Configure the domain name

Finally the domain name’s name server must be set to the IP address of the server we’ve just configured. Login to your domain registrar’s control panel and create a child name server. A child name server also known as a glue record looks like a subdomain of the major domain but is the authoritative name server for it. For example, the domain myowndns.tk will have a child name server dns.myowndns.tk along with the IP address of the server we’re setting up.

domain panel glue records
Create a child name server for your domain from the domain control panel

The IP address must be the public IP address through which the DNS server is accessible and query-able (port 53 allowed). Once this is done wait for “DNS propagation” to occur, theoretically it may take more than a day for propagation around the world but you can see the results in 10 minutes. Open an online DNS lookup tool which gives a lot of detail like network-tools.com. First query the default DNS server and have a look at the results.

dns query
Query a public DNS service to check for propagation
recursive dns response
Querying a public DNS server returns a recursive response

Then query the authoritative DNS server directly and look at the results.

dns authoritative query
Querying the authoritative DNS server directly

authoritative dns response

To check if DNS has propagated throughout the world do a DNS lookup at whatsmydns.net

You can also setup secondary (or slave/backup) DNS servers the same way or get them free as mentioned in this article.

Any doubts or problems drop a comment below and I’ll help you out.

Related posts:

windows category thumbnailHow to setup a VPN Server in Windows Server 2008 windows category thumbnailHow to setup roaming user profiles in Windows Server 2008 linux category thumbnailSetup Linux DNS Server for Windows Active Directory linux category thumbnailSetup Secondary (Slave) DNS Servers Free linux category thumbnailConfigure BIND DNS Split View

Tags: dns, windows server

Comments

  1. Suraj Kushwaha says

    June 11, 2014 at 4:28 pm

    Very helpful explanation. thanks !!!.

    Actually I too have to implement own hosted Public DNS server. So now my question is that if implementation has been done as per your documentation then how DNS name resolution will work.
    I mean to say, if someone surfing any of hosted web server from internet then query will be forwarded to my local dns server where all pubilc IP entries are available then it will provide client PUBLIC IP address back after that it will again reach our domain for that particular web server ?

    Hope you are able to understand my concern !!

    Thanks in advance.

    Reply
  2. Suraj Kushwaha says

    June 11, 2014 at 4:33 pm

    Hi,

    Also please help me know which option should be choose..

    1. Give direct public IP to local DNS Server
    or
    2. Should be NATTed

    Thanks

    Reply
  3. Matt says

    May 3, 2017 at 2:33 am

    I know it’s been a while since you’ve published this article, but just wanted to compliment you on this very well-presented and informative article. It is a bit rare to find this level of clarity, especially with the screenshot as examples. Thank you for this. I have noted your article on a stack exchange serverfault question (#583898) with full credit to you so others may be able to more easily find your excellent article.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Get a wealth of information delivered to your inbox. Subscribe and never miss a single article.

  • Tutorials and howtos
  • Code, scripts and commands
  • Online Tools

* No spam, unsubscribe anytime

Hire Me

  • SSL installation and hardening (A+ on Qualys SSL test)
  • Apache & Nginx configuration
  • Email deliverability improvement (10/10 on Mail Tester & MailGenius)
  • WordPress customization, optimization and migration
  • and much more…

    Tools

    • DNS Lookup Tool
    • htdigest Generator Tool Online
    • htpasswd Generator Tool Online
    • HTTP Headers Lookup Tool
    • MD5 Encryption Tool
    • Open Port Check Tool
    • SHA-1 Encryption Tool
    • URL Encoding/Decoding Tool

    Nav

    • Home
    • About Me
    • Contact Me
    • Privacy Policy
    • Sitemap
    Vultr SSD VPS

    Creative Commons License
    Jesin's Blog by Jesin A is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
    Based on a work at websistent.com.