We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Configure Windows Server 2022 as Secondary DNS Server

Learn how to – Configure Windows Server 2022 as Secondary DNS Server.

DNS is an abbreviation of Domain Name System, which is defined as the hierarchical decentralized naming system used to translate human-friendly domain names, such as ownyourlife.com.ng, into IP addresses, like 192.0.2.1 that are machine readable. Since machines communicate over the internet via IP addresses, this translation is so vital.

Without DNS, accessing websites would be so difficult as it would involve memorizing the IP addresses of the servers hosting those services, which can be complex and difficult to remember. DNS also plays a role in improving the performance and reliability of the internet by providing a distributed and fault-tolerant system for resolving domain names into IP addresses.

In our previous guide, we discussed how to configure DNS Server on Windows Server 2022. Today, we will learn how to configure Windows Server 2022 as Secondary DNS Server. But before that, we need to know what is a Secondary DNS Server.

What is a Secondary DNS server?

A secondary/slave DNS server is a backup server that stores a copy of the zone data from a primary DNS server. The primary DNS server is responsible for maintaining the authoritative record of the domain name to IP address mappings, also known as the zone file, for a particular domain name. The secondary DNS server takes over and responds to DNS queries when the primary DNS server becomes unavailable or experiences a failure. This can be used to provide redundancy and helps to ensure that the domain name resolution service remains available and responsive.

Once the Secondary DNS server is configured, it will periodically synchronize its zone data with the primary DNS server to ensure that it has an up-to-date copy of the zone file. This synchronization can be set to happen automatically at specific intervals or triggered manually whenever updates are made on the Primary DNS server.

The benefits offered by setting up a Secondary DNS server are:

  • Geographic distribution: If the DNS servers are distributed across different locations, DNS queries can be resolved from the server closest to the user, reducing latency and improving response times.
  • Load distribution: with multiple servers, the load of handling DNS queries can be distributed across multiple servers, reducing the load on any one server and helping to prevent overloading.
  • Redundancy and fault tolerance: It can also be used to provide redundancy and fault tolerance in case the primary DNS server experiences downtime, crashes, or becomes unreachable. With a secondary server in place, DNS queries can still be resolved, and users can continue to access resources and services even if the primary server is unavailable.
  • Security: a domain can be protected against attacks such as distributed denial of service (DDoS), which can overwhelm a single DNS server. Additionally, DNSSEC, a security protocol that ensures the integrity and authenticity of DNS data, can be more effectively implemented with multiple DNS servers.
  • Improved performance: DNS queries can be resolved faster, improving performance and a better user experience.

Now let’s plunge in!

Prerequisites

For this guide, we will have two servers configured as shown below

TASK IP ADDRESS
Primary DNS server 192.168.205.21
Secondary DNS server 192.168.205.20

To spin a primary server and configure the zones, follow the aid provided in the guide below:

Once the configs are made on the Primary server, proceed with the below steps.

#1. Install DNS Server on Windows Server 2022

On your intended secondary DNS server, you need to install the DNS server. This can be done using two ways:

  • Using GUI
  • Using Powershell

Option 1 – Install DNS server on Windows Server 2022 using GUI

Launch the server manager and proceed to Add Roles and Features.

While here, select  Role-based or feature-based

Choose your destination server 

On the features to install, choose the DNS Server and click Add Features:

Now confirm the installation and install the DNS Server.

Option 2 – Install DNS Server on Windows Server 2022 using PowerShell

This is a much easier method to install the DNS server package on Windows Server 2022. Run Powershell with elevated privileges and execute the below command:

Install-WindowsFeature -Name DNS -IncludeManagementTools

Sample Output:

#2. Add Secondary DNS Host on the Primary DNS Server

For the communication between the two servers to happen, we need to make several configurations. We will start by configuring the Primary DNS server to recognise the secondary server. But before that, make the below configs:

On the Primary DNS manager, create a secondary host by adding an A record set:

You also need to ensure that it is able to resolve DNS queries from the localhost

You can then add the secondary DNS host on the primary server using both the GUI and PowerShell.

Option 1 – Add Secondary DNS Host on the Primary DNS Server using GUI

Now on the Foward zone that you want to add the secondary zone right-click and select Properties.

Navigate to the Zone Transfers tab, and ensure that the setting is as follows.

Move to the Name Servers tab and click on the Add button.

While here, provide the IP Address or domain name of the secondary DNS server and hit resolve.

If it fails to resolve, you can just proceed and the server should be added as shown above

Option 2 – Add a Secondary DNS Host on the Primary DNS Server using PowerShell

You can also add the Secondary DNS Host on the Primary DNS Server using PowerShell. Launch Powershell with elevated privileges on the Primary server and run the below command:

Add-DnsServerResourceRecord -Name "@" -NS -ZoneName "learnhowto.org" -NameServer "192.168.205.20" -PassThru 

Verify if it has been added:

Get-DnsServerResourceRecord -ZoneName "learnhowto.org" | Format-Table -AutoSize -Wrap 

Sample Output:

#3. Add a secondary Zone on the Secondary DNS Server

Now we need to create a secondary zone on the secondary DSN server. This can also be done from both the GUI and PowerShell. Choose the option that works best for you.

Option 1 – Add a secondary Zone on the Secondary DNS Server Using GUI

To add a secondary zone on the Secondary DNS Server, we will launch the DNS manager using WIN+R and then type dnsmgmt.msc.

Now we will create a Foward Lookup Zone as shown:

Proceed and select the Secondary zone

Provide the zone name for which you want to replicate on this server.

Provide the IP address of the Primary DNS server, and press Enter to validate then proceed to Next

Finish the creation.

Now the zone files will be transferred automatically to your Secondary DNS server.

Option 2 – Add a secondary Zone on the Secondary DNS Server Using PowerShell

With this method, you need to launch PowerShell with elevated privileges and execute a command with the below syntax:

Add-DnsServerSecondaryZone -Name "learnhowto.org" -ZoneFile "learnhowto.org.dns" -MasterServers 192.168.205.21 -PassThru

Replace 192.168.205.21 with the IP Address of your Primary DNS server.

Verify if the zone has been created:

Get-DnsServerZone 

Sample execution output:

#4. Test Secondary DNS Server on Windows Server 2022

Once the secondary zone has been added, the available records will be replicated to the secondary server as shown.

If not, hit refresh

Now we will add another record to the Primary server:

The added record will be replicated on the secondary server.

Now we can also use the Secondary DNS server. Ensure that this is added as an alternative DNS server(in case the primary DNS server is unavailable).

a. On Windows

On Windows, navigate to the network configs and add the secondary DNS server as shown:

b. On Linux

On Linux systems, modify the /etc/hosts file and add the secondary DNS server as shown:

$ sudo vim /etc/resolv.conf
##Primary DNS server
nameserver 192.168.205.21

##Secondary DNS server
nameserver 192.168.205.20

Now after the changes have been made, the secondary DNS server will handle DNS queries whenever the Primary DNS server is off. To demonstrate this, shut down the Primary DNS server and try to run DNS queries. For example on Linux:

dig test.learnhowto.org

Sample Output:

Voila!
Today, we have learned how to configure Windows Server 2022 as Secondary DNS Server. We now have multiple servers, and handling DNS queries can be distributed across multiple servers, providing redundancy and fault tolerance.

See more on this page:

Cart

Your Cart is Empty

Back To Shop