DNS Records can be a nightmare sometimes, but they really don’t have to be something complicated. As long as you have your web-server set up correctly, odds are very good that your DNS changes will be able to be done perfectly fine without any hiccups.
When you go to change or add DNS records at the place where you purchased your domain or wherever you have your nameservers set to, usually you will see something like this table below:
Host | Record | Priority | Value @ | A | NA | 127.0.0.1 @ | MX | 10 | mx1.mysite.com www | CNAME | NA | mysite.com
These are some of the more common ones, and they are usually all that you should need when transferring a website to a different server or host. If you have other records, it would be a good idea to consult with whoever set those records in the first place to make sure that you are set up everywhere else before you try to repoint the DNS settings.
The A Record:
This DNS record is the basis of your site. It points to the static IP address that your machine is hosted on. If you are using a service like Cloudflare for DDoS (Distributed Denial of Service) protection or as a CDN (Content Delivery Network) then you will point this A record to the IP address that the service gives to you. Without this record being active and pointed correctly, your website will not be reachable at the domain you are configuring.
The CNAME Record:
This is a way of pointing a subdomain of your site, where the subdomain portion (e.g.www.mysite.com, dev.mysite.com, etc) is entered in the host cell, to a domain name instead of an IP address. See the table above to see how it should be set up. This record type is commonly used for pointing the "www." subdomain to the www-less domain, to create an effect as follows:
The MX Record:
The MX Record or mail record is used to provide your domain name with directions to get to the mail server that you would use for any email addresses that use your domain name, such as firstname.lastname@example.org. Typically, you will have more than one of these MX Records in case one of the email connections fails so that you have a backup connection available in that event. As you may have noticed, there is another field with these records, called the priority. This number tells the server that is trying to connect to the mail servers to try the one with the lowest number first. Usually you see this number increment in units of 10, and you may see several records of this type, especially if you have set up an external email service such as google’s email for business.
There are several other record types, each with their own special functions, and you may find yourself needing them from time to time. If you do, be sure to research what they do, how to properly use them, and what implications there may be to using them as far as security and accessibility goes. It is a good idea, in general, to set up the ones that you understand, but to also learn about the others to see if they may have any use for you.