Skip to content

How to install and configure a DNS server on Windows Server 2019

How to install and configure a DNS server on Windows Server 2019: the DNS Server role, forward and reverse zones, A records and client tests, with PowerShell.

msmtech8 min read · 2 October 2023
An engineer working at her computer

To install and configure a DNS server on Windows Server 2019, give the server a static IP address, add the DNS Server role in Server Manager (or run Install-WindowsFeature -Name DNS), create a forward lookup zone for your domain and a reverse lookup zone for your subnet, add an A record for each machine, then point client computers at the server.

A DNS server answers one question for every machine on the network: which IP address belongs to this name? This guide builds a small lab with one server and two Windows clients, with a screenshot for each step and the PowerShell equivalent from Microsoft Learn.

  • Install the role: Server Manager → Add Roles and Features → DNS Server. No restart needed.

  • Create two zones: a forward lookup zone (name to IP) and a reverse lookup zone (IP to name).

  • Add A records for the server and each client, with matching PTR records.

  • Test from a client with nslookup and ping using the full name.

Does this work on Windows Server 2022 and 2025?

Yes. Microsoft’s DNS Server quickstart and its pages on zones and resource records apply to Windows Server 2016, 2019, 2022 and 2025 (checked November 2026). The Server Manager wizard, DNS Manager and the DnsServer PowerShell cmdlets used here are the same on all four.

Windows Server 2019 left mainstream support in January 2024 and gets security updates until January 2029, per Microsoft’s lifecycle page. For a new server, install 2022 or 2025 and follow the same steps.

What you need before you start

You need Windows Server installed, an account in the local Administrators group, and an IP plan. This lab uses one subnet, 172.16.10.0/24 (mask 255.255.255.0), and the domain eu-new.lan:

Machine

Name

IP address

Server

server-eu

172.16.10.10

Client 1

wks-1

172.16.10.101

Client 2

wks-2

172.16.10.201

Each machine’s fully qualified domain name (FQDN) is its name plus the domain: server-eu.eu-new.lan, wks-1.eu-new.lan and wks-2.eu-new.lan. The clients in the screenshots run Windows 10; the same network dialogs exist on Windows 11.

eu-new.lan is fine for a lab. For a real company network, Microsoft recommends a subdomain of a domain you have registered, such as corp.example.com, rather than an unregistered suffix (how to choose a domain name).

Step 1: Name the server and give it a static IP address

A DNS server needs a fixed address, because every client is configured to find it there. Microsoft lists a static IP as a prerequisite for the DNS Server role.

  1. Rename the computer to server-eu and restart.

  2. Open the network adapter’s Internet Protocol Version 4 (TCP/IPv4) properties.

  3. Set the IP address to 172.16.10.10, the subnet mask to 255.255.255.0, and the preferred DNS server to 172.16.10.10 (the server itself).

Windows Server 2019 system properties with the computer name set to server-euNetwork adapter properties on server-eu with Internet Protocol Version 4 selectedIPv4 properties on server-eu with static IP address 172.16.10.10 and mask 255.255.255.0

The lab screenshots show IPv6 unticked to keep the setup IPv4 only. On a real network, leave IPv6 on: Microsoft doesn’t recommend disabling IPv6, because some Windows components might not work without it.

The same settings in PowerShell (check your adapter’s name with Get-NetAdapter; add -DefaultGateway if your network has a router):

Rename-Computer -NewName "server-eu" -Restart
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 172.16.10.10 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 172.16.10.10

Step 2: How to install a DNS server on Windows Server 2019

Install the DNS Server role from Server Manager’s Add Roles and Features wizard. The installation doesn’t require a restart.

  1. In Server Manager, select Manage → Add Roles and Features.

  2. On Before you begin, select Next.

  3. Choose Role-based or feature-based installation.

  4. Select this server (server-eu) from the server pool.

  5. On Server Roles, tick DNS Server and select Add Features when asked.

  6. Leave the Features page as it is.

  7. Read the DNS Server page, then confirm your selections and select Install.

  8. When the results page says the installation succeeded, select Close.

Server Manager Manage menu with Add Roles and Features selectedAdd Roles and Features wizard, Before You Begin pageAdd Roles and Features wizard with role-based or feature-based installation selectedAdd Roles and Features wizard, server selection with server-eu selectedAdd Roles and Features wizard with DNS Server selected in the server roles listAdd Roles and Features wizard, Features page left at its defaultsAdd Roles and Features wizard, DNS Server information and confirmation before installingAdd Roles and Features wizard showing the DNS Server installation result

In PowerShell, run this in an elevated session. -IncludeManagementTools also installs DNS Manager, which the cmdlet leaves out by default:

Install-WindowsFeature -Name DNS -IncludeManagementTools

If you plan to install Active Directory on this server, you can skip ahead: the Active Directory Domain Services wizard can install and configure DNS for you, with the zone stored in Active Directory. See our guide to installing Active Directory on Windows Server 2019.

Step 3: Create a forward lookup zone

A forward lookup zone is the part of DNS that turns names into IP addresses. Every record you add belongs to a zone named after your domain, here eu-new.lan.

  1. Open DNS Manager (Server Manager → Tools → DNS), right-click Forward Lookup Zones and select New Zone.

  2. Choose Primary zone.

  3. Enter the zone name eu-new.lan.

  4. Accept the default zone file name, eu-new.lan.dns.

  5. Choose how the zone accepts dynamic updates, then select Finish.

DNS Manager starting the New Zone wizard for a forward lookup zoneNew Zone wizard for the eu-new.lan forward lookup zoneNew Zone wizard with Primary zone selected for the forward lookup zoneNew Zone wizard with the zone name eu-new.lan enteredNew Zone wizard completing the eu-new.lan forward lookup zone

On a server that isn’t a domain controller, the zone is stored in a file and the wizard offers two update choices: allow nonsecure and secure updates, or no dynamic updates (Microsoft’s zone guide). With Do not allow dynamic updates, you add every record by hand, which suits a small lab. The PowerShell equivalent, using Add-DnsServerPrimaryZone:

Add-DnsServerPrimaryZone -Name "eu-new.lan" -ZoneFile "eu-new.lan.dns"

Step 4: Create a reverse lookup zone

A reverse lookup zone does the opposite: it turns an IP address back into a name. It holds the PTR records that nslookup and many applications use to show which machine an address belongs to.

  1. In DNS Manager, right-click Reverse Lookup Zones and select New Zone.

  2. Choose Primary zone.

  3. Choose IPv4 Reverse Lookup Zone.

  4. Enter the network ID in normal order, 172.16.10. DNS Manager names the zone 10.16.172.in-addr.arpa.

  5. Accept the default zone file name.

  6. Choose the dynamic update option, then select Finish.

DNS Manager starting a new zone under Reverse Lookup ZonesNew Zone wizard with Primary zone selected for the reverse lookup zoneNew Zone wizard with IPv4 Reverse Lookup Zone selectedNew Zone wizard with the network ID 172.16.10 enteredNew Zone wizard zone file page for the 10.16.172.in-addr.arpa reverse zoneNew Zone wizard completing the 172.16.10 reverse lookup zone
Add-DnsServerPrimaryZone -NetworkId "172.16.10.0/24" -ZoneFile "10.16.172.in-addr.arpa.dns"

Step 5: Add A records for the server and the clients

An A record links one name to one IPv4 address. Create one for the server and one for each client.

  1. In DNS Manager, right-click the eu-new.lan zone and select New Host (A or AAAA).

  2. Enter the name server-eu and the IP address 172.16.10.10. Tick Create associated pointer (PTR) record to fill the reverse zone at the same time.

  3. Select Add Host.

  4. Repeat for wks-1 (172.16.10.101) and wks-2 (172.16.10.201).

New Host dialog creating the A record server-eu for 172.16.10.10DNS Manager showing the server-eu A record in the eu-new.lan zoneNew Host dialog creating an A record for a client machineDNS Manager listing A records for server-eu, wks-1 and wks-2 in eu-new.lan

In PowerShell, -CreatePtr adds the matching PTR record in the reverse zone (Microsoft’s record guide):

Add-DnsServerResourceRecordA -Name "server-eu" -ZoneName "eu-new.lan" -IPv4Address "172.16.10.10" -CreatePtr
Add-DnsServerResourceRecordA -Name "wks-1" -ZoneName "eu-new.lan" -IPv4Address "172.16.10.101" -CreatePtr
Add-DnsServerResourceRecordA -Name "wks-2" -ZoneName "eu-new.lan" -IPv4Address "172.16.10.201" -CreatePtr

Step 6: Point the clients at the DNS server and test it

A client uses the DNS server only once its network settings name it. Give each client its static address, set the preferred DNS server to 172.16.10.10, and add the DNS suffix eu-new.lan so short names resolve too.

  1. On wks-1, open the adapter’s IPv4 properties: IP address 172.16.10.101, mask 255.255.255.0, preferred DNS server 172.16.10.10.

  2. Set the computer name to wks-1 and the DNS suffix to eu-new.lan, then restart.

  3. Run nslookup server-eu.eu-new.lan and check that it answers 172.16.10.10.

  4. Ping the server by its full name.

IPv4 properties on wks-1 with IP address 172.16.10.101 and DNS server 172.16.10.10Windows 10 computer name settings for wks-1DNS suffix eu-new.lan set on the wks-1 client

nslookup asks the DNS server directly, so it is the quickest test that the zone and records work (nslookup reference):

nslookup on wks-1 resolving eu-new.lan names to their IP addresses

Windows Firewall usually blocks incoming ping. To allow it on the server, enable the inbound rule File and Printer Sharing (Echo Request - ICMPv4-In) in Windows Defender Firewall with Advanced Security. The ping by full name then succeeds:

Command prompt on wks-1 pinging server-eu.eu-new.lan successfully

Configure wks-2 the same way with 172.16.10.201. Its lookups resolve and it reaches the server by FQDN too:

Command prompt on wks-2 resolving and pinging server-eu.eu-new.lan

The client settings and tests in PowerShell, for wks-1:

New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 172.16.10.101 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 172.16.10.10
Set-DnsClient -InterfaceAlias "Ethernet" -ConnectionSpecificSuffix "eu-new.lan"
Resolve-DnsName server-eu.eu-new.lan
Resolve-DnsName 172.16.10.10

Common DNS server mistakes to check first

When we set up Windows networks at msmtech, most "DNS doesn’t work" reports come down to one of these:

  • The client still points at the router. If the preferred DNS server is the router or an internet resolver, it has never heard of eu-new.lan. Check with ipconfig /all.

  • A record added, PTR missing. Forward lookups work but reverse lookups fail. Create the reverse zone first, then add hosts with the PTR box ticked.

  • The server’s own DNS setting is wrong. The server should list its own address, so it can resolve its zone too.

  • Firewall, not DNS. If nslookup answers but ping times out, the name is fine and ICMP is being blocked.

Frequently asked questions

Does a Windows DNS server need Active Directory?

No. The DNS Server role runs on its own with zones stored in files, as in this guide. On a domain controller you can instead store zones in Active Directory, which replicates them to other domain controllers and allows secure dynamic updates.

How do I make my Windows DNS server resolve internet names?

It already can: a new DNS server uses the internet’s root hint servers for names it doesn’t host. To send those queries to your provider’s or a public resolver instead, add forwarders in the server’s properties or with Set-DnsServerForwarder, as Microsoft’s DNS Server quickstart shows.

Do I need to restart after installing the DNS Server role?

No. Microsoft notes that installing the DNS Server role doesn’t require a restart. Removing the role does.

Should I use .local or .lan for an internal domain?

For a lab, either works. For production, Microsoft recommends a subdomain of a name you have registered, such as corp.example.com, because unregistered suffixes can clash with other networks and with names other organisations register later.

Next step: install Active Directory on the same server so staff sign in with one account on every computer, and go through our checklist for securing remote work for the accounts and devices that use this network.

Need help with a Windows Server or network setup? Talk to msmtech.