Difference between DNS A, CNAME and Redirect Records

DNS ‘A’ and ‘AAAA’ record points a domain to an IPv4 and IPv6 address respectively and serve as backbone of domain name to IP address resolution, whereas ‘CNAME’ record points an domain to another domain. ‘Redirect’ record is not a part of DNS record although most of the domain registrars provide it using web hosting server.

‘A’ & ‘AAAA’ Record:

  1. It resolves a domain name to an IPv4 address
  2. A record is backbone of ‘CNAME’ and MX record.
  3. A domain may also be resolved to an IPv6 address using ‘AAAA’ record.
  4. It’s possible to define more than one A or ‘AAAA’ record for a single domain or sub domain. When multiple such records are used nameserver returns all of them but change their order of appearence in reply message using DNS rotation, a part of DNS protocol. Browser usually pick up the first one from DNS reply, and if fail to reach that server it quarry subsequent IP address from DNS reply.
  5. If both ‘A’ and ‘AAAA’ is specified browser prefers ‘AAAA’ in an IPv6 enabled network, else it’s bound to use IPv4.

‘CNAME’ Record

  1. ‘CNAME’ points a domain to another domain. E.g. say mail.mydomain.com have a ‘CNAME’ ghs.googlehosted.com. This will ultimately point mail.mydomain.com to the IP address of ghs.googlehosted.com say 64.233.168.121.
  2. ‘CNAME’ record is very useful while changing IP address keeping DNS record of the domain intact. Ultimate IP address of mail.yourdomain.com can be changed by switching the IP address of ghs.googlehosted.com only.
  3. ‘A’ & ‘AAAA’ has higher priority than ‘CNAME’ record. So, ‘CNAME’ can’t be used with ‘A’ or ‘AAAA’ record

‘Redirect’ Record and it’s difference with ‘A’ and ‘CNAME” Record:

  1. ‘Redirect’ record redirects one URL to another using 301 [permanent] or 302 [temporary] redirection. This is not a DNS record at all.
  2. This record is created and maintained with web hosting server at service provider’s end and is provided using either server level or client level redirection. Hence, for Redirect record to work,  ‘A’ record pointing to hosting server’s IP is need to be created in DNS zone of the domain.
  3. ‘Redirect’ Record works on URL basis hence a particular URL can be redirected to another URL using ‘Redirect’ Record whereas being a DNS record ‘A’ and ‘CNAME’ works on a domain or sub domain only. Like you can redirect http://yourdomain.com/yourname to http://anotherdomain.com/anothername, which can’t be done with ‘A’ and ‘CNAME’ Record.
  4. Being a DNS record resolution of ‘A’, ‘AAAA’ or ‘CNAME’ is much faster than even server level redirection, whereas client level redirection is much slower due to increasing number of http request.

Which Record is useful for which service?

  • ‘A’ or ‘AAAA’ is to map a domain to web hosting server for hosting a website
  • ‘CNAME’ is useful to point multiple domain to an IP using single ‘A’ record. Like you may create ‘A’ record for yourdomain.com and use yourdomain.com as ‘CNAME’ for www, ftp, smtp etc subdomain of yourdomain.com. This specially comes handy while switching hosting provider. Change of a single A record will point all the subdomain to the new server. This is also useful when hosting provider don’t let you know about internal change of their IP address.
  • ‘Redirect’ record is useful to move a website or a part of a website to another. URL Redirection based link Shortener like goo.gl, bit.ly is also very popular now a days.
  • Redirection Record doesn’t need any propagation time whereas DNS record may take 48 hour to propagate.

Leave a Reply

Your email address will not be published. Required fields are marked *