Windows 2025
Sponsored Link

DNS Server : Add CNAME record2024/11/28

 

Add CNAME record which is another name (Alias) of an A-record.

On CUI configuration, Run PowerShell with Admin Privilege and Configure like follows.

[1] For example, Add CNAME record [fd3s] to a Host [rx-7] in a Zone [srv.world].
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> Add-DnsServerResourceRecordCName -Name "fd3s" -HostNameAlias "rx-7.srv.world" -ZoneName "srv.world" -PassThru 

HostName                  RecordType Type       Timestamp            TimeToLive      RecordData
--------                  ---------- ----       ---------            ----------      ----------
fd3s                      CNAME      5          0                    01:00:00        rx-7.srv.world.

PS C:\Users\Administrator> Get-DnsServerResourceRecord -ZoneName "srv.world" | Format-Table -AutoSize -Wrap 

# CNAME record has been added
HostName RecordType Type Timestamp TimeToLive RecordData
-------- ---------- ---- --------- ---------- ----------
@        NS         2    0         01:00:00   rx-7.srv.world.
@        SOA        6    0         01:00:00   [8][rx-7.srv.world.][hostmaster.srv.world.]
fd3s     CNAME      5    0         01:00:00   rx-7.srv.world.
rx-7     A          1    0         01:00:00   10.0.0.101
rx-8     A          1    0         01:00:00   10.0.0.102
rx-8     MX         15   0         01:00:00   [10][rx-8.srv.world.]

# verify
PS C:\Users\Administrator> Resolve-DnsName fd3s.srv.world -Server 127.0.0.1 

Name                           Type   TTL   Section    NameHost
----                           ----   ---   -------    --------
fd3s.srv.world                 CNAME  3600  Answer     rx-7.srv.world

Name       : rx-7.srv.world
QueryType  : A
TTL        : 3600
Section    : Answer
IP4Address : 10.0.0.101

# if remove it, run like follows
PS C:\Users\Administrator> Remove-DnsServerResourceRecord -ZoneName "srv.world" -RRType "CNAME" -Name "fd3s" -PassThru 

Confirm
Removing DNS resource record set by name fd3s of type CNAME from zone srv.world on RX-7 server. Do you want to continue?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

HostName                  RecordType Type       Timestamp            TimeToLive      RecordData
--------                  ---------- ----       ---------            ----------      ----------
fd3s                      CNAME      5          0                    01:00:00        rx-7.srv.world.
DNS Server : Add CNAME record (GUI)
 

On GUI configuration, set like follows.

[2] Run Server Manager and select [Tools] - [DNS], next right-click the own domain name to show menu on the left pane, then select [New Alias (CNAME)...].
[3] Input Alias name and FQDN, and also target Hostname like follows.
[4] A new CNAME record has been just added.
Matched Content