Install and configure DNS Server (2024)

  • Article

Applies to: Windows Server 2022, Windows Server 2019, Windows Server 2016

This quickstart shows you how to install and configure a DNS Server on Windows Server. You'llinstall the DNS Server role to host DNS zone data, forward DNS queries to DNS root hint name servers, or optionally to anupstream name server.

Prerequisites

Before you can install and configure your DNS server, your computer must meet the followingprerequisites:

  • A computer running a supported version of Windows Server.
  • A static IP.
  • An account that is a member of the Administrators group, or equivalent.

Installing DNS Server

Installing a Domain Name System (DNS) server involves adding the DNS Server role to an existingWindows Server server.

Tip

When you install Active Directory Domain Services (AD DS) with the Active Directory DomainServices Installation Wizard, the wizard gives you the option to automatically install andconfigure a DNS server. The resulting DNS zone is integrated with the AD DS domain namespace. Tolearn more, seeUnderstanding Active Directory Domain Services Integration.

To install the DNS Server role as a standalone server, perform the following steps:

  • PowerShell
  • GUI

Here's how to install the DNS Server role using theInstall-WindowsFeature command.

  1. Run PowerShell on your computer in an elevated session.

  2. To install the DNS role, run the following command. The installation doesn't require a reboot.

    Install-WindowsFeature -Name DNS

Configuring DNS Server

Now you've installed the DNS Server role, you can configure the server.

Configure interfaces

By default a DNS server will listen for requests on all IP address interfaces. You can configure DNSserver to listen on a specify interface using the GUI or by using PowerShell.

  • PowerShell
  • GUI

Here's how to configure the interface used to listen for DNS requests using theSet-DNSServerSetting command.

  1. Run PowerShell on your computer in an elevated session.

  2. Find your computers existing IP address by running theGet-NetIPAddress cmdlet. Make a note of the IPaddress that you want to use for your DNS server.

    Get-NetIPAddress | fl IPAddress,InterfaceAlias
  3. Store the current DNS server setting in a temporary variable, set the ListeningIpAddressproperty, and apply the new settings by running the following commands. Replace the placeholder<ip_address> with the IP you made a note of earlier.

    $DnsServerSettings = Get-DnsServerSetting -ALL$DnsServerSettings.ListeningIpAddress = @("<ip_address>")Set-DNSServerSetting $DnsServerSettings

Configure root hints

Root hints servers are used to help resolving DNS address information when the DNS server isunable to resolve the query locally from a hosted zone or the DNS server cache. Root hints name servers are populated by default in new installations.

You can edit the list of root name servers if required by navigating to the Root Hints tab of the DNS server propertiesdialog box or by using PowerShell.

Removing all root hints servers isn't supported. Instead configure your DNS server to not use root hintname server by selecting the Disable recursion server option in the DNS Manager consoleAdvanced tab. Disabling recursion also disables any configured forwarders. Alternatively, clearUse root hints if no forwarders are available in the Forwarders tab.

  • PowerShell
  • GUI

Here's how to update a DNS root hint name server using theSet-DnsServerRootHint command.

  1. Run PowerShell on your computer in an elevated session.

  2. Find your computers existing IP address by running theGet-DnsServerRootHint cmdlet. Make a noteof the name server that you want to update.

    Get-DnsServerRootHint
  3. Store the current DNS server setting in a variable by running the following commands. Replace theplaceholder <root_hint_name_server> with the root hint name server you noted earlier.

    $RootHintServer = (Get-DnsServerRootHint | Where-Object {$_.NameServer.RecordData.NameServer -match "<root_hint_name_server>"} )
  4. Set the Ipv4address property in the temporary variable by running the following commands.Replace the placeholder <ip_address> with the updated IP address.

    $RootHintServer.IPAddress[0].RecordData.Ipv4address = "<ip_address>"
  5. Apply the updated record by running the following commands.

    Set-DnsServerRootHint $RootHintServer
  6. To check the updated root hints, run the following command. You'll notice the name server has atrailing dot (.).

    Get-DnsServerRootHint

Configure forwarders

You can optionally configure a forwarder to resolve DNS address information rather than forwardingtraffic to the DNS root servers. You can add forwarders using the GUI or by using theSet-DNSServerForwarder PowerShell cmdlet.

Note

DNS root hints will not be used unless your forwarders fail to respond.

  • PowerShell
  • GUI

Here's how to install the DNS server role using theInstall-WindowsFeature command.

  1. Run PowerShell on your computer in an elevated session.

  2. To configure DNS forwarders, replace the placeholders <ip_forwarder_1> and <ip_forwarder_2>with the IP address of the DNS server to be used as your forwarders. Then, run the followingcommands.

    $Forwarders = "<ip_forwarder_1>","<ip_forwarder_2>"Set-DnsServerForwarder -IPAddress $Forwarders

Removing the DNS Server role

To remove the DNS Server role, perform the following steps.

  • PowerShell
  • GUI

Here's how to uninstall the DNS Server role using theUninstall-WindowsFeature command.

  1. In an elevated PowerShell prompt, run the following command:

    Uninstall-WindowsFeature -Name DNS

Important

When removing the DNS server role service from a Windows Server computer be aware:

  • For a DNS server that hosts AD DS-integrated zones, these zones are saved or deletedaccording to their storage type. The zone data isn't deleted unless the DNS server that youuninstall is the last DNS server hosting that zone.
  • For a DNS server that hosts standard DNS zones, the zone files remain in the%systemroot%\System32\Dns directory, but they aren't reloaded if the DNS server is reinstalled.If you create a new zone with the same name as an old zone, the old zone file is replaced with thenew zone file.

Next steps

Now you've installed and configured a DNS server, here are some articles that might help you to domore.

  • DNS Policies Overview
  • Anycast DNS overview
Install and configure DNS Server (2024)

FAQs

How do I reconfigure my DNS server? ›

How to Change Your DNS Server on a Windows 10 Computer. To change your DNS server on a Windows 10 computer, go to Settings > Network & Internet > Change Adapter Settings. Then right-click a connection and select Properties > IPv4 > Properties. Finally,select Use the following DNS server address.

How is DNS server configured? ›

From the Windows desktop, open the Start menu, select Windows Administrative Tools > DNS. Select and hold (or right-click) your server, and then select Properties. To limit the DNS server to use a specific IP address, select Only the following IP address, select the IP address you wish to use, and then select OK.

What does it mean to configure DNS? ›

DNS configuration sets up a Domain Name System server to translate domain names (URLs) into IP addresses. The configuration helps manage the DNS records for domains.

What command is use to install DNS server? ›

Type Start PowerShell in the Command Prompt window to start Windows PowerShell. 2. Type Install-WindowsFeature DNS and press Enter to install DNS Server.

What is a DNS server for WiFi? ›

The Domain Name System (DNS) Server is a server that is specifically used for matching website hostnames (like example.com)to their corresponding Internet Protocol or IP addresses. The DNS server contains a database of public IP addresses and their corresponding domain names.

How do I know if my DNS settings are correct? ›

Open the Command Prompt. Type ipconfig /all and press Enter. Look for the DNS Servers entry to check your DNS settings and verify that they are correct. If you don't see the correct DNS servers, double check your DNS settings in the Network and Sharing Center.

Is it safe to reset DNS? ›

Flushing DNS is a straightforward yet potent method for resolving many internet connectivity issues. It's a safe procedure and can often be the initial step in troubleshooting network problems.

Where is DNS server configured? ›

DNS settings are specified in the TCP/IP Properties window for the selected network connection. Go to the Control Panel. Click Network and Internet > Network and Sharing Center > Change adapter settings.

What is an example of a DNS? ›

DNS, or the Domain Name System, translates human readable domain names (for example, www.amazon.com) to machine readable IP addresses (for example, 192.0. 2.44).

Should I configure DNS on router? ›

DNS servers are a vital part of internet infrastructure, but they can be manipulated by hackers to redirect you to corrupted websites or steal your private data. Here's how to configure your router DNS settings to prevent hijacking attacks. Then, learn how a VPN can give you a faster, safer browsing experience.

How to check if DNS is configured correctly? ›

Run ipconfig /all at a command prompt, and verify the IP address, subnet mask, and default gateway. Check whether the DNS server is authoritative for the name that is being looked up. If so, see Checking for problems with authoritative data.

Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 5824

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.