This guide walks you through the process of installing and configuring a DNS Server on a Windows Server. By setting up a DNS Server, you can host DNS zone data, forward DNS queries to root hint name servers, or direct them to an upstream name server for efficient domain name resolution.
Prerequisites:
Make sure your machine satisfies the following prerequisites before starting the installation:
- A PC with a compatible version of Windows Server installed.
- A static IP address.
- Administrator rights or comparable access.
Installing DNS Server:
You must add the DNS Server role to an already-existing Windows Server system to set up a DNS server.
A DNS server can be installed and configured automatically through the setup wizard when installing Active Directory Domain Services (AD DS). This combines the AD DS domain namespace with the DNS zone.
To install the DNS Server role as a standalone server, follow these steps:
- Open PowerShell with administrative privileges.
- Execute the following command to install the DNS Server role (no reboot required):
Install-WindowsFeature -Name DNS
Configuring DNS Server
After installing the DNS Server role, you can configure it as needed.
Configure Listening Interfaces:
The DNS server is listening for requests on all IP ports by default. Use these procedures to specify an interface for DNS requests:
- Open PowerShell with administrative privileges.
- Retrieve your system’s existing IP address:
Get-NetIPAddress | fl IPAddress,InterfaceAlias
- Store current DNS settings, define the listening IP address, and apply the new settings:
$DnsServerSettings = Get-DnsServerSetting -ALL $DnsServerSettings.ListeningIpAddress = @("<ip_address>") Set-DNSServerSetting $DnsServerSettings
(Replace <ip_address> with your server’s IP address.)
Configure Root Hints:
Root hints help resolve DNS queries when the local DNS server cannot find an answer in its cache or hosted zones. New installations include default root hint servers.
To update a DNS root hint server:
- Open PowerShell with administrative privileges.
- Retrieve the list of existing root hint servers:
Get-DnsServerRootHint
- Store the target root hint server details in a variable:
$RootHintServer = (Get-DnsServerRootHint | Where-Object {$_.NameServer.RecordData.NameServer -match "<root_hint_name_server>"})
- Update the IP address:
$RootHintServer.IPAddress[0].RecordData.Ipv4address = "<ip_address>"
- Apply the updated record:
Set-DnsServerRootHint $RootHintServer
- Verify the updated root hints:
Get-DnsServerRootHint
(Replace <root_hint_name_server> and <ip_address> accordingly.)
Configure Forwarders:
DNS forwarders allow your DNS server to resolve queries through an upstream server instead of querying root hint servers.
- Open PowerShell with administrative privileges.
- Configure DNS forwarders by running the following command:
$Forwarders = "<ip_forwarder_1>","<ip_forwarder_2>"Set-DnsServerForwarder -IPAddress $Forwarders
(Replace <ip_forwarder_1> and <ip_forwarder_2> with the actual forwarder IPs.)
Removing the DNS Server Role:
If you need to uninstall the DNS Server role, follow these steps:
- Open PowerShell with administrative privileges.
- Execute the following command:
Uninstall-WindowsFeature -Name DNS
Important: When removing the DNS server role, consider the following:- For AD DS-integrated DNS zones, data is retained or deleted based on storage type.
- For standard DNS zones, zone files remain in the %systemroot%\System32\Dns directory but won’t be reloaded if DNS is reinstalled.
By following these steps, you can successfully install, configure, and manage a DNS Server on Windows Server to optimise your network’s domain name resolution process.
For better control over user access, check out our guide on How to manage user roles in Plesk