Setup a DNS Server on Windows Server 2012

Updated on July 10, 2015
Setup a DNS Server on Windows Server 2012 header image

Windows Server 2012 can be configured as a DNS server. DNS is used to resolve domain names to IP addresses. By hosting your own DNS servers, you have more control over what happens with your data, and it can be very handy if you need to control the environment too.

Step 1: Install DNS server

In order to install the DNS server software to your Windows Server, go to the "Server Manager". Click "Manage -> Add Roles and Features". You will be asked for the role that you want to install; this will be "DNS Server". You may see the following warning:

role_warning.png

This can occur with some servers, it's safe to ignore this though. Just click "Continue". Click "Next". You will not need to select any features, so just click "Next" again.

You will now find a description of DNS. You can read this if you want, it's not really needed though.

Next, all of the software that will be installed is shown. Confirm this is correct, and click "Install". You will need to restart your server once the installation has completed.

Step 2: Configuring the DNS server

In order to get started with configuring the DNS server, go to "Server Manager -> Tools -> DNS". This will open the DNS Manager. The DNS manager is the program used to manage your DNS server.

First off, we'll need to configure how the DNS server works. In order to do this, click "Action -> Configure a DNS Server...". A DNS setup wizard will open. Click "Next" after you've read the introduction.

Next, you will be presented with several options.

  • Forward lookup zone: This is how a normal DNS server functions; resolving domain names to IP addresses.

  • Reverse lookup zone: This is the reverse; you can resolve an IP address to a domain name.

  • Root hints: This will, instead of being able to resolve domain names to IP addresses or vice versa, allow you to store the IP addresses of DNS servers that already exist.

If you just want to be able to resolve domain names to IP addresses, check "Forward lookup zone"; this is probably what you want. Click "Next".

The next option will allow you to select if you want this to be a DNS server that hosts zones, or one that replicates them. You probably want the first one though, so check "This server maintains the zone" and click "Next".

In order to be able to complete the next step, you must first understand what "zones" are. Every time you create a domain name in your DNS that a DNS server should resolve, you are creating a "zone": a zone is only used by your domain name and is only used to resolve your domain name.

  • Zone name: This is the first domain name you are going to create. Example: "example.com".

  • Zone file: Every zone has a file where the data is stored. If you already had a DNS zone setup, copy it to C:\Windows\System32\dns. If you do not have a zone file for this zone yet (which you probably don't), select "Create a new file with this file name:". It is recommended to not change the name.

  • Dynamic update: There are three options here. Unless you know what you are doing and if you have a very good reason to do it, click "Do not allow dynamic updates".

  • Forwarders: If there is a query your DNS server can't answer, the DNS server can ask another DNS server to resolve it. It is recommended to have at least one (preferably more) nameservers here. You could add Google's DNS, for example (8.8.8.8 and 8.8.4.4).

Click "Finish".

Step 3: Adding records to your zone

In order for your DNS server to actually be able to resolve domain names to IP addresses, you will need to make sure it knows the IP address first. In order to do this, go to the "DNS Manager -> [name of your server] -> Forward Lookup Zones -> [name of your zone]", right-click and click "New [Record]". There are multiple types of records. "A" is often used to simply resolve a domain name to an IP address, so in order to set up our first "A" record, go ahead and click "New Host (A or AAAA)...".

This will open a window with three fields:

  • Name: This is the name of your record. An empty name represents example.com. Any other name like "test" would represent test.example.com.

  • FQDN: Depending on the name, this is what your DNS server will resolve.

  • IP address: This is what your DNS server will resolve to queries for the FQDN.

Click "Add Host". If everything is correct, you will see the following message:

"The host record [FQDN] was successfully created."

Click "OK".

Congratulations! Your Windows Server is now a DNS server.