• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Monday, January 27, 2014

    What is the difference between DNS A record and CNAME record ?

    A record

    • It is the Address records also known as host records
    • Points to the IP address reflecting the domain
    • Used for forward lookup of any domain name

    For example:
    Our website is configured on IP so the A record of my domain name will point towards that IP.

    Every time a query for golinuxhub.com is made the internet will lookup for contents stored on the machine with this IP.

    Can I use multiple A records for a single domain?
    Yes, there can be multiple A records for a single domain but only that is not going to help you with failover in case you are planning for one. Using multiple A records for a single domain will help you create a round robin configuration.

    For example you have used two IPs and for same domain name example.com so when a user hits the lookup query for example.com, the query would land on your nameservers. Now there the query can pick any of the A record entry and will load the page. So, basically the back end user does not gets to know the server from which the website was picked and loaded. There might be a possibility that simultaneously if another request is made for the same domain, another A record might be picked up for different user.

    CNAME Record

    • It is short abbreviation for Canonical Name
    • Provides an alias name for same hostname
    • Helps create subdomains

    NOTE: You can not create a CNAME record for the domain name itself (it should be done with A record)

    For example:
    golinuxhub.com is a domain name whereas www.golinuxhub.com is a sub domain name

    Example using A records and CNAME records
                     IN  NS example.com.
    example.com.     IN  A

    www.example.com  IN CNAME example.com.
    ftp.example.com  IN CNAME example.com.
    test.example.com IN CNAME example.com.

    In the above example I have defined the nameserver for my machine and the A record determines the IP address pointing to the name server

    Also I have used CNAME record to use multiple sub domain names for the same nameserver i.e. www, ftp, test etc

    I hope I have made myself clear.

    Related Articles
    How does a DNS query works when you type a URL on your browser?
    DNS server related errors
    Configure your BIND DNS server on different port no.
    How to configure BIND-9.2 DNS server in Red Hat Linux
    How to configure BIND-9.8 DNS server in Red Hat Linux 6
    How to configure a caching only bind DNS server in Red Hat Linux

    Follow the below links for more tutorials

    Configure Red Hat Cluster using VMware, Quorum Disk, GFS2, Openfiler
    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to extract files to different directory using tar in Unix/Linux
    How to preserve Symbolic links with tar command in Unix/Linux
    How to give permission to user to run some commands in Linux
    How to set environment (PATH) variable permanently in Linux
    How to mount windows share on linux