This article is a step by step tutorial on how to install and configure a DNS Server on Windows Server 2016 /2012 R2. Also we will show you how to create forward and reverse lookup zones. For a start, we'll also take a look at what's the DNS service and what it is used for.

DNS (Domain Name System) is a system that allows you to find the IP address of a host by a domain name and vice versa. DNS server—this network service provides and supports DNS operation. The DNS server may be responsible for the specific zone in which the corresponding computers are located. Since the DNS system is hierarchical system, the DNS server can redirect the request to the upstream server if it cannot determine the IP address of the host by the domain name.

Most often, the DNS server role is installed along with the installation of the Active Directory domain controller role. If you don't need AD, you can install the DNS server role separately.

Important! Before install, make sure your DNS server has a static IP-address.

Now let's begin.

The fastest way is to install the DNS server role in Windows Server 2016 using the following PowerShell command (run it with an administrator permissions):

Install-WindowsFeature DNS -IncludeManagementTools

You can also install the DNS server role from the Server Manager GUI. Open Server Manager and click on Add Roles and Features.

how to install dns server

Select Role-based or feature-based installation option and click on Next.

how to configure dns server 2012

Here you need to select desired server you'd like to install DNS Server (usually this is the current server).

how to configure dns server 2016

From Server Roles lists select DNS server and click on Next. Click Add Features on the popup window—in this case, the DNS management console and PowerShell DNS module will be installed automatically. If you want to manage this DNS server remotely, you can not install these tools.

configure dns server 2016

Now you can see that item DNS is checked.

install dns server

No additional features required for this step, but we want to be sure that DNS Server Tools is already selected. To check this, click on Remote Server Administration > Role Administration Tools. Then click on Next.

how to install and configure dns on windows server 2016

Here just click on Next.

setup dns server 2016

To confirm installation press Install.

how to configure dns in windows server 2016

Installation process started, it may take few minutes.

DNS Server Installation is successfully completed, click on Close.

setup dns server

So, the server role of the DNS server is installed. Now you can configure your DNS Server. To run DNS server management tools, click on Tools in the upper right corner of Server Manager and click on DNS in the drop-down list.

windows dns server

Select your server on the left side of DNS Manager window to open zone list.

Currently there are no zones configured on your DNS server. This server is called caching. Zones are parts of the namespace for which the server is responsible. Forward lookup zones are used to convert a name to an IP address. The reverse lookup zone, on the contrary, matches the IP address with the hostname. The presence of a reverse lookup zone on the DNS server is not necessary, but it is easy to configure and provides the full functionality of the DNS service.

Right-click on Forward Lookup Zones and click on New Zone from context menu to bring up the New Zone Wizard.

windows server 2016 dns configuration

In this window click Next.

In this step you can select the type of DNS you want to use. The primary zone will be located on your server, the secondary zone will be located on another server. The secondary zone is used in large networks for load balancing. Choose Primary zone and click on Next to continue.

windows server 2016 dns setup

Enter any name for new zone file and click on Next button.

dns configuration in windows server 2012

Specify the name of the zone file.

how to configure dns server

Dynamic updates allow DNS clients register their resource records in DNS database automatically, but if the network is small we can make updates of DNS database manually. It is recommended to allow dynamic updates, but only if DNS will be used exclusively on your local network. Otherwise, this item may entail security risks, as the "New Zone Wizard" will warn you about.

how to setup dns server

On the next window just click on Finish.

That's all, forward zone created. Setting the zone is done by adding DNS records to the zone. There are several types of DNS records. Consider the main types of DNS records:

  • A-record (AAAA-record)—matches the hostname and IP address;
  • CNAME-record—used to forward to another name;
  • MX—mail entry, points to mail servers;
  • NS—points to DNS server.

If earlier you have chosen Do not to allow dynamic updates, you should add records to zone manually. To do this right click on zone name and click on New Host (A or AAAA).

windows server dns setup

Here enter name and IP-address of your DNS Server in appropriate fields and then click Add Host.

dns server configuration in windows server 2012

A message appears stating that the node has been created.

The host record was successfully created.

local dns server windows

You can also create an A record using PowerShell:

Add-DnsServerResourceRecordA -Name 'client1' -ZoneName 'test.contoso.com' -IPv4Address 192.168.0.100

As you can see on the right side of the DNS Manager window, the new host is now created. You can create records for client computers in exactly the same way.

how to install dns server in windows server 2012

Now you should add Reverse Lookup Zone. To do this right click on Reverse Lookup Zone and click on New Zone from the action menu to bring up the New Zone Wizard.

Next steps will be the same as for Forward Lookup Zone, click Next.

Choose Primary zone and click on Next to continue.

installing dns server

Here you need to select the type of IP-address, check on IPv4 and click on Next to continue.

windows server 2012 r2 dns configuration step by step

In Network ID field enter the first three octets of your DNS Server IP-address.

dns server configuration

Just click on Next.

configure dns server

Check Do not allow dynamic updates and press Next.

create dns server

Click on Finish button and your DNS server is now configured and ready for use.

As you can see on the right side of DNS Manager window, Reverse Lookup Zone is now created.

how to configure dns in windows server 2012

In order to obtain domain name or IP address mapping using the command nslookup:

Nslookup client1.test.contoso.com

Tip. Don't forget to check which DNS server is specified in the settings of the network interface (it should be, respectively, the IP address of the current server).

In order for a DNS server to resolve addresses in other zones, you need to configure DNS Forwarders. To do this, in the DNS Manager console, open the properties of your server.

dns server windows server 2016

Go to the Forwarders tab, click the Edit button and add the address of the external DNS server to which you want to forward requests (for example, 8.8.8.8).

configure dns windows server 2012

You can also configure DNS Forwarders using the command:

Add-DnsServerForwarder -IPAddress 8.8.8.8 –PassThru
  • Author
  • Recent Posts

Cyril Kardashevsky

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.

Cyril Kardashevsky