Just want to see if I understand this correctly.
CNAME record specifies an alias, in the following form:
alias CNAME canonical-domain
Which means if something is trying to look up alias, it will find the CNAME record and start searching for canonical-domain instead.
A record directly maps a host to an IP
host A IP-addr
So if I have 2 domains eventually pointing to the same IP addr, one is a canonical domain and another is an alias domain, I would use an A record for the canonical domain->IP mapping, and a CNAME record for the alias->canonical mapping.
Why can’t I just use 2 A records, one being canonical->IP mapping and the other being alias->IP mapping? Is it so that you only have to update the IP once if you ever need to change it? (Analogy would be CNAME is a softlink and A record is a file in a filesystem)
You can – that’s perfectly normal.
Yes, that’s right.
A common configuration is to have the canonical name being the server’s real hostname, and then CNAME records for the sites hosted on that server pointing at that.
Note that you can’t have a CNAME for a bare domain name (e.g. stackoverflow.com) . A
CNAMErecord can’t coexist with theNSandSOArecords that are expected to exist at the apex of a zone.That’s not an analogy I’d use.