Host record or A-record is a type of DNS record. Host A record serves the basic function of DNS server which is name-to-IP address mapping. It is the most common DNS record type and exists in the forward lookup zone as a static or dynamic record. Usually, an administrator manages the A record in enterprise network environment. This article will explain the step-by-step for administrator to Add Host A Record in Windows DNS Server using both DNS Manager and PowerShell.
How to Add Host A Record in Windows DNS Server
In this scenario, AS-DCO001 is the domain controller and DNS server for domain mustbegeek.com. Here, I will add Host (A) record for server AS-MBX001.mustbegeek.com and point to IP address 192.168.0.10. There are two ways to add Host (A) record in Windows DNS Server which are DNS Server Manager and PowerShell.
Using DNS Manager
The first way to add Host A record in Windows DNS Server is using DNS manager. To create new A record, browse to the zone name where you will create the record. In this case, the zone name is mustbegeek.com under Forward Lookup Zones.
Right click on the zone name and select “New Host (A or AAAA)…”
A new popup window as shown below will appear.
In this popup window you should enter several details as follows:
- Enter the name of the host machine in the Name field. In this case the host machine name is “AS-MBX001”. Notice that the Fully Qualified Domain Name (FQDN) field is updated automatically as you fill in the name.
- Enter the full IP address of the host machine in the IP address field, in this case the IP address is “192.168.0.10”
- (Optional) You can choose to tick the option to Create associated pointer (PTR) record, if you want the PTR record for this A record to be created automatically. Note that when you do this, the valid zone for the PTR record should be existing under Reverse Lookup Zones.
- (Optional) Again, you can choose to tick the option to Allow any authenticated user to update the DNS record with the same owner name, if you want to allow this record to be updated by the host machine when it changes the IP address. Note that if you don’t tick this option, you’re A-record will be created as static. But, if you tick this, you’re A record will be created as dynamic record.
- (Optional) You can change the TTL value or leave it to the default configuration. TTL value is the time given to the DNS client of how long they should keep this A-record on its cache. In this example we’re setting it to be 8 hours.
Finally, click the button Add Host to finish adding the A-record.
You can also add Host A-record in Windows DNS Server using PowerShell. The PowerShell command template to add Host A-record is:
Add-DnsServerResourceRecordA -Name "HOST_NAME" -ZoneName "ZONE_NAME" -IPv4Address "IP_ADDRESS" [-AllowUpdateAny] [-CreatePtr] [-TimeToLive TTL_VALUE]
You need to modify the command above according to your needs.
- HOST_NAME = Replace this with the hostname without FQDN suffix. In this example it would be “AS-MBX001”
- ZONE_NAME = Replace with the zone name where you will create the A-record. In this example is “mustbegeek.com”
- IP_ADDRESS = Replace with the IP address of the host. In this example it is “192.168.0.10”
- [-AllowUpdateAny] = This optional keyword serves the same function as “Allow any authenticated user to update all DNS record…”. You can choose to include this keyword if you want to make dynamic A-record.
- [-CreatePtr] = Serves the same function as “Create associated pointer (PTR) record”. Include this keyword only if you want the PTR record for this A-record to be created.
- [-TimeToLive TTL_VALUE] = Optional keyword that serves the same function as the TTL field. Replace the TTL_VALUE with TTL value that you want in HH:MM:SS format. Skip this keyword if you intend only to use the default TTL value.
Now for this example, the PowerShell command that reflects the same configuration as in the previous example using DNS Manager will looks like this:
Remember to run the command by using an elevated PowerShell window.
Working with A record in Windows DNS Server
When you add Host A record in Windows DNS server, you need to be aware that multiple A records with duplicate hostname in the same zone can be created. For example, you already have A-record for “AS-MBX001” in zone mustbegeek.com pointing to 192.168.0.10. But you want to build a mirror server with the identical configuration but different IP address of 192.168.0.11, so you can create new A record for “AS-MBX001” again but this one points to 192.168.0.11.
This is possible to do, especially in case to achieve server redundancy or load-balance. However, this may not be the best practice as when DNS server is performing lookup for record AS-MBX001, it will randomly select one of the records and there is no way to control the DNS lookup decision.
On the opposite, there will be no issue if you add multiple A-records in Windows DNS server with different hostname pointing to the same IP address. For example, you can add another A record for “mail.mustbegeek.com” pointing to 192.168.0.10, even though this IP address has been pointed by “AS-MBX001”. However, for this kind of scenario you might want to consider using CNAME instead.
And that’s all you need to know when you add Host A record in Windows DNS server.