CNAME or Canonical Name record is one of the types of DNS records. It is used to create an alias name for an existing Host A record or another CNAME record. Alias name usually required to hide the original hostname, or if the host itself runs multiple services then one alias name can be assigned for each service. It's very easy to Add CNAME Record in Windows DNS Server. Also, you can add as many CNAME records as you want, all pointing to the same hostname.

How to Add CNAME Record in Windows DNS Server

Like the other DNS record types, you can create CNAME record as a static or dynamic record. You can also create CNAME record in either Forward Lookup Zones or Reverse Lookup Zones, however, the CNAME record must point to a Host A record or another CNAME record in Forward Lookup Zones.

To simulate the steps to add CNAME record in Windows DNS server, we're going to use the scenario below:

AS-DCO001 is the Domain Controller and DNS Server of the mustbegeek.com domain environment. The network administrator adds a new server, AS-SVC001, which runs several services at the same time including FTP and print server. The A record for AS-SVC001 is already existing, however the administrator wants to use a more user-friendly name instead of the original server name to serve end-users. You are required to help the administrator to create alias name for each of the services.

As usual, we can add CNAME record in Windows DNS server either by using DNS Manager or PowerShell.

Add CNAME Record using DNS Manager

The steps to add CNAME record using DNS Manager is similar with adding another record. You can start by selecting the zone that you want to use. In this example, the zone name is mustbegeek.com under Forward Lookup Zones.

Add CNAME Record in Windows DNS Server - 1 Right click on the zone name, then select New Alias (CNAME)…

Add CNAME Record in Windows DNS Server - 2

The window below will then show up

Add CNAME Record in Windows DNS Server - 3

You need to fill in the details required on the above window

  • Fill the Alias name field with the alias name you want to use. Notice the Fully Qualified Domain Name (FQDN) field will be automatically updated as you type the alias name.
  • Fill the FQDN for target host field with the FQDN of the target host or you can click on Browse to select the from the available records.
  • You can choose to tick Delete this record when it becomes stale option. When enabled, this option will convert your CNAME record into a dynamic record. Otherwise it is static by default.
  • You can also tick the Allow any authenticated user to update all DNS records with the same name to allow automatic update of this CNAME record if the information on the target host record is changing overtime, such as when the server is using DHCP.
  • Optionally, you can modify the TTL value if you want to use anything other than the default value which is 1 hour.

In this example, we created two CNAME records and all pointing to the same target host AS-SVC001.mustbegeek.com with details as shown in the pictures below:

Add CNAME Record in Windows DNS Server - 4

Add CNAME Record in Windows DNS Server - 5

Click OK to finish adding the CNAME record.

Add CNAME Record in Windows DNS Server - 6

Add CNAME Record using PowerShell

When you're using PowerShell to add CNAME record in Windows DNS server, you have to run PowerShell as administrator. After that you can enter the command below:

Add-DnsServerResourceRecordCName -Name "ALIAS_NAME" -HostNameAlias "HOST_NAME_FQDN" -ZoneName "ZONE_NAME" [-AllowUpdateAny] [-AgeRecord] [-TimeToLive TTL_VALUE]

Replace the values below with the information you want to create:

  • ALIAS_NAME = Replace with the alias name in FQDN format
  • HOST_NAME_FQDN = Replace with the target hostname also in FQDN format
  • ZONE_NAME = Replace with the zone name where you create the CNAME record
  • [-AllowUpdateAny] = Optional keyword that serve the same function as "Allow any authenticated user to update all DNS record…"
  • [-AgeRecord] = Optional keyword that serve the same function as "Delete this record when it becomes stale"
  • [-TimeToLive] = Optional keyword that serve the same function as the TTL field, replace the TTL_VALUE with the value you want in HH:MM:SS format

And below are two lines of PowerShell cmdlets that we use in this scenario, which results in the same as the previous example:

Add CNAME Record in Windows DNS Server - 7

Working with CNAME Record in Windows DNS Server

It's fairly easy to understand about CNAME record compared to the other types of DNS record. CNAME record doesn't have many requirements except a valid Host A record for the target host name. Also, the same alias name cannot be used multiple times by different target host.

That makes less considerations needed to add CNAME record in Windows DNS server.

The following two tabs change content below.

  • Bio
  • Latest Posts

I am IT practitioner in real life with specialization in network and server infrastructure. I have years of experience in design, analysis, operation, and optimization of infrastructure solutions for enterprise-scaled network. You can send me a message on LinkedIn or email to arranda.saputra@outlook.com for further inquiry regarding stuffs that I wrote or opportunity to collaborate in a project.