When you are setting up your new website, one of the essential things to configure are the DNS records of your domain. Without proper DNS records, the website and email service will not work properly. But I want to explain it step by step.
The Domain Name System (“DNS”) is responsible for translating domain names into IP addresses. The IP addresses point to the server, where the services like webserver or mailserver are located, in most cases your shared webhosting or dedicated virtual server.
The A record resolves your domain name to the corresponding IP address, where your website is hosted (webserver). In case of my website, the following A records are set up:
A CNAME record maps one domain name to another, like an alias. The advantage of this one is that you do not have to change all IP addresses if the web host changes. So, a CNAME points e.g. to an A record, which points to the IP address. Only the IP address of the A record needs to be changed and the CNAME will point to the correct and new address.
The MX record specifies the mailserver of your domain. In most cases, the mail service is also included in your webhosting package. MX records contain an additional field called Priority, which defines the preferred server. If it has the same value for two entries which is pretty common, the mail will be evenly delivered to the defined mailservers. The MX record is used in combination with an A record and cannot be used with a CNAME record.