What is the difference and relation between Host Name and Canonical Name?

6

1

What is Canonical Name in relation to Host Name, Domain Name? Are they all pointing to the same IP?

KMC

Posted 2012-02-28T04:20:23.313

Reputation: 1 537

Answers

5

The host name is the real name the server has. A canonical name is a name that the host is known by, but that the host is not actually called.

A machine's host name could be "barkley.example.com", but because it runs the web and FTP services for the domain "example.com", it could have canonical names of "www.example.com" and "ftp.example.com".

Ignacio Vazquez-Abrams

Posted 2012-02-28T04:20:23.313

Reputation: 100 516

To be clear, CNAME records point aliases at the canonical name. So in Ignacio's answer, barkley.example.com is the canonical name, and www.example.com is an alias, and it's written as www.example.com CNAME barkley.example.com and barkley.example.com would have a record specifying its IP address, whereeas www.example.com wouldn't. – Breandán Dalton – 2015-06-09T11:47:34.993

Now I am completely confused. Can it be that you are confusing an "alias" and a "canonical host name" here? To my understanding, a machine can only have a single canonical hostname. In any case, this reply is directly contradictory to what RedGrittyBick says in his reply. Can – olenz – 2016-07-21T09:27:27.210

so, canonical names are a subset of the single host name. Is it used for TCP protocol to direct the packets to a certain port(HTTP vs. FTP for example)? – KMC – 2012-02-28T04:50:32.993

No. The name has nothing to do with which ports are available except where the server software itself restricts it (if even possible). – Ignacio Vazquez-Abrams – 2012-02-28T04:53:38.247

since different canonical name points to the same IP, why do we need more names other than the domain name? – KMC – 2012-02-28T05:18:45.407

For convenience and convention. Plus, it allows for moving services to a different host without having to change the name. – Ignacio Vazquez-Abrams – 2012-02-28T05:20:06.593

But multiple canonical names can point to the same host with a single IP. I do not understand what you mean by "moving services to a different host without having to change the name"? – KMC – 2012-02-28T05:34:20.567

They can be pointing to the same machine one day, and different machines the next. Nothing needs to be done to clients in order to make this migration work. – Ignacio Vazquez-Abrams – 2012-02-28T05:37:41.343

host name could be "barkley", Domain Name - "barkley.example.com", Canonical Name - any in any domain, but linked (in DNS) to Domain Name. – Lazy Badger – 2012-02-28T11:29:04.920

5

In DNS, a hostname is a domain name that identifies a host computer (e.g. foo.example.com). The term hostname is also used to mean the name used for a computer without the domain suffix (foo).

Note that the above usage, as used by DNS administrators, is slightly different from more causal usage where example.com would be considered a domain but many people don't realise a fully qualified hostname is also technically a domain name (see RFCs).

In DNS there are many types of records:

  • "A" records associate a domain name with an address
  • "CNAME" records associate an alias (extra) domain name with a canonical domain name
    • multiple CNAME records can be used to associate several aliases with a single canonical domain name
  • "PTR" records are normally used to associate an IP-address with a canonical domain name.
  • etc

"Canonical" means "unique distinguished exemplar". A computer may have many aliases but should only have one canonical name.


From RFC1035

CNAME A <domain-name> which specifies the canonical or primary name for the owner. The owner name is an alias.


From RFC1034

Most of these systems have a notion that one of the equivalent set of names is the canonical or primary name and all others are aliases.

RedGrittyBrick

Posted 2012-02-28T04:20:23.313

Reputation: 70 632