添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
寂寞的杯子  ·  opengl ...·  6 月前    · 
帅气的山羊  ·  认识Spring Cloud ...·  10 月前    · 
飞翔的开心果  ·  Anaconda 安装及Python ...·  1 年前    · 
飘逸的野马  ·  Stable ...·  1 年前    · 

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

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'll install the DNS Server role to host DNS zone data, forward DNS queries to DNS root hint name servers, or optionally to an upstream name server.

Prerequisites

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

  • 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 existing Windows Server server.

    When you install Active Directory Domain Services (AD DS) with the Active Directory Domain Services Installation Wizard, the wizard gives you the option to automatically install and configure a DNS server. The resulting DNS zone is integrated with the AD DS domain namespace. To learn more, see Understanding Active Directory Domain Services Integration .

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

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

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

    Install-WindowsFeature -Name DNS
    

    Here's how to install the DNS Server role using Server Manager from the Windows desktop.

  • From the Windows desktop, open the Start menu, then select the Server Manager tile.

  • On the menu, go to Manage, and then select Add Roles and Features.

  • On the Before you begin page, select Next to begin.

  • On the Select installation type page, select the Role-based or feature-based installation option, and select Next.

  • On the Select destination server page, leave the default options. Select Next.

  • On the Select server roles page, select the DNS Server checkbox, and then select on the Next button.

  • You'll be prompted to add features that are required for DNS Server, if you're happy with the defaults, select Add Features.
  • On the Select features page, you can leave the default selections, and then select on the Next button.

  • On the DNS Server page, review the role description and things to note, select Next to continue.

  • On the Confirm installation selections page, review the selected roles and features, and then select on the Install button to begin the installation process.

  • Once the installation is complete, select Close. The installation doesn't require a reboot.

    Configuring DNS Server

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

    Configure interfaces

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

    PowerShell

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

  • Run PowerShell on your computer in an elevated session.

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

    Get-NetIPAddress | fl IPAddress,InterfaceAlias
    
  • Store the current DNS server setting in a temporary variable, set the ListeningIpAddress property, 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
    

    Here's how to configure the interface used to listen for DNS requests using the DNS Manager console.

  • 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.

    Configure root hints

    Root hints servers are used to help resolving DNS address information when the DNS server is unable 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 properties dialog box or by using PowerShell.

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

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

  • Find your computer's existing IP address by running the Get-DnsServerRootHint cmdlet. Make a note of the name server that you want to update.

    Get-DnsServerRootHint
    
  • Store the current DNS server setting in a variable by running the following commands. Replace the placeholder <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>"} )
    
  • 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>"
    
  • Apply the updated record by running the following commands.

    Set-DnsServerRootHint $RootHintServer
    
  • To check the updated root hints, run the following command. Notice that the name server has a trailing dot (.).

    Get-DnsServerRootHint
    

    Here's how to root hints using the DNS Manager console.

  • 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.

  • Select the Root Hints tab, select the item to edit, and then select Edit.

  • Enter the fully qualified domain name, then select Resolve. Verify the IP address. If necessary, edit the IP address.

  • Select OK.

  • Review the updated root hint server in the list. When you're ready, select OK. Notice that the name server has a trailing dot (.).

    Configure forwarders

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

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

  • Run PowerShell on your computer in an elevated session.

  • 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 following commands.

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

    Here's how to configure DNS forwarders using the DNS Manager console.

  • 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.

  • Select the Forwarders tab, then select Edit.

  • Enter the IP address of the DNS server to forward requests to. Repeat this step as many times as you need.

  • Select OK.

  • Review the DNS server in the list, select OK or Apply to complete your configuration.

    Uninstall-WindowsFeature command.

  • In an elevated PowerShell prompt, run the following command:

    Uninstall-WindowsFeature -Name DNS
    

    Here's how to uninstall the DNS server role using Server Manager from the Windows desktop.

  • From the Windows desktop, open the Start menu, then select the Server Manager tile.
  • On the menu, go to Manage, and then select Remove Roles and Features.
  • On the Before you begin page, Select Next to begin.
  • On the Select destination server page, select the server that you want to remove the DNS server role service from, then select Next.
  • From the list, clear the DNS Server checkbox.
  • You'll be prompted to remove features that require DNS Server, select Remove Features, then Next to continue.
  • On the Remove features page, you can leave the default selections, and then select the Next button.
  • On the Confirm removal selections page, review the selected roles and features, and then select Remove.
  • Once the role and feature is removed, select Close.
  • Restart your computer to complete the uninstall.
  • Important

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

  • For a DNS server that hosts AD DS-integrated zones, these zones are saved or deleted according to their storage type. The zone data isn't deleted unless the DNS server that you uninstall 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 the new zone file.
  • DNS Policies Overview
  • Anycast DNS overview
  •