Canonical Name records (CNAME) is a type of DNS records that maps one alias domain to the true domain name. This proves convenient when using multiple services from a singular IP address.
For example; if there is a server where one store all the documents, like documents.example.com and can also be accessed as docs.example.com then you can add a CNAME to it to lead both these websites to documents.example.com. However, the canonical name that a CNAME record points to can be anywhere in the DNS, whether local or on a remote server in a different DNS zone. So, the search could resolve to the second name. This is how it looks;
The CNAME records must lead back to another domain name and never directly to an IP address.
DNS traces the system’s domain name back to the IP address, but often more than one domain name traces back to the same IP address and this is where CNAME proves to be useful. A system can have multiple CNAME aliases but a separate CNAME record must be noted in the database for each alias.