DNS is an addressing system that allows you to find a computer on the network by calling its friendly name rather than the IP address and vice versa. DNS role can deployed along with the Active directory role or it can be deployed separately.
This tutorial is on how to install and configure a DNS Server on a Windows Server using PowerShell.
Prerequisites for a DNS
- A fresh installation of Windows OS – Server 2019. 2016.
- Configure the system with Static IP.
- PowerShell DNS module
Install DNS role
DNS server role in Windows Server can be installed using the following PowerShell command
1 |
<em><span class="has-inline-color has-vivid-red-color">Install-WindowsFeature DNS -IncludeManagementTools</span></em> |
There are several types of DNS records.
- A-Record – set to match the hostname and IP address
- CNAME – record used to forward to another name
- MX – mail server such as exchange
- NS – Name server
Adding Address and PTR Records
A and PTR record can be added using PowerShell:
1 |
Add-DnsServerResourceRecordA -Name "<strong>sfo01-m01-esx07</strong>" -ZoneName "ash.local" -IPv4Address "<strong>172.16.11.107</strong>" -TimeToLive 01:00:00 -CreatePtr -PassThru |
Display Address and PTR Records
1 |
Get-DnsServerResourceRecord -ZoneName ash.local -RRType A | Where-Object Hostname -like "<em>esx</em>" |
Remove Address and PTR Records
1 |
Remove-DnsServerResourceRecord -ZoneName "ash.local" -RRType "A" -Name "<strong>sfo01-m01-esx07</strong>" -RecordData "<strong>172.16.11.107</strong>" -PassThru |
(Visited 167 times, 1 visits today)